Change Light Color without light.turn_on

I’m trying to create an automation that will only change the color/temperature of a bulb, not power on the bulb. I can only seem to find examples of this automation by either using light.toggle, or light.turn_on.

Case example:
My wife turns off her lamp before my automation to change the color of the lights runs. I still would like my lamp to change color with that automation, without the automation turning her lamp back on. Do I just have to create multiple automations to cover all grounds here, or is there a Change Color action that I’m missing?

Thanks.

The ability to change the color of a light, while the light is off, is not supported by all lighting technologies.

For example, LIFX bulbs support it and the LIFX integration provides its own service call to do it.

If whatever light integration you are using doesn’t have a similar service call then you’re limited to using the light.turn_on service.

1 Like

Yes I totally understand that. I have an automation involving TWO lights. At 11pm, they dim and turn to a very warm temperature. Sometimes, my wife goes to bed before that, and turns her light off using a button that controls both lights. I have stipulated in my automation, that if her light is off, don’t run the automation, because it powers it BACK ON in order to change the color of the bulb…while she is trying to sleep.
I would like the automation to still run, even though her light is turned off. Except I don’t want her light turned back on. SO, that’s where I get to the change color part.

But these are not LIFX bulbs, so it looks as though I’ll have to work around it all. Thanks for your help.

I’ve just recently found this topic when trying achieve more or less same functionality.

I’ve solved it like this:

  • created 4 numerical helpers in Settings / Devices & Services / Helpers TAB then + CREATE HELPER
  • named them lamp_brightness, lamp_r, lamp_g, lamp_b
  • for the automation which switches the bulb on I’ve used
service: light.turn_on
data:
  rgb_color:
    - "{{ states('input_number.lamp_r')|int(0) }}"
    - "{{ states('input_number.lamp_g')|int(0) }}"
    - "{{ states('input_number.lamp_b')|int(0) }}"
  brightness_pct: "{{ states('input_number.lamp_brightness')|int(0) }}"
target:
  device_id: <<your-device-id-here>>

Then you are free to create as much automations based on the time of the day for example which just update the values of those helpers
This way when your light turns on it has the color you would like to.

6 Likes

The original goal was to set the light’s color without turning it on. What you posted doesn’t achieve it because it sets the light’s color when turned on.

Not exactly
Please read carefully.
You can have an automation which updates the values of those helpers - setting the color of the light for the later moment when the light is actually turned on

Those 2 automations are independent the one which sets the color can do it when the light is turned off.
Imagine the value of the helpers as global variables holding the color for the turn on event.

He doesn’t want to set the light’s colors “when the light is turned on”. He wants to set the light’s colors while they’re off.

Many color bulbs turn on with their previous colors moments before the new colors are applied by the light.turn_on service call. Jmo2610 wanted to eliminate this momentary color-change by setting the light’s colors before it’s actually turned on. LIFX is one of the few bulbs that can do that.

I think this is just a misunderstanding. My solution is what he needs.

strictly seen - setting the color when the light is off is impossible. The turned off light has no color. Right?

What he wants is set a color when the light is off and keep the light off. Once at later moment the light turns on it should have the color which was set. Right?

And exactly my solution does this.

Automation A - updates the helper values (does not switch the light on, just updates the values). It can be triggered by time of the day or whatsoever.

Automation B (shown in my original post) switches the light on when it’s required - but uses the color from the helpers.

This way you have set the color (with AutomationA) during the light was off

It’s not impossible. As explained, more than once, the LIFX integration is able to do that.

What it effectively does is ‘preset’ the desired colors so that when the light is turned on it instantly displays the desired colors. There’s no momentary transition from the light’s previous colors to the desired ones.

Home Assistant’s light.turn_on service call doesn’t support this because the majority of lighting technology doesn’t support it. Except LIFX; the LIFX integration provides a special service call named lifx.set_state (able to set a light’s parameters without actually turning it on).

Fine LIFX can do that without any trick.

My solution achieves the same for non LIFX lights
When my automation turns on the light it comes straight with the color set earlier (when the light was off) without any momentary transition.
Slightly more complicated (you need 2 automations) but works exactly same

1 Like

The fact you made that statement proves you don’t understand what lifx.set_state can do that light.turn_on cannot do.

You literally don’t understand how the two service calls differ.

Hi

I really like this discussion please don’t be offended (hope you are not)

just to use proper terms

LIFX as you described (I have no experience with that)

  1. light is off - it has no color (how can a switched of light have color?)
  2. you run the command which sets the color (light is still off) so no change in color (how can a switched of light have color?)
  3. at later moment when light turns on it has the color which was set at step 2). So strictly seen with the LIFX you can set a color which the light will have when turned on next time.

How it works internally I don’t know - but from the user’s perspective it sets the color when the light is off for the later moment when the light is switched on

Same a my example.
Or please correct me when the statement in bold is not true.

The questions you just asked have all been answered. Re-read what has already been posted.

Actually there is no question

What I say is that with some tricks in automation you can achieve the same as with LIFX light i.e. setting the color when the light is off.

You keep telling me that my example does not work.

  • 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).

Hello,

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.

1 Like

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)?