Sensor Data, last data received, MQTT

Hi HA community

I’m publishing some sensor data from my PI (grove hat) via MQTT (Python->broker) to HA. So far so good.
Sometimes the data is not published anymore. How do I get that information. I tried to do it in Node Red but wasn’t succesful.

When I look at the Sensor Card I see a eye icon. Clicking on it, shows me the last time new sensor data was received. How can I get to this information in a script etc.?

Basicly, how can I get alerted when a mqtt topic is not received anymore?

Thanks in advance

Check the attribute “last_updated” for the entity and compare if this timestamp there is older than x minutes.

1 Like