🌞 Automatic circadian lighting - match your lights' color temperature to the sun!

What this does

It gives you cool lights during the day that get gradually warmer around sunset and overnight. The changes are so slow you are unlikely to notice them whilst they are happening. This may even help your circadian rhythm and sleep!

This blueprint updates the color temperature of your lights to match the outside color temperature calculated from the elevation of the sun. See the discussion here on how this calculation came about.
To ensure lights stay in sync it updates lights when they turn on, whenever the sun elevation changes and every 5 minutes.

Requirements

  1. A working sun.sun entity, read the docs. This comes auto-configured on most Home Assistant installations so it is probably there unless you’ve disabled it.
  2. At least one bulb that reports color_temp amongst its attributes.supported_color_modes

Notes

  1. On the bulbs I tested it on (IKEA Tradfri via ZHA) telling the bulb to change color temperature as it turns on would stop it coming on at full brightness, as such a separate action to restore the brightness is called after setting the color temperature. I have exposed this for editing in-case it interferes with any other of your automations, e.g I make my brightness come on low overnight and 100% in the morning.
  2. You have to select every light you want to target - it is monotonous but you will only have to do it once.
  3. Be careful about including light groups. If you do, when you turn on 1 light in the group, every light in the group will be turned on because the automation has to call light.turn_on at the group to change its color temperature - for light fixtures with multiple bulbs this may be a feature, for multiple lights + lamps in a room it will be a bug.
  4. Max and min color temp: There is probably no harm in taking the slider to the extremes. I assume most bulbs will just change to their maximum/minimum if they get a request to change to a color temp that is out of range. However if you have different lights with different min and max then you might want to set these to the most restrictive lights so that your lights look the same.
  5. You can see which bulbs support color temp by going to developer tools > states > type "color_temp" into filter attributes. This will probably also show you the max and minimum supported color temp.
  6. If you live at extremes of latitude (e.g Iceland) where the sun elevation never gets very high you may find the the bulbs never get β€˜cool’ if this is annoying let me know and maybe we can find a way to normalise the values.

2022.10 or later
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Example graph of how the color temperature varies over the day.

image

Change log

2022-10-08 Version 1.1, ensure transition time is 0 for single light turn on
2022-11-23 Version 2.0. Uses Kelvin, link to the old mired version 1.1 is preserved
2024-07-16 Removed the pre-2022.9 mired version, can be found on my gist here
2024-07-16 Updated the sliders to make them pretty again and gave a wider range

Help wanted /To Do

  • Make sure it supports other bulbs - needs your testing
  • How to add an optional and user-configurable condition? (Now possible with Take control)
  • User experience in extremes of latitude
  • A second set of inputs for lights to be offset
8 Likes

I like this blueprint, but now it needs to be updated for kelvin color temp.

Is it broken for you? Still working for me.

It is still changing the color temperature of my lights just fine, but when I go into the automation (not the blueprint) to change the maximum and minimum temperatures the interface is broken. I believe this is because it is using mireds instead of kelvin.

I actually think this is just a UI bug.

However I have made a new kelvin version that works.

1 Like

If I use this blueprint on a light, it ignores any transition time from the original on trigger.

In my case I am looking to create a cccw light that slowly turns on on sunset over the range of 15 minutes or so. And also change color temp based on this blue print

What would be the best was to accomplish that?

So I use this blueprint for the lights in my house day to day except I do not include my bedroom light

I use a second copy of this blueprint with only my bedroom light included which I use another automation to disable and re-enable around wake up time.

Then I use Wake-up light alarm with sunrise effect to do the sunrise effect on my bedroom light without interference.

Total of four automations which is a bit inefficient but it works
@rikkertkoppes

With the new updates on 2024.7 you can β€˜take control’ of blueprints and edit them. If you do this you won’t get any updates that I make (none are planned).
If you think those edits may help others then please do come back and share them on this thread and I will consider adding them.