I am trying to make a simple binary sensor that indicates if the sun is low according to my preferences.
binary_sensor:
- platform: template
sensors:
sun_is_low:
friendly_name: "Sun is low"
entity_id: sensor.sun_is_low
icon_template: "mdi:weather-sunny"
value_template: '{{ state_attr("sun.sun", "elevation") | float < 6 }}'
When starting or restarting Home-Assistant, the binary-sensor holds the correct value.
However, when the sun elevation is changed so that the binary_sensor should toggle, nothing happens.
I literally sat in front of the dashboard waiting for the sun elevation to update and the binary sensor is not updating.
As it is suggested in this thread, I also tested with this code:
value_template: {{ states.sun.sun.attributes.elevation | float < 6 }}
What am I missing ?