I am running NR on a Pi 3B+ which also has Mosquitto version 2.0.11 installed locally. Various temperature sensors feed in using ESP32-based modules over Wi-Fi and they all work absolutely brilliantly, polling the sensors every 10 seconds and reporting.
However, if a module disconnects or sensor fails, NR still shows the last value received. I am seeking a method of detecting failure of the remote MQTT Client, but so far have failed miserably. This is further complicated because the MQTT-In node will always show 'connected' as long as it is talking to the local MQTT Broker. What it doesn't show is that the transmission in has failed and the displayed data will remain unchanged.
I would be very grateful if someone can point me in the right direction or advise me if I am missing something very obvious.
I always choose a standard topic for device online/offline. When you connect, send "online" to the topic, then define the will to use the same topic but send "offline" - or use one/zero or whatever suits best. (numeric 1/0 is good if you are wanting to record changes in InfluxDB).