How to change color of light when powered on?

Hi all,
I want to change the color of my light (IKEA LED2201G8) when powered on.

my setup:

If I turn power on, the light is switched on. If I turn power off, the light is switched off. So there is no zigbee switch which turns light on and off.

My goal is to have warm-white at night and cool-white in the morning.

I was trying to create an automation, but I can’t find a suitable trigger.
I tried to use the “Light Name turned on” trigger, but this only works when the light is turned on by homeassistant - not when powering on.

Thanks for any advice in advance!

When powered on by wire, the state should go to on after a few seconds, so this trigger would be right. Just tested with a hue light, it takes about 5 seconds.
But there is another problem why it might won’t work, when powered off, it does not change its state and remains on (since without power the light cannot sends commands to Z2M and the last state remains). So the trigger will not work since the light seems to be on all times.
As a workaround you could use a light sensor (f.e. aqara ones) and trigger by the change of illuminance, but that might not be fast enough…

You won’t be able to do that, simply because powering on after power restore is just a default action that the IKEA bulb does. If it were another brand, it could keep last state.
I believe the only way to do what you want is by making the switch smart. The way I done it on the bedroom is with a Sonoff Switchman, flashed it to EspHome and disconnected the internal relay from the button(from the yaml). That way, when I press the button, it just sends an update to HA, and then with the automation it does what you programmed it to do(turn on warm/cool white. depending on time). Plus you have the relay to cut off in case you want to do something with the bulb or wiring, because it will always be on mains from now on.
Downside is, no HA, no light.

1 Like

What I am doing is triggering from “unavailable” to “on”. It can take a few seconds, but it does work for me. I am not using zigbee2mqtt, so it might be different for you.

Just had another idea, don’t know if it works with the ikea lights. You can enable the link quality sensor of the light in home assistant and trigger on that.

With my hue bulb the lqi changes when reconnecting to Z2M and the probability of beeing the same as before is very low. As said, i don’t know if the ikea ones do the same, but it would be an idea to check this out…