I am trying to understand why something doesn’t work, and this is the simplest version I can make which demonstrates my misunderstanding.
Why isn’t the following binary sensor triggering when HA restarts?
template:
- trigger:
- platform: homeassistant
event: start
sensor:
- name: "my sensor"
unique_id: my_sensor
state: "Tomorrow"
- trigger:
- platform: state
entity_id:
- sensor.my_sensor
binary_sensor:
- name: "my binary sensor"
unique_id: my_binary_sensor
state: "{{ is_state('sensor.my_sensor', 'Tomorrow')}}"
Why do I expect it to trigger?
My template sensor is set to update when HA restarts. My template binary sensor is set to update when the state of the first sensor changes. According to the documentation, since I left of any “to” or “from” options on the state trigger, the trigger should “fire when the state of any of given entities changes.”
It was my understanding that there is a “last_changed” attribute for sensors (although I couldn’t find much about this in any of the documentation, only from the forums, e.g. here).
So, I would expect that even though the state value (“Tomorrow”) isn’t changing when HA restarts, I would expect a “last_updated” attribute to change, and thereby fire the binary sensor trigger. But the binary sensor trigger isn’t firing on restart. What am I missing?