Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-bravia-serial-control

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-bravia-serial-control

The node-bravia-serial-control is a Node.js module which is an implementation of the Serial Control for SONY BRAVIA Professional Displays. You can control BRAVIA Professional Displays from your PC via RS-232C easily using this module.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-bravia-serial-control

The node-bravia-serial-control is a Node.js module which is an implementation of the Serial Control for SONY BRAVIA Professional Displays. You can control BRAVIA Professional Displays from your PC via RS-232C easily using this module.

Dependencies

Installation

$ cd ~
$ npm install serialport
$ npm install node-bravia-serial-control

Table of Contents


Setting BRAVIA

BRAVIA Professional Display has a serial port. But the connector is not D-sub which is widely used. It is 3.5 mm stereo mini jack. I personally recommend to use a USB-to-pin-jack TTL Serial Adapter Converter Cable (FTDI chip) to connect your PC and BRAVIA.

cable

The BRAVIA Serial Control is disabled by default. Before you use this module, you have to enable the BRAVIA Serial Control. Visit the official page, see the section "Set up BRAVIA Professional Display" for details.


Quick Start

Getting status

The BRAVIA Serial Control enables you to retrieve some status or setting modes. The sample code below retrieves the power status of the BRAVIA.

// BraviaSerialControl constructor
const BraviaSerialControl = require('node-bravia-serial-control');
// BraviaSerialControl object
const bravia = new BraviaSerialControl({ path: '/dev/ttyUSB0' });

// Open the serial port
bravia.open().then(() => {
  console.log('Opened.');
  // Retreive the power status
  return bravia.getPowerStatus();
}).then((res) => {
  // Show the result
  console.log(JSON.stringify(res, null, '  '));
  // Close the serial port
  return bravia.close();
}).then(() => {
  console.log('Closed.');
}).catch((error) => {
  console.error(error);
});

In the code above, the variable bravia is a BraviaSerialControl object. you can retrieve the status calling the getPowerStatus() method implemented in the BraviaSerialControl object.

The code above will output the result as follows:

Opened.
{
  "status": false
}
Closed.

As you can see the code above, you have to open the serial port using the open() method before accessing the BRAVIA.

Changing mode

The BRAVIA Serial Control allows you to change various types of status or mode of the BRAVIA. For example, you can change the picture mode using the setPictureMode() method:

// BraviaSerialControl constructor
const BraviaSerialControl = require('node-bravia-serial-control');
// BraviaSerialControl object
const bravia = new BraviaSerialControl({ path: '/dev/ttyUSB0' });

// Open the serial port
bravia.open().then(() => {
  console.log('Opened.');
  // Set the picture mode to "cinema"
  return bravia.setPictureMode({ mode: 'cinema' });
}).then(() => {
  // Show the result
  console.log('Done.');
  // Close the serial port
  return bravia.close();
}).then(() => {
  console.log('Closed.');
}).catch((error) => {
  console.error(error);
});

Emulating IR command

The BRAVIA Serial Control supports the SIRCS (Sony IR Control System) emulation. That is, you can emulate IR commands using this module.

// BraviaSerialControl constructor
const BraviaSerialControl = require('node-bravia-serial-control');
// BraviaSerialControl object
const bravia = new BraviaSerialControl({ path: '/dev/ttyUSB0' });

// Open the serial port
bravia.open().then(() => {
  console.log('Opened.');
  // Emulate the CC (Closed Caption) button on the remote
  return bravia.emulateSircs({ code: 'cc' });
}).then(() => {
  // Show the result
  console.log('Done.');
  // Close the serial port
  return bravia.close();
}).then(() => {
  console.log('Closed.');
}).catch((error) => {
  console.error(error);
});

BraviaSerialControl object

Creating BraviaSerialControl object

In order to use this module , you have to get the BraviaSerialControl constructor loading this module, then create a BraviaSerialControl object from the constructor as follows:

// BraviaSerialControl constructor
const BraviaSerialControl = require('node-bravia-serial-control');
// BraviaSerialControl object
const bravia = new BraviaSerialControl({ path: '/dev/ttyUSB0' });

In the code snippet above, the variable bravia is a BraviaSerialControl object. The BraviaSerialControl object has a variety of methods for controlling the BRAVIA as described in sections below.

The constructor takes a hash object containing the properties as follows:

PropertyTypeRequiredDescription
pathStringRequiredThe identifier of the serial port (e.g., "/dev/ttyUSB0", "COM3")
intervalIntegerOptionalCommand interval (msec). The value must be an integer in the range of 0 to 1000. The default value is 500 (msec).

The BRAVIA Serial Control spec says that "Set the command interval to at least 500 ms.". This module automatically handles the constraint. Basically, you don't have to care about the constraint. For example, chaining promises below works well:

// Open the serial port
bravia.open().then(() => {
  console.log('Opened.');
  // Change the external input to "TV"
  return bravia.setInput({ type: 'tv', port: 1 });
}).then(() => {
  // Set the brightness to 50
  return bravia.setBrightness({ value: 50 });
}).then(() => {
  // Change the picture mode to "cinema"
  return bravia.setPictureMode({ mode: 'cinema' });
}).then(() => {
  // Emulate the CC (Closed Caption) button on the remote
  return bravia.emulateSircs({ code: 'cc' });
}).then(() => {
  // Power off
  return bravia.powerOff();
}).then(() => {
  // Show the result
  console.log('Done.');
  // Close the serial port
  return bravia.close();
}).then(() => {
  console.log('Closed.');
}).catch((error) => {
  console.error(error);
});

Actually, BRAVIAs of recent years might work well even if the interval is shorter than 500 msec. At least, my own BRAVIA worked well even if the interval was set to 0. (The model of my own BRAVIA is KJ-43X8300D which started to be sold from 2016 in Japan.)

const bravia = new BraviaSerialControl({ path: '/dev/ttyUSB0', interval: 0 });

Connection

open() method

The open method opens the serial port and establishes a connection with the BRAVIA. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.open().then(() => {
  console.log('Opened.');
});

Note that you have to open the serial port using this method before calling the methods described in the sections below. This module does not automatically open the port.

close() method

The close method closes the serial port. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.close().then(() => {
  console.log('Closed.');
});

isOpen() method

The isOpen() method returns the connection status. If the serial port is open, this method returns true. Otherwise, this method returns false.

onclose event handler

The onclose event handler will be called when the connection was closed.

bravia.onclose = (event) => {
  console.log(JSON.stringify(event, null, '  '));
}

An object containing the information of the event will be passed to the callback function as follows:

  • When the connection was closed by the close() method:
{
 "intentional": true
}
  • When the connection was closed unexpectedly:
{
 "intentional": false
}

Power

getPowerStatus() method

The getPowerStatus() method retrieves the power status of the BRAVIA. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleantrue: Active (On), false: Standby (Off)
bravia.getPowerStatus()..then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "status": true
}

setPowerStatus() method

The setPowerStatus() method changes the power status of the BRAVIA. This method returns a Promise object.

Note that you have to enable the StandBy mode of the BRAVIA using the enableStandby() method in advance.

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: Active (On), false: Standby (Off)

If the status is not specified, this method toggles the power status. That is, if the BRAVIA is turned on, this method turns it off, and vice versa.

bravia.setPowerStatus({ status: false }).then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleantrue: Active (On), false: Standby (Off)

The code above will output the result as follows:

{
  "status": false
}

powerOn() method

The powerOn() method turns on the BRAVIA. This method returns a Promise object.

Note that you have to enable the StandBy mode of the BRAVIA using the enableStandby() method in advance.

bravia.powerOn()..then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleanThis property always returns true which means Active (On).

The code above will output the result as follows:

{
  "status": true
}

This method is equivalent to the code below:

bravia.setPowerStatus({ status: true })

powerOff() method

The powerOff() method turns off the BRAVIA. This method returns a Promise object.

bravia.powerOff().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleanThis property always returns false which means Standby (Off).

The code above will output the result as follows:

{
  "status": false
}

This method is equivalent to the code below:

bravia.setPowerStatus({ status: false })

togglePowerStatus() method

The togglePowerStatus() method toggles the power status of the BRAVIA like the power button on the remote. That is, if the BRAVIA is turned on, this method turns it off, and vice versa. This method returns a Promise object.

Note that you have to enable the StandBy mode of the BRAVIA using the enableStandby() method in advance.

bravia.togglePowerStatus().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleantrue: Active (On), false: Standby (Off)

The code above will output the result as follows:

{
  "status": true
}

This method is equivalent to the code below:

bravia.setPowerStatus()

enableStandby() method

The enableStandby() method enables the StandBy mode of the BRAVIA. This method returns a Promise object.

The StandBy mode is disabled by default. If you want to turn on the BRAVIA using the setPowerStatus(), powerOn(), and the togglePowerStatus() methods, you have to enable the StandBy mode in advance.

bravia.enableStandby().then((res) => {
  console.log('Done.');
});

disableStandby() method

The disableStandby() method disables the StandBy mode of the BRAVIA. This method returns a Promise object.

bravia.disableStandby().then((res) => {
  console.log('Done.');
});

Input

getInput() method

The getInput() method retrieves the current selected external input. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
typeString"tv", "video", "component", "hdmi", "pc", or "shared"
portIntegerPort number
bravia.getInput().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "type": "hdmi",
  "port": 2
}

When the type is "tv", the value of the "port" does not seem to be a channel number. The BRAVIA Serial Control specification does not provide any information about that.

setInput() method

The setInput() method changes the current selected external input. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
typeStringRequired"tv", "video", "component", "hdmi", "pc", or "shared"
portIntegerRequired1 - 5 (The maximum number depends on the type)

If the type is set to "tv", the value of port must be 1.

Note that the BRAVIA does not return any error even if a type that the BRAVIA does not support is specified.

bravia.setInput({ type: 'hdmi', port: 1 }).then((res) => {
  console.log('Done.');
});

Audio

getAudioVolume() method

The getAudioVolume() method retrieves the level of the audio volume. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
volumeIntegerCurrent audio volume level. The value may be in the range of 0 to 100. The max value depends on your BRAVIA.
bravia.getAudioVolume().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "volume": 20
}

setAudioVolume() method

The setAudioVolume() method changes the level of the audio volume. This method returns a Promise object.

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
volumeIntegerRequiredAudio volume level (0 - 100). The max value depends on your BRAVIA.
bravia.setAudioVolume({ volume: 5 }).then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
volumeIntegerAudio volume level (0 - 100). The max value depends on your BRAVIA.

The code above will output the result as follows:

{
  "volume": 5
}

volumeUp() method

The volumeUp() method turns up the audio volume the specified steps. This method returns a Promise object.

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
stepIntegerOptional1 - 100 (Default: 1)
bravia.volumeUp({ step: 5 }).then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
volumeIntegerAudio volume level (0 - 100). The max value depends on your BRAVIA.

The code above will output the result as follows:

{
  "volume": 25
}

If the sum of the current level and the specified step is grater than the maximum level, The BRAVIA seems to set the volume level to the maximum level. (At least, my own BRAVIA does so.)

volumeDown() method

The volumeDown() method turns down the audio volume the specified steps. This method returns a Promise object.

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
stepIntegerOptional1 - 100 (Default: 1)
bravia.volumeDown({ step: 5 }).then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

If this method was executed successfully, a hash object will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
volumeIntegerAudio volume level (0 - 100). The max value depends on your BRAVIA.

The code above will output the result as follows:

{
  "volume": 20
}

If the current level minus the specified step is less than 0, the BRAVIA seems to set the volume level to 0. (At least, my own BRAVIA does so.)

