Emulated_hue and Google Home - change the colors of the lights

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!

2 Likes

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.

1 Like

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… :slight_smile:

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.

1 Like

That’s very good news!! :slight_smile:
Please let me know if you need help with anything. I’m happy to help! :slight_smile:

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?