Does mqtt supports publish data with offline device?

My one service published data to mqtt and device was offline at that time so I want mqtt to keep that data until it is subscribed or publish again when device is online so that it can subscribe the message. Could anyone please help?

Hi, this isn’t the way mqtt works. You could get the last value with a http request. Best if you have a look in the swagger documentation. Hope this works for you. Otherwise you could try to create a rule: if a device connects you could publish the same data again. So your device has to flag an „online“ attribute.

Hi, sounds like you are talking about retained messages; we don’t currently support retained messages but if you provide more details of your use case we can always provide another solution or maybe plan a change.

So your device has to flag an „online“ attribute.

what does this mean?

I want to send last published message again to device once device is online again. So device1 is sending message and device2 is subscribing to same message but device2 got stuck so become offline. Once device2 is online again I want to send last published message again to device2

I believe you are referring to quality of service setting on a standard mqqt broker. I don’t believe OR behaves exactly like an mqtt broker such as mosquito

For context; OpenRemote uses a ActiveMQ MQTT Broker (and HiveMQ MQTT Client), which is used both for the MQTT Agent and the exposed MQTT API. However not all functionality (like retained messages) is supported (yet).

In regards to @koshima s comment, (disclaimer I’m not an expert in our MQTT logic)
I believe that once reconnecting / resubscribing you will automatically receive the latest value if it hasn’t been sent yet. So if your device went offline, and reconnected again, I believe you would instantly get the latest “missed mesage” if there are. But I might confuse MQTT with WS here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.