npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bravia

v1.3.3

Published

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

Downloads

1,119

Readme

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(devices[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 by name.
bravia.send('Mute');

// Sends an IRCC code signal by value.
bravia.send('AAAAAQAAAAEAAAAUAw==');

// Sends multiple IRCC code signals by name and/or value. Change bravia.delay to alter time between each command sent.
bravia.send(['Hdmi1', 'AAAAAgAAABoAAABaAw==', 'Hdmi2', 'AAAAAgAAABoAAABbAw==']);