Philips Android TV component

reload the core

if using hassio folder in config/custom_components/philipstv_2016.py

1 Like

Hi,

No, I haven’t had the time to “play” with this.
But I would be really interested in doing it in the near future.

I want to learn a lot about Home Assistant and Hass.io and get it really useful.
For now, it is working almost out-of-the box, as I only know how to do a limited amount of things (basically what is in the instructions of the Help).

Those menus for the TV and Ambilight above, the dashboards, the tabs (I know these are explained somewhere in the Help), I want to learn a lot. I love these thongs, although my programming does not go further than VBA :joy: In there I’m really confortable.:sunglasses:

Would you be able to help out?
I hope you can and I’m getting excited I’ll finally get this to work.

Thanks for great work. I can confirm that your script is working on my philips 2014. Is there any API or script to change a tv channels?

Why I get white screen with text: Forbidden, when I open tv IP address?

import hmac
from hashlib import sha256

def create_signature(secret_key, to_sign):
sign = hmac.new(secret_key, to_sign, sha256)
return str(b64encode(sign.hexdigest().encode()))

just change these things if you like me dont want to download visual studio things on windows,
use hmac and hashlib instead of Crypto.

Thank you very much for the great work. I can confirm it works on my new philips 9002 oled. I fisrt thought it wouldnt be possible then i discovered this thread and got reliable tv status control. Thank you

Hi everyone. :slight_smile:

I’m new here and don’t understand about api’s and stuff. The reason I came here is because I googled how to install jointspace on my Philips TV. (55PUS7181/12)

I have a Samsung Galaxy Note 8 and installed the Philips New Ambilight + Hue app on it. But it gives me a message saying ‘something went wrong’. I uploaded a screenshot, hopefully you can see it below.

My TV needs to be enabled with jointspace and I have no idea how to do it.

If anyone can help I’d really appreciate it.

Many thanks in advance. :slight_smile:

Hi.

I don’t think the app is working on the new tv’s from philips, because on my 9002 oled it also say it doesn’t find the tv. But you can go in the menu and find ambilight+hue and pair the hue bridge and it’s working just fine. I read about the jointspace api on forums, but it seems that you cannot enable it because it’s already enabled.

I hope i’m right. If somebody knows more, feel free to answer.

1 Like

For anyone interested, I have successfully set up an automation which sets the Ambilights of a 2016+ Philips Android TV to follow (copy) the colour of another light from Home Assistant, say you have RGB LED strips around the room, and want the TV ambilights, at certain times, to automatically match the colour of the target lights.
Things to note:

  • This method uses Hue and Saturation to set the colour of the ambilights, so the ‘hs_color’ attribute of the light component is used to update the parameters, this may be labelled differently for your lights
  • The scaling of the Hue and Saturation within home assistant will probably be different to the scale used within the Phillips API, and thus, a scaling factor is needed

Through experimenting with the Jointspace API, I could set all the Ambilight LED’s to one colour via the terminal command:

shell_command:
name_of_shell_command:
curl -X POST --digest --insecure -u XXXXX https://192.168.X.XXX(TVs_local_IP):1926/6/ambilight/currentconfiguration -d ‘{“styleName”:“FOLLOW_COLOR”,“isExpert”:true,“algorithm”:“MANUAL_HUE”,“colorSettings”:{“color”:{“hue”:{{ ((state_attr(‘light.[enitity_id of target light]’, ‘hs_color’)[0]) * ([Scaling Factor]) |int }},“saturation”:{{ ((state_attr(‘light.[enitity_id of target light]’, ‘hs_color’)[1]) ([Scaling Factor])) |int }},“brightness”:{{ state_attr(‘light.[enitity_id of target light]’, ‘brightness’) |int }}},“colorDelta”:{“hue”:0,“saturation”:0,“brightness”:0},“speed”:255}}’

As this is very messy, I will give an example:

  • The IP of the TV being 192.168.1.101
  • The entity_id of the light I want the tv to copy is light.bedroom_light
  • The scaling of the HS(&B) values within home assistant are:
    Hue:(0-360)
    Saturation:(0-100),
    Brightness:(0-255)
  • The scaling of the HS(&B) values for the Philips TV (yours will most likely be the same) are:
    Hue:(0-255),
    Saturation:(0-255),
    Brightness:(0-255)

The following shell_command will be added to config.yaml:

