Python Plugin Philips TV 2016

Python and python framework

Moderator: leecollings

Post Reply
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Python Plugin Philips TV 2016

Post by Brutus »

I have been looking at the Wiki page to find new stuff that I can use :) I landed at this page:
http://www.domoticz.com/wiki/Philips_tv

At the bottom of the page there is a section about Philips TV's with android from 2016:

The 2016 Android based TVs from Philips expose a subset of the Jointspace JSON API, however it is protected behind a pairing mechanism. The following features are supported:

Audio parameters control
Ambilight control
Read out system parameters
Send basic RC commands

The pairing mechanism has been reverse engineered and a basic python script to control these TVs can be found at: https://github.com/suborb/philips_android_tv


Is it possible to change this script so it can be used as a Python plugin for Domoticz?
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
GuyTreepbush
Posts: 19
Joined: Thursday 12 January 2017 13:26
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin Philips TV 2016

Post by GuyTreepbush »

Have been thinking about doing the same. It should not be too difficult what the plug-in should do. Challenge is the auto creation of buttons etc.

At the moment I use the json api to set the volume depening on which source is selected and to turn of the tv when radio is turned on, we go to sleep or left home but 'forgot' to turn of the TV.

I know there are some other tv plug-ins but have no idee what functionality they include.

What would we want the plug-in to do?
- state detection: off/source/Chanel
- turn of (on is not possible via API)
- set volume via slider

There is an app that can basically do all buttons and all this could potentially be added but makes really not fitting the domoticz setup.
Using the Sony tv plug-in as a start already gives manager st of the code.
miroslavpetrov
Posts: 33
Joined: Wednesday 03 February 2016 13:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin Philips TV 2016

Post by miroslavpetrov »

Hello,

I have Philips 49PUS7181 2016 with Android Tv. Can you give some guidance on how to control it from domoticz?
Automation Hardware:
Domoticz on Raspberry Pi 3 with HomeBridge.
Zigbee2MQTT + Xiaomi sensors
Fibaro HomeCenter 2 + Fibaro Dimmer2 & Double Switch2 + Aeon Multisensor 6 + Remotec ZXT-120
Eastron SDM230
cipriani
Posts: 3
Joined: Friday 01 December 2017 19:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin Philips TV 2016

Post by cipriani »

Hi miroslavpetrov,

I have looking for this for more than one day...
And finally that's what i've done :
  • Pairing my raspberry to my philips TV with mention script (https://github.com/suborb/philips_android_tv)

    Code: Select all

    ./philips.py --host <IP_ADRESS> pair
     # this should return username:password. Don't forget to enter code mentioned on TV Screen
     
  • Make a shell script in order to execute some command over JointSpace API. Example to put volume to 6 :

    Code: Select all

    curl -s --insecure --anyauth --user <username>:<password> -H "Accept: application/json" -X POST -d  "{\"muted\":false,\"current\":6}" https://<ip_of_TV>:1926/6/audio/volume
     
    JointSpace API documentation is available here : http://jointspace.sourceforge.net/proje ... c/API.html
    In most of the case, just replace http://<ip_of_TV>:1925/1/ by https://<ip_of_TV>:1926/6/
    For ambilight status, HTTP works. No need of HTTPS.
  • For starting TV ON and OFF, I use cec-client commands in my shell

    Code: Select all

    echo "on 0" | cec-client -s 
    echo "standby 0"  | cec-client -s
    
  • Finally, I use a virtual switch in domoticz for my TV, a deamon on my raspberry to check current state of TV and to update it in domoticz, and a lua script to control all of it with os.execute() command.
Just, if you use cec-client you will have to switch manually your TV OFF after rebooting raspberry pi.
-------
Sorry for my english, i'm french :)
miroslavpetrov
Posts: 33
Joined: Wednesday 03 February 2016 13:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin Philips TV 2016

Post by miroslavpetrov »

Thank you very much for your reply. I somehow had missed it and I was just looking again in the forum if someone has found a solution and I saw your reply :D
Automation Hardware:
Domoticz on Raspberry Pi 3 with HomeBridge.
Zigbee2MQTT + Xiaomi sensors
Fibaro HomeCenter 2 + Fibaro Dimmer2 & Double Switch2 + Aeon Multisensor 6 + Remotec ZXT-120
Eastron SDM230
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Python Plugin Philips TV 2016

Post by mcwieger »

Thanks for the info provided.

I have a 55POS9002 (2017) and I believe that year onwards Jointspace is no longer supported. This is the message I get when I connect to port 1925:

Code: Select all

Not Found

The server has not found anything matching the request URI

You can get technical details here.
Please continue your visit at our home page.
Port 1926 gives a Page not found message.

The pairing script still works though...
I moved to HomeAssistant. It was fun while it lasted!
QSKONE
Posts: 38
Joined: Monday 12 February 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python Plugin Philips TV 2016

Post by QSKONE »

Philips PUS7150 (2016)

Code: Select all

pi@raspberrypi:~/philips_android_tv-master $ ./philips.py --host 192.168.31.7 pair
bash: ./philips.py: Permission denied
pi@raspberrypi:~/philips_android_tv-master $ chmod u+x philips.py
pi@raspberrypi:~/philips_android_tv-master $ ./philips.py --host 192.168.31.7 pair
from: can't read /var/mail/__future__
from: can't read /var/mail/base64
from: can't read /var/mail/datetime
./philips.py: line 4: import: command not found
./philips.py: line 5: import: command not found
./philips.py: line 6: import: command not found
./philips.py: line 7: import: command not found
./philips.py: line 8: import: command not found
from: can't read /var/mail/Crypto.Hash
from: can't read /var/mail/requests.auth
./philips.py: line 11: import: command not found
./philips.py: line 20: syntax error near unexpected token `def'
./philips.py: line 20: `def createDeviceId():'
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest