Change color temperature and brightness in python_script

Hi,

Because most of my smart lamps can change color temperature, i created a night shift ‘python_script’ which every 10 minutes shifts the color temp based on time of day/night. I use it mostly for my IKEA Lamps that are connected via a ConBee2 stick. When i created the ‘python_script’ i just could call the light with brightness and color_temp and got a nice transition to the desired color and brightness, but since a few months, i have to call the lamps twice because it only changes one at a time. Do i do something wrong or is something changed and is this intentionally?

In my ‘python_script’ i use:

hass.services.call('light', 'turn_on', {
        'entity_id': 'light.lamp_ceiling_1',
        'brightness_pct': 10,
        'color_temp': 250,
        'transition': 2
    })

So if the state of my lamp is ‘brightness_pct’: 100, ‘color_temp’: 350 the first time i call it, it will change the temp to 250 and after the second call the brightness is changed.

Does anyone has any idea how to fix this?

Regards,
Ferdinand

Are you executing this for each light separately? And how many lights do you control at the same time with this script?
If you execute the same service from Developer Tools -> Services do you see the same behaviour?

Hi,

Thanks for your reply.

I use the script in 2 modes, loop through a list of 15 lamps, check if they are on and if so change the settings but not all lamps support temp or are RGB. The script is triggered if you turn one of those lamps on too. But i think that does not matter because it really works fast and because if i test this in isolation i have the same behavior.

If i replay this in the services section i got the same result, only in noticed that if i remove the transition it works in 1 call direct. Tried that in the script without the transition, same result. So the transition seems to be the problem. (But a smooth transition looks much better …)

Regards,
Ferdinand