Control your Sony Bravia TV over the network
bravia-simple-ip-control
is a Node.js library that allows you to control your Sony Bravia TV over your local network. It's especially useful for integrating into a home automation system.
bravia-simple-ip-control
is distributed through NPM:
npm install bravia-simple-ip-control
# or, if you prefer:
yarn add bravia-simple-ip-control
bravia-simple-ip-control
provides both discovery and control capabilities. To monitor the local network for Bravia TVs, try something like this:
import BraviaDiscovery from 'bravia-simple-ip-control';
BraviaDiscovery
.on('founddevice', (device) => {
console.log(`Found a device: ${device.id}`);
})
.on('lostdevice', (device) => {
console.log(`Lost a device: ${device.id}`);
})
.discover();
Once you have a device object, you have a number of control commands at your disposal:
Send an IR code to the TV. See KEYS for a full list of available IR code names.
Get, set, or toggle the power state of the TV.
Get or set the current volume level.
Get or set the mute status.
Get or set the current channel.
Get or set the current "triplet" channel. (I don't currently know what a "triplet" channel is.)
Get or set the current input source (antenna, cable, etc).
Get or set the current input (HDMI, component, etc). Value is one of:
- tv
- hdmi
- scart
- composite
- component
- mirroring
- pc-rgb
followed by a number 1-9999 (for any of the options except tv).
Get, set, or toggle the picture mute feature. Picture mute turns off the screen without turning off the TV (in other words, audio only).
Get, set, or toggle the Picture in Picture status. May not be supported by all models.
Get the IP or hardware address of the given network interface.
Get or set the current scene setting value. One of:
- auto
- auto24pSync
- general
The following events are fired when it is detected that the corresponding state has changed:
bravia-simple-ip-control
is built to support Node.js version 6.0 or higher.
Contributions are of course always welcome. If you find problems, please report them in the Issue Tracker. If you've made an improvement, open a pull request.
Getting set up for development is very easy:
git clone <your fork>
cd bravia-simple-ip-control
yarn
And the development workflow is likewise straightforward:
# make a change to the src/ file, then...
yarn build
node dist/example.js
# or if you want to clean up all the leftover build products:
yarn run clean
- 1.0.0
- The first release.
Zach Bean – zb@forty2.com
Distributed under the MIT license. See LICENSE for more detail.