Open ZoranCom opened 4 years ago
Obviously you cannot send data when WiFi is disconnected. When a message is sent, a valid packetId is returned. You can check this and build your firmware around this.
Thanks for yor reply. I expected that my ESP, once it reconnects after temporary wifi signal loss, will publish all data collected while wifi was not available. Hope that makes sense.
It doesn't. You have to do that yourself. what I would do:
Obviously, you'd only check your queue when WiFi and MQTT are connected (mind: MQTT can think it's still connected while WiFi is already gone). When implementing this, beware of memleaks! Your struct will probably have some pointer to strings. A memory leak is just around the corner even as pointers to out-of-scope variables.
Thanks for your reply, much appreciated! It's clearer now. Are you aware of some existing project/code in which this or similar kind of procedure was implemented, so I can study it? Regards!
I'm not aware of any such code, but it's on my todo list. Unfortunately, nothing on the horizon yet.
Sorry, I am totally new at this...
I need to monitor and collect timestamp data when some machine sends ON signal. ESP8266 with AsyncMqttClient lib. is attached to machine and monitors that signal. I have WiFi connection with PC that runs mosquito mqtt and node red. Everything works perfectly, node red's mqtt-in node receives published timestamp on each event as desired. However, sometimes WiFi connection gets lost for couple of minutes (due to quality of signal, interference...). But, no data of events that occurred during WiFi disconnected period is published when ESP automatically connects to WiFi again, so that data gets lost. Timestamps of events that occurred after that are normally published again. Publish QoS is set to 1, subscribe QoS is set to 2.
Can you comment on this, please!!! Regards