working right now, just have to figure out why the light switches off , or on with rgb/hs settings, in which case the color_temp is not available of course. (believed the circadian automation to do that, but now believe something else is doing it, since the circadian sensor is correct, and now also showing on the light in the frontend)
the thing that might confuse the light is, that this is a color lamp, and color_temp is mutually exclusive for hs_color, or any other color setting. So when any Hue scene is set on this light that actually uses a real color setting this circadian sensor and setting is lost…
why would you only calculate the length of day when the sun is up? if the sun is down, the sensor has no value… For the other sensor, and the automation depending on it, it doesn’t make any difference if the length of day sensor is simply as follows doesn’t it? Since you’re calling the condition of the sun being up/above horizon there also?:
length_of_day_factor:
friendly_name: 'Length of day' # factor for circadian light calculation'
value_template: >
{% set daylength = ((as_timestamp(states.sun.sun.attributes.next_setting) -
as_timestamp(states.sun.sun.attributes.next_rising)) /
3600) + 24 %}
{{ ((daylength*-0.0063616)+0.11131)|round(5) }}
just don’t like empty sensors…