Simulate sunset on a lamp (sleep routine)

I thought I would easily find this, but I couldn’t. Perhaps just not looking well enough. So feel free to send me to the right topic or website where it can be found.

When my kids go to sleep I want their lights to slowly dim (easy!), but also do a color change to simulate sundown/sunset. So going from a more lighter and brighter color temperature to a warmer one. As if the sun is setting. I used to use Philips Hue automations for this (or Google Home) who have this build in (asking google to dim lights slowly will also cause the temp change). I however want to do this using Home Assistant and Node Red.

Like I said, dimming lights slowly over time is pretty easy. But I’ve not really been able to find any examples where I can also at the time set the color-temp and even the color (the lights can do both) and slowly fade from one color to another.

Added bonus would be if it stores the original state of the color/temp and restores this after the routine has run, without turning the light back on. So that when the lights are turned back on the next day they are not in a ‘sundown state’ but the state they where in before. As my kids like to shuffle their lights themselves there is no default to return to. Storing the state just before would be prefered.

With Philips Hue bulbs you can set the colour with the turn_on service, it shows you the option in the notes for the service node in Node Red. Then it is just a matter of setting the start and end point and adjusting across that on a regular basis. I use Kelvin for mine (I actually adjust against a range based on sun position, but you can make it simpler than that).