getAudioMute() method

The getAudioMute() method retrieves the audio mute status. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
statusBooleantrue: Muted, false: Unmuted
bravia.getAudioMute().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "status": false
}

setAudioMute() method

The setAudioMute() method changes the audio mute status of the BRAVIA. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: Mute, false: Unmute

If the status is not specified, this method toggles the status.

bravia.setAudioMute({ status: true }).then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

muteAudio() method

The muteAudio() method mutes audio. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.muteAudio().then(() => {
  console.log('Done.');
});

This method is equivalent to the code below:

this.setAudioMute({ status: true });

unmuteAudio() method

The unmuteAudio() method unmutes audio. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.unmuteAudio().then(() => {
  console.log('Done.');
});

This method is equivalent to the code below:

this.setAudioMute({ status: false });

Off Timer

setOffTimer() method

The setOffTimer() method sets the off (sleep) timer. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
offsetIntegerRequired0 - 255 (minites)

The maximum value of the offset depends on your BRAVIA.

bravia.setOffTimer({ offset: 30 }).then(() => {
  console.log('Done.');
});

If you want to cancel the off timer, set the offset to 0.

bravia.setOffTimer({ offset: 0 }).then(() => {
  console.log('Done.');
});

Picture Mute

setPictureMute() method

The setPictureMute() method changes the status of the picture mute. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: Mute, false: Unmute

If the status is not specified, this method toggles the status.

bravia.setPictureMute({ status: true }).then(() => {
  console.log('Done.');
});

mutePicture() method

The mutePicture() method mutes picture. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.mutePicture().then(() => {
  console.log('Done.');
});

This method is equivalent to the code below:

this.setPictureMute({ status: true });

unmutePicture() method

The unmutePicture() method unmutes picture. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.unmutePicture().then(() => {
  console.log('Done.');
});

This method is equivalent to the code below:

this.setPictureMute({ status: false });

Teletext

getTeletext() method

This method possibly does not work well on your BRAVIA. At least, my own BRAVIA returns an error.

The getTeletext() method retrieves the current teletext mode. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve(). The hash object has the properties as follows:

PropertyTypeDescription
modeString"off", "text", "mix" (MIX-Text )
bravia.getTeletext().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "mode": "text"
}

toggleTeletext() method

This method possibly does not work well on your BRAVIA. At least, my own BRAVIA returns an error.

The toggleTeletext() method toggles the teletext mode. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.toggleTeletext().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

Display

toggleDisplay() method

The toggleDisplay() method toggles the status whether the current TV channel information is shown or hidden on the screen. This method acts like you press the display (info) key on the remote. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.toggleDisplay().then(() => {
  console.log('Done.');
});

Closed Caption

setClosedCaptionStatus() method

The setClosedCaptionStatus() method changes the closed caption status. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: ON, false: OFF

If the status is not specified, this method toggles the status.

bravia.setClosedCaptionStatus({ status: true }).then(() => {
  console.log('Done.');
});

This method possibly does not work well on your BRAVIA. At least, my own BRAVIA accepts the toggle command, but does not accept the ON/OFF command.

setClosedCaptionMode() method

The setClosedCaptionMode() method changes the closed caption mode. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
typeStringRequired"analog" or "digital"
modeStringRequiredSee the description blow.

If the type is "analog", the possible values of the mode are:

  • cc1
  • cc2
  • cc3
  • cc4
  • text1
  • text2
  • text3
  • text4

If the type is "digital", the possible values of the mode are:

  • service1
  • service2
  • service3
  • service4
  • service5
  • service6
  • cc1
  • cc2
  • cc3
  • cc4

The actual acceptable value of the mode depends on your BRAVIA.

bravia.setClosedCaptionMode({ type: 'digital', mode: 'cc1' }).then(() => {
  console.log('Done.');
});

This method possibly does not work well on your BRAVIA. At least, my own BRAVIA acts as if the command is accepted, but nothing is changed.


Picture Mode

setPictureMode() method

The setPictureMode() method changes the picture mode. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
modeStringRequiredSee the description blow.

The possible values of the mode are:

  • vivid
  • standard
  • cinema
  • custom
  • cine2
  • sports
  • game
  • graphic
bravia.setPictureMode({ mode: 'cinema' }).then(() => {
  console.log('Done.');
});

Contrast

setContrast() method

The setContrast() method changes the contrast. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
valueIntegerRequired0 - 100

The actual maximum value of the value depends on your BRAVIA.

bravia.setContrast({ value: 50 }).then(() => {
  console.log('Done.');
});

contrastUp() method

The contrastUp() method increases the contrast one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.contrastUp().then((res) => {
  console.log('Done.');
});

contrastDown() method

The contrastDown() method decrease the contrast one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.contrastDown().then((res) => {
  console.log('Done.');
});

Brightness

setBrightness() method

The setBrightness() method changes the brightness. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
valueIntegerRequired0 - 100

The actual maximum value of the value depends on your BRAVIA. My own BRAVIA accepts up to 50.

bravia.setBrightness({ value: 50 }).then(() => {
  console.log('Done.');
});

brightnessUp() method

The brightnessUp() method increases the brightness one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.brightnessUp().then((res) => {
  console.log('Done.');
});

brightnessDown() method

The brightnessDown() method decrease the brightness one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.brightnessDown().then((res) => {
  console.log('Done.');
});

Saturation

setSaturation() method

The setSaturation() method changes the saturation. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
valueIntegerRequired0 - 100

The actual maximum value of the value depends on your BRAVIA.

bravia.setSaturation({ value: 60 }).then(() => {
  console.log('Done.');
});

saturationUp() method

The saturationUp() method increases the saturation one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.saturationUp().then((res) => {
  console.log('Done.');
});

saturationDown() method

The saturationDown() method decrease the saturation one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.saturationDown().then((res) => {
  console.log('Done.');
});

Hue

hueUp() method

The hueUp() method strengthens the green tone of the hue the specified steps. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
stepIntegerOptional1 - 100 (Default: 1)
bravia.hueUp({ step: 5 }).then((res) => {
  console.log('Done.');
});

hueDown() method

The hueDown() method strengthen the red tone of the hue the specified steps. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
stepIntegerOptional1 - 100 (Default: 1)
bravia.hueDown({ step: 5 }).then((res) => {
  console.log('Done.');
});

Sharpness

setSharpness() method

The setSharpness() method changes the sharpness. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
valueIntegerRequired0 - 100

The actual maximum value of the value depends on your BRAVIA.

bravia.setSharpness({ value: 100 }).then(() => {
  console.log('Done.');
});

sharpnessUp() method

The sharpnessUp() method increases the sharpness one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.sharpnessUp().then((res) => {
  console.log('Done.');
});

sharpnessDown() method

The sharpnessDown() method decrease the sharpness one step. This method returns a Promise object. Nothing will be passed to the resolve().

bravia.sharpnessDown().then((res) => {
  console.log('Done.');
});

Cine Motion (Cinema Drive)

setCineMotionStatus() method

The setCineMotionStatus() method changes the Cine Motion (Cinema Drive) status. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: enable, false: disable

If the status is not specified, this method toggles the status.

bravia.setClosedCaptionStatus({ status: true }).then(() => {
  console.log('Done.');
});

Sound

setSoundMode() method

The setSoundMode() method changes the sound mode. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
modeStringRequiredSee the description blow.

The possible values of the mode are:

  • standard
  • cinema
  • sports
  • music
  • game
bravia.setSoundMode({ mode: 'music' }).then(() => {
  console.log('Done.');
});

setSpeakerStatus() method

The setSpeakerStatus() method changes the speaker status. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: ON, false: OFF

If the status is set to true, the built-in speaker will be enabled. If the status is set to false, the built-in speaker will be disabled and the external audio system will be selected. If any external audio system is not registered by the BRAVIA, no sound will come out of the BRAVIA.