curl -X POST --digest --insecure -u XXXXXXXXXXXX https://192.168.1.101:1926/6/ambilight/currentconfiguration -d '{“styleName”:“FOLLOW_COLOR”,“isExpert”:true,“algorithm”:“MANUAL_HUE”,“colorSettings”:{“color”:{“hue”:{{ ((state_attr('light.bedroom_light, ‘hs_color’)[0]) * (255/360)) |int }},“saturation”:{{ ((state_attr('light.bedroom_light, ‘hs_color’)[1]) * (255/100)) |int }},“brightness”:{{ state_attr(‘light.bedroom_light, ‘brightness’) |int }}},“colorDelta”:{“hue”:0,“saturation”:0,“brightness”:0},“speed”:255}}’

Then, an automation can be created to run the shell command any time the state of the target light is changed, thus keeping the ambilights in sync:

– alias: Follow Room Colour
trigger:
– entity_id: light.bedroom_light
platform: state
condition:
– condition: state
entity_id: switch.ambilight
state: ‘on’
action:
– service: shell_command.set_ambilights_to_strips

This automation can be turned on and off, to allow the ambilights to continue following video or audio if this function is not needed. I did look into expanding this into a fully functional RGB light from within Home Assistant, but could not find any shell_command light component that would work (although there seems to be an MQTT light component which may be similar), if anyone knows of a more elegant solution to this I would love to hear it, otherwise, this is a very nice way of tying in your TV to your current RGB lights, controlled by Home Assistant

3 Likes

Thank you for your job! Really nice feature!
Do you know if it would be possible to do it reversed, i.e. get the current colour of the TV ambilight and match a colour of any RGB lamp via automation?

Unfortunately not at the moment, as this is automation based, and simply sends a command to match the target light when it is changed, I am starting to look at creating a light component for the ambilights separately, which would be much better, as it would work both ways as you say, and the ambilights could then be controlled by any automation or integration such as alexa, google home and siri etc, I have never written a component so I cant promise anything, but ill be sure to post it here if I get anywhere :slight_smile:

1 Like

First of all good job!
Guys python absolute newbie here but learning.
Is there a way to add the channels list to this? For the 2016 Philips tv’s the channel list is found with https://tvip:1926/6/channeldb/tv/channelLists/all

I’ve been trying to use the current component from here but cannot understand the code nor how the list can be obtained.
Tried similarly to the current channel function but with no success.

I really want to learn. Anyone please?
Thank you

Guys,

I managed to hack my way to what I wanted. Now Channel list is available e you can choose your tv channel in the source list.

Here is the file philips_2016_b.xml (8.6 KB)
Just change .xml to .py

Lots of doubts in my mind still as I cannot understand much of the how to build a component, specially from ground up.

3 Likes

Guys,

here follows the work in progress regarding this TV.

My model is 32PFS6402/12.

Here is the file philips_2016_b1.xml (10.0 KB)
Just change .xml to .py
Now the component can differentiate between watching TV and using an android APP.
When watching TV, forward and rewind buttons change the channel.
Channel title includes program number.
When using an APP, the name of the app appears in the media title.
Some warnings that appeared in the logs about volume error don’t appear anymore.
Cannot find a way to change from TV to APP. Tried several ways to POST but with no luck.
To change from APP to TV simply choose a channel in the source list.

3 Likes

Great work :smiley: Love it.
It would be great to filter channels list with favorites “channeldb/tv/favoriteLists/allter” and maybe support for ambilight, but it require at least few endpoints “ambilight/power”, “ambilight/currentconfiguration” and probably something else, unfortunately I’m don’t know. I tried to do it myself but I failed :frowning:
And i have a question, do you have list with all working endpoints or do you know how to get it?

Thanks.

Don’t know them. Found a couple by trial and error. for instance post the json load for activities/tv and the channel will change but do the same logic for applications/current and no such luck.

I think that it will be something in the lines of activites/app or apps but these no luck. Having the right one with be a charm.

I found some endpoint in https://github.com/suborb/philips_android_tv/blob/master/philips.py
It is possible to find some more by Reverse Engineering Philips app from android https://play.google.com/store/apps/details?id=com.tpvision.philipstvapp
I have never done that unfortunately :frowning:

Where to find best custom component to control Philips Android TV 55PUS7303 trough HASS?

That’s the one I used also. As for reverse engineering that sounds great but way over my head now.
As for Ipt2007, presently this seems to be the best option.

Hi @boloni

If I understand correct I must rename philips_2016_b1.xml to .py. And then put file to:

path-to-my-hass-configuration/custom_components/media_player

Is this correct?

Can you please post the configuration yaml for that component?