Newbie daft question, setting the warmth of a light

hi all

ok, i’m a newbie to all of this… and hope someone can help me…

i have an ikea tradfri bulb capable of changing the temp of the light from warm white to cool white, i have my alexa setting the temp to cool white when it switches on the light , however if i use the dimmer switch i want the light to be warm white.

edit: i should probably add that i want to be able to control the brightness of the light with the dimmer switch without affecting the temp if the light is alrasy on… setting it to be warm between certain times is ok… if thats easier…

i have spent a week looking through posts, searching and getting more and more confused… and what ive found out is that i have no idea what i am doing and no idea what to search for to find out.

can anyone out there help me please?

thank you in advance…

I’m also a Home Assistant newbie (so take what I’m about to offer with a grain of salt) and I’d say you’d need to use a Template Light.

It has set_action which lets you define an action to perform (namely a script) when brightness is adjusted. That’s where your script would tweak the light’s color temperature.

EDIT
Since posting this, I think you’ve modified your first post and simplified the requirements. In addition, your requirements in the post below are different. Therefore my response might no longer be applicable.

Thanks for your reply…

If that’s what I need to do them I’m totally lost… That’s way over my head…

I thought that since in the automation.Yaml you can set the brightness with something like

  • id: ‘1542575024069’
    alias: turn on lounge lamps 45mins before sunset
    trigger:
    • event: sunset
      offset: -00:45:00
      platform: sun
      condition:
    • after: sunrise
      before: sunset
      condition: sun
      action:
    • service: switch.turn_on
      entity_id:
      • switch.corner_lamp
        data:
        brightness: 250

I’d there a similar way to change the colour from cool white to warm white. I can do it in the front end card that pops up for the light via the slider when the light is on but can it be set when the light is off so that the next time it is on the colour changes? Or it changes the moment its turned on if it’s passed a certain time?