espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
270 stars 164 forks source link

Core MQTT error on WiFi disconnect (CA-304) #193

Open esp32person opened 1 year ago

esp32person commented 1 year ago

Hi,

When Wifi disconnects, I am getting the repeating error below,

E (115491) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed E (116001) esp-tls-mbedtls: read error :-0x004C: E (116001) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed E (116501) esp-tls-mbedtls: read error :-0x004C: ....

Closing MQTT broker and server connection when WiFi fails and restarting server and Mqtt broker connection, fails to connect even after wifi connection is restored and the error keeps repeating. A restart fixes the issue.

Any ideas what I could do on wifi disconnect?

Thanks

SolidStateLEDLighting commented 1 year ago

You render SNTP invalid and you send a notification to MQTT to shut down.

Upon Wifi, reconnect, you first restart SNTP and allow it to validate your system time, and then start MQTT again.