Template entity to guess the outside colour temperature

I think I did, for the past week the max elevation been 49.2, not sure if this would be all year (probably not), but hope to come up with the ideal solution before then, I just need something working for the next week while I’m away.

I will definitely look into those.

I finally made a blueprint: Color temperature - match your lights to the sun

Do you know about a way to get this information? I have current elevation and I have the time for astronomical noon (which is when the sun will be at max elevation at the current day, however, how to know which elevation will be at noon?
Here at sweden the max elevation changes quite a lot over the year and I’d like to find it programmatically for one of my automations.

A hacky way would be to store the highest elevation from yesterday which will be a rough approximation of today’s maximum elevation.

In an automation use the moment the sun.sun.attribute.rising switches from true to false to update an a number helper with the current elevation.

As for the highest possible over a year, I would just look it up on the internet and then input it as a number helper.

1 Like

I liked the idea. Simple!

Thanks!

For colour temperature in Kelvin, you can try this (untested), adjust 2200 and 4000 to the supported range of your bulbs:
{{ [ [ (1000000/(4791.67 - 3290.66/(1 + 0.222 * [ [ 0, state_attr(‘sun.sun’, ‘elevation’) ] | max, 90 ] | min**0.81)))|int, 2200] | max, 4000] | min }}

This is still in Mireds. Probably you meant
{{ [ [ ((4791.67 - 3290.66/(1 + 0.222 * [ [ 0, state_attr('sun.sun', 'elevation') ] | max, 90 ] | min**0.81)))|int, 2200] | max, 4000] | min }}

The full sensor would be

  - sensor:
    - name: sun_kelvin
      state: "{{ [ [ ((4791.67 - 3290.66/(1 + 0.222 * [ [ 0, state_attr('sun.sun', 'elevation') ] | max, 90 ] | min**0.81)))|int, 2200] | max, 4000] | min }}"
      unique_id: "sun_kelvin"
      unit_of_measurement: 'Kelvin'
1 Like

I turned this into a blueprint:

1 Like