Hi all,
I’ve made a template for sunstates. It was working since a few days/week before, but it doesn’t work anymore.
it seems that when sun set, all is ok, but when sun rise I have an unknown value in history, and the value in template stay the same than when the sun set.
(before I was using the above_horizon states, now I’ve try with the elevation, but there is no change)
here is my code:
> tmpl_sunstate:
> entity_id: template.tmpl_sunstate
> friendly_name_template: >
> {% if state_attr('sun.sun','elevation') | float > 0.1 %}
> Le soleil se couchera à
> {% else %}
> Le soleil se lèvera à
> {% endif %}
> value_template: >
> {% if state_attr('sun.sun','elevation') | float > 0.1 %}
> {{as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom('%H:%M', true)}}
> {% else %}
> {{as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom('%H:%M', true)}}
> {% endif %}
> icon_template: >
> {% if state_attr('sun.sun','elevation') | float > 0.1 %}
> mdi:weather-sunset-down
> {% else %}
> mdi:weather-sunset-up
> {% endif %}
have you any idea on what’s wrong ?