Help Needed: Dynamic Kelvin Adjustment Automation Not Working

Hi everyone,

I’m new to Home Assistant and currently setting up my automation. I’ve been able to get a static kelvin value change to work with my IKEA TRÅDFRI bulb, but I’m struggling to get the dynamic kelvin adjustment to function correctly. Here’s the relevant part of my automation code:

yaml

Copy code

- conditions:
    - condition: device
      type: is_on
      device_id: ff40cefbe113130e9bc441d03c74b553
      entity_id: light.d7930e7f1e89c0d8d48d87ac862d2c79
      domain: light
    - condition: trigger
      id: 2 double
  sequence:
    - service: light.turn_on
      target:
        device_id: ff40cefbe113130e9bc441d03c74b553
      data:
        transition: 1
        kelvin: >-
          {{ [state_attr('light.d7930e7f1e89c0d8d48d87ac862d2c79', 'color_temp_kelvin') + 500, 4000] | min }}
mode: restart

While this works with a static kelvin value (e.g., kelvin: 4731), it doesn’t seem to work dynamically. I’m unsure if the issue is that the current temperature isn’t being retrieved or if there’s another problem.

I’m only a day into trying to set up Home Assistant, so I’m on a learning curve. Any guidance on how to troubleshoot this issue or insight into why this code isn’t working would be greatly appreciated!

Thank you!

When the light is off this value will be null. You will need to specify a default.

Also what is the minimum Kelvin color temperature specification for your light?

thanks very much!

I got this working now-

I took out the [ bracket there too- don’t know if that fixed it, but made that change too.

Appreciate your reply :slight_smile: