I am using Google Home and Home Assistant to control some white and color Yeelight bulbs. The power on/off and brightness setup features are working, but i cant change the color of the bulbs by voice. Do you think it will be possible to implement that feature?
Thanks!
This would be a wonderful addition. I think it should certainly be possible to do. Right now, emulated hue gives everything as a âDimmable lightâ. It should be entirely possible to provide, instead, âExtended Color Lightâ, but then we would have to build in the RGB aspects to the code. Itâd be interesting if those who put together emulated hue could give their thoughts on this.
The change from âDimmable lightâ to âExtended Color Lightâ is very simple and already did this in the emulated_hue.py. Now Google Home detects my lights as colored ones, but thatâs it for the momment⌠no color changeâŚ
Yeah, weâd have to build out the infrastructure to send/catch the colors of the lights, which I think might require identifying whether the component is in fact a light with RGB capabilities.
I have done some research with ha-bridge and it seems that when I am asking to Google Home to change the color, it gives the XY values of that color.
Before changing the color:
"2":{"state":{"on":true,"bri":254,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Extended color light","name":"Color Light","modelid":"LCT001","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:02-02","swversion":"5.23.1.13452"}}
After changing the color to Green:
"2":{"state":{"on":true,"bri":254,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true,"xy":[0.7006062269210815,0.29930099844932556]},"type":"Extended color light","name":"Color Light","modelid":"LCT001","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:02-02","swversion":"5.23.1.13452"}
Interesting. I know that we can provide an XY value in the turn_on service, but I donât think itâs particularly well-implemented, especially in non-hue components. I wonder if thereâs a formula out there to convert XY to RGB.
Philips hue provides one, Iâm assuming this value is using Gamut B since thatâs what they use for their bulbs. They provide the objective C to convert it, Iâm currently working on turning it into Python. Then, we could throw that into the package for an individual component to do a quick and dirty conversion when no RGB value is sent but an XY value is.
That part is definitely within my capabilities but itâs a hacky solution, the most efficient solution is probably to use the emulated_hue component which I have limited experience with. I think it would be more efficient to have emulated_hue offer both the xy and rgb values, then the individual lights could choose which to handle; this wouldnât require any additional changes to the individual lights.
I wonder if @balloob, @jeremydk or @hoopty could comment here, since github has them as the suggested reviewers for emulated_hue.
I put together a basic function which does the conversion as per Phillips Hueâs formula. Itâs a little hacky, since weâre ignoring the limits Phillips puts on their bulbâs XY input (which in their case serve to prevent the bulb from displaying an impossible color, something weâre not concerned about here).I donât know if the edge cases can even occur in Emulated_Hue, since the sender (Google Home/Alexa) might force any colors to live within the color range.
Nice, I hope you guys get it working. I noticed this this past weekend when I was setting up my emulated hue. For me though, I have the physical hue bridge as well so I just use both and donât include lights on my emulated hue.
This well definitely be useful for lights that arenât hue lights though
FYI, this is currently in development (by someone other than I); Iâve done some testing and it works perfectly. I donât know if it will be ready for the next release, but it will definitely be showing up at some point.
Thatâs very good news!!
Please let me know if you need help with anything. Iâm happy to help!
So you can tell google home to change the color of lights thru emulated hue?
Yes, like I said itâs still in development and I donât know when the dev will be finished with it, but youâll be able to say 'hey google, turn (light name) (color).
Bumping this⌠Canât find anymore info and this⌠Would love to have it.
or if you ever get some time maybe you can tell us how you got this working @dramamoose, or tell us who is developing this so I can check out their work or something
So the pull request is right here. Looks like the dev has temporarily paused working on it. Iâll follow up and see if I can help out with anything to get it finished up.
Thanks ill go check it out
@dramamoose I have made some test with my Yeelight bulbs and it is working perfectly! It will be available in the next update?
I also am using it now, works well with my hue lights. Props to the dev
Canât guarantee anything since Iâm not the dev, but I know heâs looking to work on it this week.
Also tried the code. Works well to get the colours. Canât get it back to white though⌠tried white, warm white, cool white. Using them with limitless Led bulbs⌠Any other ideas?