How to spot missing MQTT input

Hi all,

I’m just discovering ESP8266 devices connected via MQTT into Node Red and passing data to Home Assistant, working well so far.

I was trying to figure out a sensible way to show HA that the sensor has stopped - unplugged, crashed, etc and not sending any data. The method used to pass the data to HA maintains the last sent value so it looks like the sensor is still working albeit that the data is not changing any more.

I was thinking monitoring the wifi strength which i am also feeding into MQTT, or maybe using a watch-dog timer set to a bit longer than the update period (60s) so it sets the data to null if nothing comes in for a period.

Any better ways??

Thanks in advance

Why not have ESPHome post a timestamp?
It will always change and you can compare it to the now timestamp in HA.

I think i would have to add an NTP library for that?

Not an issue but I’d have to learn how lol

Is it any more expensive than using a watchdog timer?

I do not know how you do it in your case specifically.
I use the HA API and not MQTT and ESPHome can retrieve the HA time with just a few YAML lines.

1 Like

Ah yes, slightly different flavour than my setup but thanks anyway.

I don’t use ESPHome, just HA as a front-end and Node Red as the logic, the ESP8266 has no clock hence the library need.

I’ll try it on a watchdog timer for now, see how it goes.

The way I handle this is with a trigger node. It is set to do nothing when a message arrives. Each additional message resets the trigger node timer.

If no new messages are received, the timer runs out and message is fired to trigger an alert that it’s not working.

1 Like

Like minds and all that - that is exacty how i have it set just now.

Thanks

1 Like