This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const http = require('http') | ||
var express = require('express'); | ||
var bravia = require('./lib'); | ||
|
||
var app = express(); | ||
|
||
const port = 5006 | ||
const tvIP = '192.1.168.100' | ||
const pskKey = '0000' | ||
|
||
// Set up the server | ||
app.get('/:intent', function (req, res) { | ||
|
||
// Get the intent | ||
var intent = req.params.intent; | ||
|
||
// Confirm the intent | ||
console.log('Running ' + intent); | ||
|
||
// Call the Bravia function. | ||
bravia(tvIP, pskKey, function(client) { | ||
|
||
// Call a command | ||
client.exec(intent); | ||
|
||
// Send back the ok status. | ||
res.sendStatus(200); | ||
|
||
}); | ||
}); | ||
|
||
// Set up the port listener | ||
app.listen(port, function () { | ||
console.log('Example app listening on port ' + port + '!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters