Install Bravia

From xPL
Jump to: navigation, search

The Sony Bravia series are powered by Android.

Different python packages allow to control the TV from a PC:

Set-up the TV

Controlling the TV requires its:

  • IP address
  • device name
  • device id
  • PIN (entered at setup time)
  • Pre-Shared Key (PSK)

With the remote control, select:

HOME > Settings (gear) > Network > Home network setup > IP control

From there:

Authentication > Normal and Pres-Shared Key
Pre-Shared Key > value

Test the script

Install pip if it isn't done yet:

which pip
pip -V
apt install -y python3-pip
pip install requests

Download Bravia Console.

su control
wget -O ~/Downloads/
unzip ~/Downloads/ -d /tmp/
cp /tmp/bravia_console-master/ $SCRIPTS_DIR/
chmod 775 $SCRIPTS_DIR/
  > exit

The console interface shows how to set-up the Pre-Shared Key (PSK). Edit to match the script to your PSK:

self.psk = "0000"

Connect to the TV:

  > show info
  > show commands
  > hdmi1
  > poweroff
  > tvpower
  > exit

Change input source:

./ -c hdmi2 > /dev/null
./ -c hdmi1 > /dev/null

Change some settings

Remove "Idle TV standby":

Home -> Settings -> Power -> Eco -> Idle TV standby -> Off

Install xPL screen controller

Download the screen controller script to xPL scripts directory:

su control
chown control:users *.pl
chmod 775 *.pl

Test the screen controller:

su control
$SCRIPTS_BASE_DIR/ -v -n loungeScreen

Open another terminal window and test the commands:

su control
$SCRIPTS_BASE_DIR/ -d dspc-screen.loungeScreen -c screen.basic power=off
$SCRIPTS_BASE_DIR/ -d dspc-screen.loungeScreen -c screen.basic power=toggle
$SCRIPTS_BASE_DIR/ -d dspc-screen.loungeScreen -c screen.basic input=hdmi4

Launch the scripts at startup

Debian with SystemD

On Debian with systemd (such as Raspbian), the scripts can be defined as services.

Edit /lib/systemd/system/xpl-loungeScreen.service:

Description=lounge Sony Bravia screen control

ExecStart=/home/control/Documents/Controls/ -n loungeScreen -w 2


Activate the service:

systemctl enable xpl-loungeScreen.service
service xpl-loungeScreen start

Reboot and check:

ps ax | grep -v grep | grep -i xpl
systemctl list-units --type=service --state=running | grep xpl
service xpl-loungeScreen status