If the status is not specified, this method toggles the status.

bravia.setSpeakerStatus({ status: false }).then(() => {
  console.log('Done.');
});

Screen

shiftScreenPosition() method

The shiftScreenPosition() method shifts the screen position the specified direction and steps. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
hIntegerRequiredSteps of horizontal shift (in the range of -10 to +10 (Default: 0))
vIntegerRequiredSteps of Vertical shift (in the range of -10 to +10 (Default: 0))

If the value of the h is grater than 0, the screen will shift to the right. If the value of the h is less than 0, the screen will shift to the left.

If the value of the v is grater than 0, the screen will shift to the top. If the value of the v is less than 0, the screen will shift to the bottom.

The actual maximum value of the value depends on your BRAVIA. Some model might not support the vertical shift.

bravia.shiftScreenPosition({ h: -3, v: 0 }).then(() => {
  console.log('Done.');
});

setScreenWideMode() method

The setScreenWideMode() method changes the screen wide mode. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
modeStringOptionalSee the description blow.

The possible values of the mode are:

  • wide_zoom
  • full
  • zoom
  • normal
  • pc_normal
  • pc_full1
  • pc_full2

The actual acceptable value of the mode depends on your BRAVIA. If the mode is not specified, this method toggles the mode.

bravia.setScreenWideMode({ mode: 'full' }).then(() => {
  console.log('Done.');
});

setScreenAutoWideStatus() method

The setScreenAutoWideStatus() method changes the screen auto wide status. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
statusBooleanOptionaltrue: ON, false: OFF

If the status is not specified, this method toggles the status.

return bravia.setScreenAutoWideStatus({ status: true }).then(() => {
  console.log('Done.');
});

setScreen4To3Mode() method

The setScreen4To3Mode() method changes the screen 4:3 mode. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
modeStringOptionalSee the description blow.

The possible values of the mode are:

  • normal
  • wide_zoom
  • off

The actual acceptable value of the mode depends on your BRAVIA. If the mode is not specified, this method toggles the mode.

bravia.setScreen4To3Mode({ mode: 'normal' }).then(() => {
  console.log('Done.');
});

SIRCS

emulateSircs() method

The emulateSircs() method send a SIRCS (Sony IR Control System) code. This method returns a Promise object. Nothing will be passed to the resolve().

This method takes a hash object as an argument containing properties as follows:

PropertyTypeRequiredDescription
codeStringRequiredSee the description blow.

The possible values of the code are:

  • input
  • tvPower
  • wide
  • dot
  • display
  • return
  • options
  • home
  • up
  • down
  • left
  • right
  • select
  • num1
  • num2
  • num3
  • num4
  • num5
  • num6
  • num7
  • num8
  • num9
  • num0
  • cc
  • volumeUp
  • volumeDown
  • mute
  • channelUp
  • channelDown
  • jump
bravia.emulateSircs({ code: 'tvPower' }).then(() => {
  console.log('Done.');
});

Note that the BRAVIA might not be able to turned on using the tvPower code even if the StandBy mode is enabled.


Signage

getSignageInfo() method

The getSignageInfo() method retrieves the signage settings. This method returns a Promise object.

If the information is fetched successfully, a hash object containing the information will be passed to the resolve() function. The hash object has the properties as follows:

PropertyTypeDescription
commandStringID Command (HEX)
info1StringProduct info 1
info2StringProduct info 2
info3StringProduct info 3
bravia.getSignageInfo().then((res) => {
  console.log(JSON.stringify(res, null, '  '));
});

The code above will output the result as follows:

{
  "command": "ba",
  "info1": "KJ-43X",
  "info2": "8300D",
  "info3": ""
}

Release Note

  • v0.0.1 (2018-07-27)
    • First public release

References


License

The MIT License (MIT)

Copyright (c) 2019 Futomi Hatano

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 27 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc