Changing Light Conditions when light state if off

Ok, trying my best to 100% migrate away from Tuya. Here is my next challenge…

I have a script that changes the color_temp of lights at sunrise and sunset. At sunrise, things go cool - and at sunset, they slowly change to warm.

It works fine in Tuya, if the lights are powered up or powered down… The lights do not “turn on” to change color temp, they just change in the background, and when i power them up they are correct.

I cannot seem to get this to work with Home Assistant. I’ve tried various combos, but can’t figure it out. If I use the light.turn_on service, it turns the light on. If I do a scene.apply, it will only apply it if the light is on - so, the below code only works if the light is off.

Now, I don’t want to hard-code this into the light switch - like, if after 6pm it auto turns on warm, and if before 6pm it auto turns on cold, as I want the option to change things early if needed (or if the kids are having fun with colors) and stay that way until the next cycle.

This code only works if the light state is on

slow_warm:
  alias: Slow Warm
  sequence:
  - service: scene.apply
    data_template:
      entities:
        light.office_b:
          state: "{{ states('light.office_b') }}"
          kelvin: 5000

The problem is, in HA if you turn on a light, you turn it on, you can’t change the colour temperature (or anything else) without turning it on…

What you might want though is to use adaptive lighting, which manages the colour temperature of bulbs automatically.

Your other option would be to detect the light turning on, and changing the colour temperature when that happens.

Adaptive lighting looks like it will fit the bill just fine. Thanks for the suggestion!