This has been asked before a few times, but with the recent changes I am not sure how to update this sensor.
I have a MQTT sensor (bedroom temp/humidity), but rarely those sensors kinda hang and stop updating, or the battery just runs out, which is fine but I just want a notification when this happens.
This Template Sensor will be updated only when sensor.master_temperature changes state. That’s the way it has worked in all versions of Home Assistant, including the latest 0.115.
Home Assistant will create a “listener” for each entity it can identify in your template (and the listener monitors the entity for state-changes). There is only one identifiable entity in that template (sensor.master_temperature). The other part of it is now() and that’s a function, not an entity (so no listener is created for it).
If you have the Time & Date integration configured, you can use sensor.time in your template. Home Assistant will create a listener for sensor.time. It changes state every minute, thereby causing your template to be evaluated every minute.
- platform: template
sensors:
master_no_activity:
friendly_name: "Master Bedroom Sensor No Activity"
value_template: >
{% set x = states('sensor.time') %}
{{ (now().timestamp() - states.sensor.master_temperature.last_changed.timestamp()) | int // 60 > 30 }}