I have a template sensor that monitors for water in the basement at my rental property. I would like to get an “Error” notification if the sensor is unplugged/disconnected. I noticed that when I unplug the sensor, HA just keeps the last value even after a restart. This leaves the impression the sensor is still working. Other entity values seem to go to “unknown” at some point after they drop offline.
Is there a way to tell HA to check to see if a sensor hasn’t reported in x min and return the “unknown” entity state?
- platform: template
sensors:
basement_water:
friendly_name: "Basement Water"
value_template: >-
{% if is_state('sensor.d1mini_1_water_sensor', 'ON') %}
DRY
{% elif is_state('sensor.d1mini_1_water_sensor', 'OFF') %}
WET!
{% else %}
Error
{% endif %}