Set alert if sensors stop transmitting

I would like to setup home-assistant to send an email alert if no data is received via mqtt for a certain length of time.
I use mysensors via MQTT, and occasionally have issues with the gateway, and/or sensors. All of my sensors send data at a regular interval, so I’d like to have home-assistant send an alert if no data is received from a given sensor after a certain amount of time (say 1hr).
I have email alerts for having my garage door open for a certain length of time, but I don’t know how to set a trigger for no data received.

Since it is mqtt based, I could add an independent listener for events and send messages that way, but I was hoping that home-assistant could help me out here.

@PhracturedBlue

You can use a template sensor to monitor a sensor since it’s last updated and create an automation to notify you if it has not been updated for x amount of time.

Here is an example of a timestamp template for a sensor…

- platform: template
      sensors:
        plw_sensor_last_update:
          value_template: "{{(as_timestamp(now())-as_timestamp(states.sensor.power_line_watts.last_updated)) | int }}"
          entity_id:
            - sensor.date__time

There are a handful of other examples floating around the forum as well.

Regards,

Mike

1 Like