Tradfri light colour temp at sinrise sunset

I have been trying for some time now to get my lights to change colour temp at sunrise and sunset via automation. I would like this to house-wide so every bulb does it.

IKEA tradfri will not change colour unless the bulb is switched on. So my idea was to call a script from an automation that’s triggered at sunset and sunrise. Problem with that is if the bulb is already on it changes the brightness to whatever I set the script to, this I don’t want. So need to separate the on from the off and turn on and change the brightness of the bulb is off, change the colour and turn it back off again and have a separate scrip that handles the bulbs that are on as I want the brightness to remain the same and only change the colour and obviously stay on. I cant just turn all on and change the colour as it’s my understanding that they all go off or none go off after the colour change.

I thought I had it when I came across this:
found this

and using a light.group, the problem now is if one single light in the group is on it doesn’t work as the group is on. using the syntax in this link I have managed to get the result I was after but only for one bulb the second I try and make it for more it doesn’t like it and throws errors no matter what I do or change.

it’s driving me mad and ask for your help as a last resort. as can’t seem to sort it out for my self.

looking for a scrip that says if bulb in a group of even just multiple light entities is off, do this and if on do this.

I don’t mind having two scrips

1 Like

Hello there, I was also trying to set night light behaviour - when lights are switched on the brightness and temp should come up based on time/sun. This would always come to issues as the IKEA bulbs have this problem accepting colour and temp at the same time, and lights turning on only to change parameters is not smart at all. I now however seem to have found a solution to this issue using deconz scenes. having two scenes set up and calling one of them in HASS based on time of day or any other condition upon pressing switch button seem to do the trick. it seems like deconz scenes get stored into bulbs and activating scene when button is pressed makes the lights go into exact right settings.

Please could you let me know if it’s working for you as well? Thank you.