Mqtt client/device status - notify when offline or not reporting anymore

Hi!

Looking for some assistance on something here. I found a few threads on this, but still not sure how to solve this.

Here’s what I have, HAOS running on a RPi4, a Ubuntu Server and a few other RPis that are each doing specific tasks and feeding data into HA.

The Ubuntu server is acting an MQTT Broker (on the same network as all the devices mentioned), and the RPi’s are communicating to HA via the ubuntu mqtt broker.

Here’s the problem im trying to solve; when one of my RPi stops sending mqtt data to HA (for whatever reason), I’d like to know about it. At the moment I have MQTT auto discovery on in HA and its reading the data no problem and have automations based on the data its sending.

I thought of perhaps setting up an notification of say if one of the entities doesn’t update for a certain time, send a notification, but is there another way to do this, possibly using the mqtt client or device name?

You want the Pis to configure a will message. Then the broker will send that message when the device disconnects.

Ahhh, thank you very much!

I presume this is something that needs to be included in the script that’s running on the RPi or is this something that’s done in the RPi config?

It’d be handled by the MQTT client on the Pi - and it has to be keeping the connection to the broker up

1 Like