MQTT recovery after communication loss

Hello, I did some searching thru the topics and online documentation but could not find an answer to the following questions:

  1. If the gateway’s connection to the MQTT broker is lost, e.g. network goes down, will the connection automatically re-establish when the network comes back online? Other products I have seen require the gateway to be power cycled.
  2. If scenario one happens, does the gateway store the sensor data received during this time and publish it once the connection is re-established?

Thanks in advance,

Hi Scott,

  1. If the network goes down the MQTT Gateway will automatically reconnect to the network, and then automatically reconnect to the MQTT Broker once internet connectivity is restored. You should never need to manually power cycle the gateway.

  2. Unfortunately no. The Gateway has no on board storage for storing sensor telemetry so any sensor telemetry generated while the network is down would be lost. We are working to develop a new gateway that would have some on board storage for this purpose. We hope to release it later this fall.

Thank you for the quick response. Another quick question, does the gateway subscribe to any MQTT messages? Can the gateway and sensors be configured via MQTT?

Hi Scott,

The gateway does subscribe to a topic for controlling End Node output devices(relays, 4-20ma, etc). This allows software to control these outputs by publishing messages to the MQTT Topic the Gateway is subscribed to.

The Gateway however does not subscribe to a topic for configuration of the Gateway or configuration of the sensors. Configuring the Gateway through an MQTT topic is something I considered but honestly that’s not something you should ever need to do and if you do then you’re probably wanting to change MQTT Broker credentials or WiFi network connectivity which doesn’t make sense because if either of them were wrong it wouldn’t be connected to the cloud for configuration anyway. Also this opens up security vulnerabilities that would allow a user who gained access to the MQTT broker to change anything they wanted.

Sensor configuration via the gateway is something I am still considering but likely will not implement anything anytime soon.

Thanks Scott,
Travis Elliott

Hello Travis,

Thanks for the rapid replies, very appreciated. Just a little background, we provide control and monitoring systems for research facilities, primarily universities and pharmaceutical companies. Our techs actually install the devices for the customers and perform the initial setup. However, once installed our customers are then able to use our solution to change settings and monitor their devices. For this we most likely wouldn’t need to be able to configure the gateway via MQTT. However, that really depends on what is done on the gateway vs the devices. For this reason device configuration via MQTT, for us at least, is highly desirable (however I haven’t yet dug into what can be configured for your sensors). Our customers would not be given direct access to the gateways, but would rely on our software to be able to push the changes to the devices. If configuration can not be done via MQTT then each time a customer wanted to make a change we would need to remote into their site to access their gateway. I am not asking for you to implement this, just providing a use case for OEMs.

Kind regards,

Hi Scott,

Thank you for that explanation. That makes perfect sense. If you are not on site to make changes and the customer does not have access then that really means you would want remote access to make changes.

The Gateway honestly is a really simple device. It is simply configured to connect to a WiFi network and via internet connectivity on that network to authenticate and connect to an MQTT broker. It would be unlikely that any of that would need to change unless the WiFi network changed in which case you couldn’t make any changes remotely.

The sensors have a select few settings which can be configured. The only setting anyone ever really changes on them however is the wake/update interval. Most generally settings on the sensors are set and never changed again once the install is complete. Also in order to make settings changes to the sensors you must physically press buttons on the sensor to put it into configuration mode. It’s not possible to make any changes to sensor settings without pressing buttons on the sensor.