Have a look at this:
Adaptive Lighting Custom Component that automatically adapts the brightness and color of your lights based on the sun’s temperature but stops when you manually make a change - Share your Projects! / Custom Components - Home Assistant Community (home-assistant.io)