Difference between revisions of "Install Bravia"
 (→Debian with SystemD)  | 
				|||
| (15 intermediate revisions by one user not shown) | |||
| Line 10: | Line 10: | ||
= Set-up the TV =  | = Set-up the TV =  | ||
| − | Controlling the TV requires   | + | Controlling the TV requires its:  | 
* IP address  | * IP address  | ||
* device name  | * device name  | ||
* device id  | * device id  | ||
| − | * PIN  | + | * PIN (entered at setup time)  | 
* Pre-Shared Key (PSK)  | * 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 > <i>value</i>  | ||
| − | Install <code>pip</code> if it isn't done yet  | + | == Test the script ==  | 
| + | |||
| + | Install <code>pip</code> if it isn't done yet:  | ||
  su  |   su  | ||
  which pip  |   which pip  | ||
| − | + |   pip -V  | |
| + |  apt install -y python3-pip  | ||
| + |  pip install requests  | ||
  exit  |   exit  | ||
Download [https://github.com/darkosancanin/bravia_console Bravia Console].  | Download [https://github.com/darkosancanin/bravia_console Bravia Console].  | ||
| − | + |   su control  | |
| − | + |  SCRIPTS_DIR='/home/control/Documents/Controls/'  | |
| − |   unzip bravia_console  | + |   wget https://github.com/darkosancanin/bravia_console/archive/master.zip -O ~/Downloads/bravia_console.zip  | 
| − | + |   unzip ~/Downloads/bravia_console.zip -d /tmp/  | |
| − |   ./bravia_console.py  | + |   cp /tmp/bravia_console-master/bravia_console.py $SCRIPTS_DIR/  | 
| + |   chmod 775 $SCRIPTS_DIR/bravia_console.py  | ||
| + |  $SCRIPTS_DIR/bravia_console.py  | ||
    > exit  |     > exit  | ||
| Line 44: | Line 54: | ||
    > poweroff  |     > poweroff  | ||
    > tvpower  |     > tvpower  | ||
| + |    > exit  | ||
Change input source:  | Change input source:  | ||
  ./bravia_console.py -c hdmi2 > /dev/null  |   ./bravia_console.py -c hdmi2 > /dev/null  | ||
  ./bravia_console.py -c hdmi1 > /dev/null  |   ./bravia_console.py -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 [http://www.dspc.ch/xPL/Downloads/xpl-screen-bravia.pl screen controller] script to xPL scripts directory:  | ||
| + |  su control  | ||
| + |  SCRIPTS_BASE_DIR=/home/control/Documents/Controls  | ||
| + |  cd $SCRIPTS_BASE_DIR  | ||
| + |  wget http://www.dspc.ch/xPL/Downloads/xpl-screen-bravia.pl  | ||
| + |  chown control:users *.pl  | ||
| + |  chmod 775 *.pl  | ||
| + | |||
| + | Test the screen controller:  | ||
| + |  su control  | ||
| + |  SCRIPTS_BASE_DIR=/home/control/Documents/Controls  | ||
| + |  $SCRIPTS_BASE_DIR/xpl-screen-bravia.pl -v -n loungeScreen  | ||
| + | |||
| + | Open another terminal window and test the commands:  | ||
| + |  su control  | ||
| + |  SCRIPTS_BASE_DIR=/home/control/Documents/Controls  | ||
| + |  $SCRIPTS_BASE_DIR/xpl-send.pl -d dspc-screen.loungeScreen -c screen.basic power=off  | ||
| + |  $SCRIPTS_BASE_DIR/xpl-send.pl -d dspc-screen.loungeScreen -c screen.basic power=toggle  | ||
| + |  $SCRIPTS_BASE_DIR/xpl-send.pl -d dspc-screen.loungeScreen -c screen.basic input=hdmi4  | ||
| + | |||
| + | = Launch the scripts at startup =  | ||
| + | |||
| + | == Debian with SystemD ==  | ||
| + | |||
| + | On Debian with [https://wiki.debian.org/systemd systemd] (such as [https://www.raspbian.org/ Raspbian]),  | ||
| + | the scripts can be defined as services.  | ||
| + | |||
| + | Edit <code>/lib/systemd/system/xpl-loungeScreen.service</code>:  | ||
| + |  [Unit]  | ||
| + |  Description=lounge Sony Bravia screen control  | ||
| + |  After=xpl-hub.service  | ||
| + | |||
| + |  [Service]  | ||
| + |  Type=simple  | ||
| + |  ExecStart=/home/control/Documents/Controls/xpl-screen-bravia.pl -n loungeScreen -w 2  | ||
| + |  Restart=always  | ||
| + | |||
| + |  [Install]  | ||
| + |  WantedBy=multi-user.target  | ||
| + | |||
| + | Activate the service:  | ||
| + |  su  | ||
| + |  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  | ||
| + | |||
| + | |||
| + | [[Category: all]] [[Category: install]] [[Category:xPL]]  | ||
Latest revision as of 09:26, 13 January 2022
The Sony Bravia series are powered by Android.
Different python packages allow to control the TV from a PC:
- Bravia Console
 - py-sony-bravia-remote, Python 3
 - BraviaRC, Python 3
 - sonybraviacontrol
 - bravialib
 
Contents
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:
su which pip pip -V apt install -y python3-pip pip install requests exit
Download Bravia Console.
su control SCRIPTS_DIR='/home/control/Documents/Controls/' wget https://github.com/darkosancanin/bravia_console/archive/master.zip -O ~/Downloads/bravia_console.zip unzip ~/Downloads/bravia_console.zip -d /tmp/ cp /tmp/bravia_console-master/bravia_console.py $SCRIPTS_DIR/ chmod 775 $SCRIPTS_DIR/bravia_console.py $SCRIPTS_DIR/bravia_console.py > exit
The console interface shows how to set-up the Pre-Shared Key (PSK).
Edit bravia_console.py to match the script to your PSK:
self.psk = "0000"
Connect to the TV:
./bravia_console.py > show info > show commands > hdmi1 > poweroff > tvpower > exit
Change input source:
./bravia_console.py -c hdmi2 > /dev/null ./bravia_console.py -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 SCRIPTS_BASE_DIR=/home/control/Documents/Controls cd $SCRIPTS_BASE_DIR wget http://www.dspc.ch/xPL/Downloads/xpl-screen-bravia.pl chown control:users *.pl chmod 775 *.pl
Test the screen controller:
su control SCRIPTS_BASE_DIR=/home/control/Documents/Controls $SCRIPTS_BASE_DIR/xpl-screen-bravia.pl -v -n loungeScreen
Open another terminal window and test the commands:
su control SCRIPTS_BASE_DIR=/home/control/Documents/Controls $SCRIPTS_BASE_DIR/xpl-send.pl -d dspc-screen.loungeScreen -c screen.basic power=off $SCRIPTS_BASE_DIR/xpl-send.pl -d dspc-screen.loungeScreen -c screen.basic power=toggle $SCRIPTS_BASE_DIR/xpl-send.pl -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:
[Unit] Description=lounge Sony Bravia screen control After=xpl-hub.service [Service] Type=simple ExecStart=/home/control/Documents/Controls/xpl-screen-bravia.pl -n loungeScreen -w 2 Restart=always [Install] WantedBy=multi-user.target
Activate the service:
su 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