Giter Club home page Giter Club logo

bravia's Introduction

Bravia Remote Control

Control your Sony Bravia TV using nodejs.

One time setup

TV Setup
  • Turn on your TV
  • On the TV go to Settings > Network > Home network setup > Remote device/Renderer > On
  • On the TV go to Settings > Network > Home network setup > IP Control > Authentication > Normal and Pre-Shared Key
  • On the TV go to Settings > Network > Home network setup > Remote device/Renderer > Enter Pre-Shared Key > 0000 (or whatever you want your PSK Key to be)
  • On the TV go to Settings > Network > Home network setup > Remote device/Renderer > Simple IP Control > On
Node Setup
  • Find your TV's IP address
  • Run npm install
  • Edit the demo.js file with your TV's IP & PSK Key
  • Run node demo.js
  • If you're running this script for the first time, you will be asked to enter a 4-digit code shown on your TV

Authentication

New Method - If you provide a PSK key to the function it will use that to authenticate rather than going through the old method.

Old Method - This library handles the authentication process with the TV, saving the generated cookie as a file that can be accessed in later executions. If you need to refresh the credentials for some reason, just remove any content from the cookies.json file.

Usage

// Accepts two parameters, IP and PSKKey
bravia('192.168.1.100', '0000', function(client) {

  // List available commands
  client.getCommandNames(function(list) {
    console.log(list);
  });

  // Call a command
  client.exec('Netflix');

});

Available commands

The available commands may vary from model to model. I'm getting the following ones with the Sony Bravia KDL-50W805:

PowerOff, Input, GGuide, EPG, Favorites, Display, Home, Options, Return, Up, Down, Right, Left, Confirm, Red, Green, Yellow, Blue, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, Num0, Num11, Num12, VolumeUp, VolumeDown, Mute, ChannelUp, ChannelDown, SubTitle, ClosedCaption, Enter, DOT, Analog, Teletext, Exit, Analog2, *AD, Digital, Analog?, BS, CS, BSCS, Ddata, PicOff, Tv_Radio, Theater, SEN, InternetWidgets, InternetVideo, Netflix, SceneSelect, Mode3D, iManual, Audio, Wide, Jump, PAP, MyEPG, ProgramDescription, WriteChapter, TrackID, TenKey, AppliCast, acTVila, DeleteVideo, PhotoFrame, TvPause, KeyPad, Media, SyncMenu, Forward, Play, Rewind, Prev, Stop, Next, Rec, Pause, Eject, FlashPlus, FlashMinus, TopMenu, PopUpMenu, RakurakuStart, OneTouchTimeRec, OneTouchView, OneTouchRec, OneTouchStop, DUX, FootballMode, Social

Additional commands

I've also added a PowerOn command to that list, that implements WakeOnLAN to turn your TV on.

TODO

  • Clean up the code a bit
  • TV auto-detection (via UPnP or similar)
  • Shortcut commands

Disclaimer

This is an experimental and non-official library developed just for fun, I'm not affiliated with Sony in any way. This software is distributed under the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0

bravia's People

Contributors

alanreid avatar jeff-jk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bravia's Issues

Keeps asking for pass

Every time i run the demo it keeps asking for a password. I already tried to empty cookies.json, but that didn't help.

that is not defined

Tested your updates but i get:

ReferenceError: that is not defined
    at updateCookieJar (/home/pi/bravia/lib/index.js:242:3)
    at /home/pi/bravia/lib/index.js:188:9
    at /home/pi/bravia/lib/index.js:161:7
    at Request._callback (/home/pi/bravia/lib/index.js:225:7)
    at Request.self.callback (/home/pi/bravia/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/home/pi/bravia/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)

Start Netflix film

hey,

how can I start a movie directly in netflix?

best regards
Elias Bennour

Sent commands get flash on screen but no effect.

I've got a Bravia UhD and this code pairs ok with it - but when it tries to send a command, I just get a flash on sony logo / on screen but no effect.

I also extended the makeCommandRequest with a response function but all I see coming back is a blank response.

Any suggestions?

Build in Cam Bravia KD-55X9005B

Hi, would it be possible to have access to cam? Cam was only supported by Skype APP, but this is not supported any more. So I'm thinking about to use the cam for Smarthome stuff...

This is the high-level HTTP control.

This is the higher-level HTTP control.
No need to enable "simple IP control" on the TV - works without (e.g a Bravia 2015 KDL40W-705)

As far as the TV is concerned "Simple IP control" is per Sony doc "Sony Simple IP Control Protocol for BRAVIA" - "The protocol has 24 bytes fixed-size data format.." It's just firing packets, control and status reporting. Doc claims all the lower level functions are available in the HTTP version, unclear how the notifies would work though.

Found more details here - this is the pro stuff, but consumer appears similar if not identical.
https://pro-bravia.sony.net/develop/integrate/ip-control/

demo.js is gone

Readme refers to a demo.js but I don't see one in the repo

Documentation

Looking at the code, the examples are completely wrong, no?

You have implemented ES6 style classes with a static discover() method, though it looks like you can new Bravia() with a known IP and it works.

The new ES6 way seems much more elegant.

Error in install

Hi Alan,
An error is happening =

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the socketwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.```

Node Version v4.1.2

I could't run npm install

I could't run npm install.
Show message:

yuan@Yuan-MacBook-Pro sony/bravia (master) » npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression

> [email protected] install /Users/yuan/Desktop/sony/bravia/node_modules/arpjs/node_modules/pcap/node_modules/socketwatcher
> node-gyp rebuild

  CXX(target) Release/obj.target/socketwatcher/socket_watcher.o
In file included from ../socket_watcher.cpp:5:
In file included from ../socket_watcher.hpp:8:
In file included from ../node_modules/nan/nan.h:80:
In file included from ../node_modules/nan/nan_new.h:190:
../node_modules/nan/nan_implementation_12_inl.h:181:66: error: too many
      arguments to function call, expected at most 2, have 4
  return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
         ~~~~~~~~~~~~~~~~~~                                      ^~~~~~~~~~
/Users/yuan/.node-gyp/2.2.1/deps/v8/include/v8.h:4188:3: note: 'New' declared
      here
  static Local<Signature> New(
  ^
1 error generated.
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:199:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "/usr/local/bin/iojs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yuan/Desktop/sony/bravia/node_modules/arpjs/node_modules/pcap/node_modules/socketwatcher
gyp ERR! node -v v2.2.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok

> [email protected] preinstall /Users/yuan/Desktop/sony/bravia/node_modules/arpjs/node_modules/getmac/node_modules/extract-opts/node_modules/typechecker
> node ./cyclic.js

npm ERR! Darwin 14.4.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install"
npm ERR! node v2.2.1
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the socketwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls socketwatcher
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yuan/Desktop/sony/bravia/npm-debug.log

Homebridge integration

Hi,
I was wondering if it will be possibile to integrate your code with homebridge(https://github.com/nfarina/homebridge) as an accessory or plugin.
Do you have any hint in this case?
Anycase tonight I'll try to take a look to get it work, so I can give command to my bravia through Siri.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.