philips tv with domoticz
Posted: Monday 08 February 2021 20:36
hi all,
Im now using domoticz for 2years and now I want to share some work of me I did for my philips oled803 television.
I searched for controlling my tv in domoticz but I didnt find what was needed.
After some time looking on the net I found eslavnov python script Pylips.
Working with it and after some testing We where able to control my tv in terminal.
But i wanted to have it working from domoticz but again nothing to find how to implement that.
So I did give it a shot, im not a programmer so the code maybe isnt that good, but it works.
I want to help all the people to integrate the tv.
This is my how-to!
In terminal:
-cd domoticz/scripts
-git clone https://github.com/eslavnov/pylips.git pylips //clone all files to scripts
-cd pylips //enter the map you just download all the files to
-sudo nano settings.ini //go into this file
-fill in and save: [TV] // the rest is filled in automatiq after the auth
host = 192.168.1.***
-python pylips.py // run this when your tv is powered ON and then you recieve a 4digit code,
fill that code in terminal.
now you get a username and password in return. Save that somewhere!
-sudo nano settings.ini //run again, now you see all settings are filled in, then your good!
-sudo nano tvphilips.sh //make this file and save this inside with your username and password.
-paste the script below in the file and fill in your host,username and password in and save it:
#!/bin/sh
# make sure we're running as the user
RUN_AS="pi" # Enter username here
if [ "$USER" != "$RUN_AS" ]
then
echo ""
echo " This script must run as $RUN_AS, trying to change user..."
exec sudo -u $RUN_AS $0 $1
fi
echo $1
case $1 in
standby)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command standby &
exit 0
;;
power_on)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command power_on &
exit 0
;;
mute)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command mute &
exit 0
;;
volumeup)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command volume_up &
exit 0
;;
volumedown)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command volume_down &
exit 0
;;
*)
exit 1
;;
esac
-sudo chmod +x /home/pi/domoticz/scripts/pylips/tvphilips.sh //make executable
-now make a dummy switch in domoticz on/off or selector
and put this commands in on/off
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh standby
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh power_on
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh mute
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh volumeup
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh volumedown
more details and commands in this github page:
https://github.com/eslavnov/Pylips#setting-up-pylips
Im now using domoticz for 2years and now I want to share some work of me I did for my philips oled803 television.
I searched for controlling my tv in domoticz but I didnt find what was needed.
After some time looking on the net I found eslavnov python script Pylips.
Working with it and after some testing We where able to control my tv in terminal.
But i wanted to have it working from domoticz but again nothing to find how to implement that.
So I did give it a shot, im not a programmer so the code maybe isnt that good, but it works.
I want to help all the people to integrate the tv.
This is my how-to!
In terminal:
-cd domoticz/scripts
-git clone https://github.com/eslavnov/pylips.git pylips //clone all files to scripts
-cd pylips //enter the map you just download all the files to
-sudo nano settings.ini //go into this file
-fill in and save: [TV] // the rest is filled in automatiq after the auth
host = 192.168.1.***
-python pylips.py // run this when your tv is powered ON and then you recieve a 4digit code,
fill that code in terminal.
now you get a username and password in return. Save that somewhere!
-sudo nano settings.ini //run again, now you see all settings are filled in, then your good!
-sudo nano tvphilips.sh //make this file and save this inside with your username and password.
-paste the script below in the file and fill in your host,username and password in and save it:
#!/bin/sh
# make sure we're running as the user
RUN_AS="pi" # Enter username here
if [ "$USER" != "$RUN_AS" ]
then
echo ""
echo " This script must run as $RUN_AS, trying to change user..."
exec sudo -u $RUN_AS $0 $1
fi
echo $1
case $1 in
standby)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command standby &
exit 0
;;
power_on)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command power_on &
exit 0
;;
mute)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command mute &
exit 0
;;
volumeup)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command volume_up &
exit 0
;;
volumedown)
python3 /home/pi/domoticz/scripts/pylips/pylips.py --host 192.168.1.*** --user <username> --pass <password> --command volume_down &
exit 0
;;
*)
exit 1
;;
esac
-sudo chmod +x /home/pi/domoticz/scripts/pylips/tvphilips.sh //make executable
-now make a dummy switch in domoticz on/off or selector
and put this commands in on/off
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh standby
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh power_on
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh mute
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh volumeup
script:///home/pi/domoticz/scripts/pylips/tvphilips.sh volumedown
more details and commands in this github page:
https://github.com/eslavnov/Pylips#setting-up-pylips