Monitor if entity is changed, set alert if not changed within a time period

Fedot’s solution is basically what I have suggested to others but using datetime objects in the subtraction instead of timestamps (slightly more compact template).

  {{ now() - states.input_number.test_number.last_changed > timedelta(hours=1) }}

What you might be thinking of is this automation that periodically checks for stale sensors.

The requirement was to check every 4 hours for any sensor or binary_sensor that hasn’t been updated in several hours. It uses a Time Pattern Trigger in order to control the polling interval (to avoid checking every minute as in a template employing now()). It can be easily adapted to check every few minutes and could be made to check on startup as well (add the appropriate homeassistant startup trigger).

3 Likes