Elegant way in a flow to determine if the MQTT broker is disconnected, connecting or connected?

Or you could use a Status node linked to an MQTT node to tell you what the current status is.

Alternatively this post shows a flow for guaranteed delivery via MQTT. It will queue mqtt messages until they get sent successfully. If necessary you can use persistent context to even queue them over a node-red restart. It only guarantees delivery to the MQTT broker though, it does not guarantee that a client successfully receives them from the broker.

1 Like