GithubHelp home page GithubHelp logo

ilessiivi / bravia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from waynehaffenden/bravia

0.0 1.0 0.0 16 KB

Node.js module for discovering and controlling Sony BRAVIA Android TVs.

License: MIT License

JavaScript 100.00%

bravia's Introduction

Sony BRAVIA

Node.js module for discovering and controlling Sony BRAVIA Android TVs. This module allows you retrieve all the available service protocol API methods and invoke any of them.

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

Install with NPM

npm install bravia --save

Usage

All methods return a Promise.

Discovery

const Bravia = require('bravia');

// The time in milliseconds for the bravia discovery to scan for.
let timeout = 5000;

// Attempts to discover any Sony Bravia TVs.
Bravia.discover(timeout)
  .then(devices => {
    for (let device in devices) {
      console.log(device);
    }
  })
  .catch(error => console.error(error));

Service Protocol APIs

const Bravia = require('bravia');

// Connects to a Bravia TV at 192.168.1.2:80 with the PSK 0000.
let bravia = new Bravia('192.168.1.2', '80', '0000');

// Retrieves all the system method type versions.
bravia.system.getVersions()
  .then(versions => console.log(versions))
  .catch(error => console.error(error));

// Retrieves all the system method types and versions.
bravia.system.getMethodTypes()
  .then(methods => console.log(methods))
  .catch(error => console.error(error));

// Retrieves all the available IRCC commands from the TV.
bravia.system.invoke('getRemoteControllerInfo')
  .then(commands => console.log(commands))
  .catch(error => console.error(error));

// Queries the volume info.
bravia.audio.invoke('getVolumeInformation')
  .then(info => console.log(info))
  .catch(error => console.error(error));

// Sets the speaker volume level to 50%.
bravia.audio.invoke('setAudioVolume', '1.0', { target: 'speaker', volume: '50' });

Send IRCC Code

const Bravia = require('bravia');

// Connects to a Bravia TV at 192.168.1.2:80 with the PSK 0000.
let bravia = new Bravia('192.168.1.2', '80', '0000');

// Retrieves all the available IRCC commands from the TV.
bravia.getIRCCCodes()
  .then(commands => console.log(commands))
  .catch(error => console.error(error));

// Sends an IRCC code signal.
bravia.send('Mute');

// Sends multiple IRCC code signals. Change bravia.delay to alter time between each command sent.
bravia.send(['Up', 'Down', 'Left', 'Right']);

Send raw IRCC Code

const Bravia = require('bravia');

// Connects to a Bravia TV at 192.168.1.2:80 with the PSK 0000.
let bravia = new Bravia('192.168.1.2', '80', '0000');

// Send request to set source to HDMI1
bravia.sendIRCC('AAAAAgAAABoAAABaAw==');

bravia's People

Contributors

waynehaffenden avatar phillipsnick avatar

Watchers

 avatar

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.