I'm trying to create a battery & solarpowered ESP32 for future use with sensors. It connects to Wifi, MQTT, publishes some readings and status messages and go back to sleep. From time to time (can happen after few sleep cycles and sometimes after few hunderds cycles )I get 2 unexplained behaviours : 1) fail to connect to MQTT at boot, 2) fail to sleep.
Sometimes those behaviours happen simultaneously.
Is there a known issue with
deepsleep and MQTT (using
PubSubClient ) ? Most deepsleep example I see online, all code is outside
loop()section - is it mandatory to be like that ?
I don't share code, since it is more a general question.
callbackwas commented out, remaining only printing incoming message.
LED was attached to a GPIO, generating a blink on
loop()- when sleep succeeds - it goes off, when it fails, it stays on. This test shows that when this "error" happens, code actually stop running, but does not enters deep sleep ( power-wise )