Philips Android TV component

Also worth mentioning on this tv model https://ip:1926 doesn’t connect.

Hi to all!

I’ve a Philips 49PUS7100/12 and I can’t pair the TV using the script from (https://github.com/suborb/philips_android_tv), I can’t get user/pwd for authenticate, nothing happens in the TV when I execute the script.

air:philips_android_tv-master kulo4$ sudo python2.7 philips.py pair --host 192.168.66.110
Starting pairing request
/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
Traceback (most recent call last):
File “philips.py”, line 118, in
main()
File “philips.py”, line 85, in main
pair(config)
File “philips.py”, line 37, in pair
response = r.json()
File “/usr/local/lib/python2.7/site-packages/requests/models.py”, line 892, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py”, line 382, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded

Any help? Thanks!

Anybody got a Philips 2016 working ‘fine’ with HA?

1 Like

Hi guys,

many thanks to Rookeh and everybody who worked on that script!! :slightly_smiling_face:

I just needed to remove the from Crypto.Hash import SHA, HMAC import because I was not able to install the needed stuff on the hassio platform.
Anyways, I got the basic functionality on my 65PUS7601/12 working with this custom component, which means I was able to pair the TV, turn it off and to control the volume.

I would be happy about every new feature you can add to this :wink:

Hi all, I really want this component to work on my homeassistant installation… but I’m using docker on synology.
How can I install this plugin ? or when will it be available in the releases ? Does somebody know this ?

thanks!

I found a list with commands…

Standby
Back
Find
RedColour
GreenColour
YellowColour
BlueColour
Home
VolumeUp
VolumeDown
Mute
Options
Dot
Digit0
Digit1
Digit2
Digit3
Digit4
Digit5
Digit6
Digit7
Digit8
Digit9
Info
CursorUp
CursorDown
CursorLeft
CursorRight
Confirm
Next
Previous
Adjust
WatchTV
Viewmode
Teletext
Subtitle
ChannelStepUp
ChannelStepDown
Source
AmbilightOnOff
PlayPause
Pause
FastForward
Stop
Rewind
Record
Online

I want to edit the custom media player file… but have no idea how to start … somebody wants to help

I’m not able to make the pairing succesfull…
Could somebody try to specify how its done?

I saved the philips_2016.py to a new folder (custom) and in my config, i tried to call it… Not any respons or somewhere to find the possibility.

Help :upside_down_face:
TV: 49PUS6561

I got this working on my 55pus727212, i.e. got the pairing code and could then use the component in home assistant (change volume worked fine).

However, after maybe 5-10 volume adjustment tests, it suddenly stopped working and I have not been able to pair it any more (i.e. nothing happens when doing this). Tried restarting the TV etc, but nothing. Any ideas?

Nice! Please let me know if you want/need any assistance. How did you get the tv to start accepting connections again?

Nice, well … also very interessted to get this solved … so just let us know if you need any help in this matter :slight_smile :slight_smile:

I was just trying to set this up too, but was failing from a HASS point of view.
What has to go in configuration.yaml and where does the script have to be saved with what name?

Hello,
In configuration.yaml you have to put:

media_player:

  • platform: philips_2016
    name: Philips TV
    host: 192.168.xxx.xx (your TV Ip address)
    username: username (to get this, pair your TV with HomeAssistant using the python script mentioned above)
    password: password (to get this, pair your TV with HomeAssistant using the python script mentioned above)

After that, you have to copy the philips_2016.py file to:

/home/homeassistant/.homeassistant/custom_components/media_player

(if you don’t have media_player folder, create it, make sure that you are on homeassistant user if you are running Hassbian)

For my 55PUS6561/12 i have modified the philips_2016.py script to retrieve the TV state and to show the turn on button when TV is OFF, but i cannot upload because i am a new user and i am not allowed to do it. If someone is interested, please reply and i will find a way.

Thanks :slight_smile:

3 Likes

How to get the username/password from the python script??

Running the linked script from above will create / display username and password (as mentioned in the first posting, step #2).

Copy philips.py from here on your Raspberrry Pi in a folder (i did it while i was logged with homeassistant user)
Run the script
A code will appear on the TV, write it in the console
After that, username and password will be displayed in the console

I’ll do that tonight…
Do I need first to make the script executable?

No, .py extension is from a python script. Just copy the file to the raspberry pi and run the following command (make sure that before running the command you are in the same location where you put the file):

python philips.py --host 192.168.xx.xx pair

(change your ip address with your TV IP address)

You will see a 4digit code on your TV, insert it in the console and after that you should see the username and password

Awesome that people are working on it. I started on a component, but got frustrated the with the API.
It’s such a bummer that it apparently has less functionality and no documentation at all.

Starting apps is possible judging from the Android TV remote app.
GET activities/current
returns
{‘component’: {‘className’: ‘com.google.android.apps.youtube.tv.cobalt.activity.ShellActivity’, ‘packageName’: ‘com.google.android.youtube.tv’}}

POST activities/launch
That payload needs to be send to the TV.
The TV should then execute the following code:
intent.setComponent(new ComponentName(pkgName, classPathToActivity)
So exactly the same thing the get is returning.

But I get a Bad Request 400, when posting it like this.
Source: https://github.com/suborb/philips_android_tv/issues/5

Thanks @an20dei. It’s working now, but it this all it provides out of the box?

grafik

Can it be enhanced / customized somehow?

yeah its pretty limit what you can pull out with the current knowlegde of the API.
lets hope someone are skilled enough to find fix a proper working component :wink: