Except you’re not setting the light’s color when it’s off.
You’re setting a helper to the desired color while the light is off.
The helper’s value isn’t applied to the light until it’s turned on.
When the light is turned on (light.turn_on) it momentarily uses its previous color before employing the helper’s value.
That’s not how lifx.set_state works. It literally sets the light’s color while the light is off. So when it’s turned on it will instantly use the color that was set while it was off. There’s no momentary transition from a previous color to a new color.
You can’t simulate this behavior because it relies on the physical light’s firmware to support it (and LIFX supports it).
I did some experiments - and yes as you say there is a really short ( ~ 0.2 sec ) moment with the previous value and then light changes it’s colour/brightness to the value set with the helpers earlier (when it was off)
I admit this is not 100% same as with LIFX - but maybe could be sufficient for the person who asked the original question.
Since I now own 20 or so Cync lightbulbs and don’t wish to spend money on a bunch of lifx bulbs, your solution seems like the closest one can get. Thanks!
@gat_hoborth do you know if your solution works when turning a light on using a light switch? I.e., if I turn the light switch off, run an automation to set the color, will that color apply the next time I turn on the light switch?
I have several different generic brands of tuya smart bulbs which are set up in the smart life app and linked to the Google home app (as well as integrated into home assistant w/ tuya integration).
The Google home app/ Google assistant is able to change the color of all these lights while they are off. I can ask the voice assistant to change the color or set up a routine in the Google home app to change it at a certain time, the light remains completely off when changing the color and when I next turn it on (by voice, smart life app, or home assistant) it comes on the color I previously asked for, no brief transition from one color to what I asked for, it’s just already the color I asked for, and it works for every bulb.
So it seems it’s not a limitation of the bulbs themselves… Is there still really no way to make home assistant do this?
Are you detecting that brief transition when you use Home Assistant’s light.turn_on service call? In your estimation, how long is the transition (in milliseconds)?
I’m hoping for a home assistant solution to this as well, but if you don’t mind downloading yet another smart home app, you could try linking your cync app to the Google home app and set up routines in Google home to set the color only (without turning on the light). Then no matter how you turn it on after the routine has run the light will be the right color. At least that’s how it works with my tuya/smart life lights.
I usually use a battery powered zigbee switch with an automation that uses light.toggle or I ask the voice assistant to turn on the light, but regardless there is no transition.
I also use the adaptive lighting integration during the day, and that always has a very brief but noticable transition from the last color it was on to what adaptive lighting tells it to be after I turn the light on, but at night I turn off adaptive lighting and have Google home set the lights to orange at 8pm, regardless of whether or not the lights are on, and when I turn them on (by any method) after 8pm they are orange, there is no transition.
I can also just ask the assistant to turn an off light to like purple or something, and then turn on the light and it’s already purple, there is definitely no transition (unless adaptive lighting is on, then it quickly transitions from purple to an appropriate shade of white)
Yep, “set bedroom light to green” or “turn the bedroom light green” or some variation of that, then the speaker will do the little ping that means the command was successful, the light has remained off that whole time, no flashing it anything, and then when I ask it to turn on the light or use the switch it comes on green.
I’ll include a screenshot of the routine too…
I had the Google home app night-time color change routines set up well before I set up home assistant though, that’s why I was so confused when I went to set up those automations in home assistant so I could delete the Google home app, the only info I can find says it’s a limitation of the bulbs that they can’t be changed while off, but I’ve been doing it with the Google home app this whole time…
The thing is I don’t know how Google Assistant is interacting with your lights via Tuya. In other words, what specific API calls is it making when it controls the light? Perhaps Tuya’s API offers the ability to control lighting parameters while the light isn’t illuminated. Would you happen to know?
Home Assistant’s implementation of Tuya’s API calls is what it is (i.e. it may or may not have implemented the entire API). I believe the closest you can get to “no visible color transition” is via the Tuya integration’s support for Scenes. Create a scene in the app, it’ll appear in Home Assistant, call the scene and whatever lighting parameters you set will be activated immediately.
No, I’m sorry, my technical knowledge of this stuff is pretty non-existent… all I know is the smart life app is just one of the like 1000 apps it allows you to link to in the Google home app…
The reason I have it set up in the Google home app is because I could never get color change automations to work in the smart life app, and looking at it now there’s no direct way to change the color without turning on the light in the smart life app, but you can make an automation in the smart life app to change the brightness of a light while it’s off and that works well.
You think a change in the ability of home assistant to make changes to these lights while off would have to come from the tuya integration though? I could try barking up that tree lol
Also, you have the patience of a saint to deal with 123 . You’ve given something that is 99% identical to a user as the lifx.set_state functionality and all their responses are pedantic and dismissive.
In my case, it’s actually 100% identical from a user perspective as I don’t have any perceptible change when I turn on the lights
my zigbee lights connected through zigbee2mqtt support changing color by sending a message to mqtt topic.
Unfortunately home assistant does not seem to be able to generate this message, however you can send it through mqtt push service directly. Here is my working example:
I use this based on time of day. If the light is on it changes to the new scene at that specified time. If the light is off at that time it will use the new scene as soon as it is turned on.
Works perfectly and you don’t get the slight delay in colour change that the “light.turn_on” trigger has. Added beneift of being able to use animated lighting effects. Down side is you have to use the Tuya app to configure the scenes.
It has allowed me to move my time of day colour routines from Google Home back to Assistant.
What do you mean with scene? The built-in scenes for the lamp of the tap to run automation scenes? The scenes also work with normal Tuya. But I want to configure everything within HA, HA has more options (like colors) and you can combine scenes with non-tuya stuff. Also I want to migrate to Zigbee through SkyConnect.
My solution is to use adaptive lightning to lower the color/brigtness over the day. And in the evening just run the scene when I need it. Blacky Sensor Light is also pretty good.
Still adjusting brightness without changing the light would be so much better. All these smart scripts, only works when the lamp is on. Always causing flashing or giving issues.
yeah sadly adaptive lighting doesnt support setting the color on lights that are off either. really wish HA would just support this natively without requiring a different service call.
I get around this by having the automation that makes the button turn the light off set it to dim red first. Now it comes on dim red first, which doesn’t wake anyone up. The light on button automation sets it back to white.
I’m planning to enhance further to allow me to turn on and off the light with google, by doing this.
Setup a dummy light as mentioned earlier with the colour, brightness and on/off info.
Link all controls and automations to that dummy one.
Add an automation that controls the real light when the dummy one is turned off but make it first set the colour to deep red and the brightness as low as possible, then turn off.
Setup an automation to turn on and set the colour of the real one to match the dummy one if the dummy one is on, otherwise ignore colour changes.
It’s not perfect, but it works well enough for me.