jomwells / ambilight-yeelight

A switch component which mimics the functionality of Ambilight+Hue for all Yeelight lights/bulbs
26 stars 8 forks source link

Suggestion: Integrate possibility for syncing the Ambilight with Philips Hue #6

Closed CM000n closed 4 years ago

CM000n commented 4 years ago

Hi everyone, I have been wondering for some time if it is possible to synchronize the Ambilight of my older Philips TV directly with Philips Hue using Home Assistant. It’s a 2013 TV, for which ahue sync app was available back then: https://www.philips.de/c-p/PTA008_00/ambilight-plus-hue-app Unfortunately the app is no longer available for iOS and is also not compatible with Android 10 😦

It seems that the app at that time retrieved the Ambilight information of the TV via its jointSPACE functionality and synchronized it with Hue. It would be cool, if you could do that, e.g. with that custom component, also via Homeassistant.

Then I would have a replacement for the no longer supported app and could integrate the start of Ambilight directly as an automation in Homeassistant

jomwells commented 4 years ago

Is Ambilight+Hue no longer available in the settings of the TV itself? This component was created to mimic the built in Hue functionality with Yeelight bulbs. I have not checked in a long time, as I don't own any Hue bulbs, but I was under the impression this functionality still existed.

When I was creating this component I also noticed the Ambilight+Hue Functionality available in the (iOS) Philips TV remote app.

If none of these options work any more, I would guess it to be pretty trivial to release a copy of this component to forward the colour information to Hue bulbs, given there is an available Hue python package, which I suppose there must be for Home Assistant to have a native Hue component. Please let me know :)

CM000n commented 4 years ago

My TV ist from 2013 (37PFL6007k) and never had any Option in the settings for syncing the ambilight with Hue ;-) Also the Philips remote TV App you mentioned doesn't seem to be compatible with my TV.

The only way was the above mentioned philips ambilight+Hue app which seems to be deprecated :-( So I hoped that I can do it somehow with this component via Homeassistent.

Thanks for your clarifications and suggests

jomwells commented 4 years ago

Ahh I see! Does my ambilight component work with your TV?

CM000n commented 4 years ago

Unfortunately no :-( I have replaced the BASE_URL in the code with the one for older TV devices. But, the Ambilight light is still shown as unavailable in Homeassistant. For now I have no idea what to adapt to _getReq () and _postReq (). Maybe I have to look here to see if I can find JointSpace documentations for older Philips TVs.

CM000n commented 4 years ago

Edit: But it seems as if the TV reacts at least to some of the JointSpace commands documented here: 56464536546t

5646453654345436t

Commands that doesn't seem to work are:

jomwells commented 4 years ago

Interesting, well without the /currentconfiguration functionality etc I can see why the Ambilight light component doesn't work, however you seem to be In luck. The ability to use the /ambilight/measured (and maybe /processed?) means that building a fairly simple python loop to bind your hue bulbs to the pixel values of the tv is definitely possible. I'm sure there will be other things to consider, such as the allowed rate of commands to the hue bulbs (I bypass this in Yeelight by activating a "Music Mode").

Do you have much experience in python? I will happily help you in any way I can to put it together, please feel free to steal as much code as you can from this repository 😆 however I won't be able to contribute much myself for the next couple of weeks until I am back home with all of my stuff

CM000n commented 4 years ago

Yes, the /ambilight/processed GET Request also works.

Unfortunately, I have little to no experience with Python and programming in general :-( But it almost looks like I'll have to deal with it a little if I want to use the Ambilight function of my TV with my Hue lights in the future :-D

jomwells commented 4 years ago

My advice would be to start by just writing a python script and run it locally on your computer, something which takes the IP of the TV (along with any username and password it needs) to receive the data from /ambilight/measured or processed, getting those numbers into an array (see the follow_TV function in this repo). Then research how hue bulbs can be addressed/sent instructions via python, someone will have already written that as a package I'm sure. Create a loop which constantly receives the pixel values from the TV and forwards the commands to the hue bulbs (potentially with a fade transition if available with the hue package to reduce flickering).

This is how I started when building This component. If you manage to get a working script on your local machine, it's just a matter of copying and pasting the code into the appropriate places (along with some other required code) to turn the script into a home assistant component. Good luck!!

CM000n commented 3 years ago

Hello @jomwells first of all, and most importantly, many greetings. I hope you doing well in these strange times.

Secondly, I want to inform you that I tried to put something together over christmas holidays. It's largely based on your code, which I've adapted for my needs and reduced in parts. If you're interested, you can find the result here: https://github.com/CM000n/ha-ambilight-hue

Basically it seems to work :-) Unfortunately, the lamps seem to react too slowly when they are controlled directly via Home Assistant. :-/ And strangely enough, the switch can't be switched off once it's been switched on :-D I don't know what's wrong with that. I haven't really found a good way to debug it yet.

Many Greetings Simon