Alert when it's been more than X minutes since an event?

I want to monitor a specific device and generate an alert if it’s been more than 1440 minutes since an event has happened (this is about a PowerPet door and I want to know if it hasn’t been operated in a while, which implies the battery on the dog collar has died).

What’s the best way to accomplish this? Perhaps a countdown timer/variable that gets reset every time the door is operated? If the variable gets to zero, it can send an alert.

Create a binary sensor template as use delay_on

Here is an example that does the inverse. If the door open for 10 minutes the binary_sensor becomes true.

The only problem with this approach is it will reset when Home Assistant restarts. If that’s an issue there’s another slightly more complicated way to do it.

binary_sensor:
  - platform: template
    sensors:
      al_dr_open_attic_door_alert:
        value_template: '{{ (is_state("binary_sensor.attic_door_open","on")  }}'
        delay_on: "600"

The use this to drive an alert.