Setting color temperature only works sometimes ikea trådfri?

I have Ikea Trådfri bulbs together with a deconz II stick. Recently, I changed my automation to also set the color temperatures in some rooms. During daytime, I want cooler and brighter light and during evening/night I want warmer and more dim light.

This is triggered first during the day:

  - type: turn_on
    device_id: e32f6e263b8f689bf451eee3ce56382d
    entity_id: light.ikea_e14_4
    domain: light
    brightness_pct: 50
    enabled: true

  - action: light.turn_on
    metadata: {}
    data:
      transition: 10
      kelvin: 3562
      brightness_pct: 50
    target:
      device_id:
        - e32f6e263b8f689bf451eee3ce56382d

This sometimes work, but not always. If I run it explicity with the Run now button, it does indeed work. As you can see, I also have to use the type:turn_on first before setting the temp, otherwise the brightness will not be set. Not sure why.

Similarly, in the evening, this is run:

  - type: turn_on
    device_id: e32f6e263b8f689bf451eee3ce56382d
    entity_id: d9a130617e0cc681b506ff6d3242bdfb
    domain: light
    brightness_pct: 20
    enabled: true
  - action: light.turn_on
    metadata: {}
    data:
      kelvin: 2000
      brightness_pct: 20
      transition: 180
    target:
      device_id: e32f6e263b8f689bf451eee3ce56382d

Same as before, I have to set the turn on first to set the brightness. Setting the color temp sometimes works but not always.

What am I doing wrong here? I have checked the traces and they do not show anything going wrong as far as I can see.

This is probably the known issue of IKEA bulbs not being able to change brightness and color simultaneously via zha. I seem to have a similar setup and am using the workaround of first instantly turning on with my desired color, but to 1% brightness, followed by smoothly transitioning to desired brightness. If the bulb is already on I smoothly transition both…
If your lamps are always powered, it is possible to set both values while they’re off with zigbee cluster commands. It’s a bit hacky, but so far I’m liking the effect of it.

I see. I do not necessarily need the transistion though, the important part is the color and brightness level.

So perhaps having two Turn on actions, one for brightness and one for color might be a fix? :slight_smile: Like this?

Yes, you might have to add a small delay in between.

1 Like

Been testing this for a few days now, seems to be working!

1 Like