ESP32 BLE 0.95: WiFi Connection dying and not recovering

Hello,

first of all I would like to say thank you for this great piece of software, I really appreciate the great functionalities provided by the OpenMQTTGateway software! However I encounter one big pain point regarding WiFi stability.
I experience WiFi problems with the ESP32-BLE-Gateway software with different offically supported boards. So far I tested with the Olimex ESP32 Gateway and the M5Stack basic board. Both work flawless for some time after repower/reboot but then always lose their WiFi Connection within a timespan between 1-36 hours after the last repower/reboot.
I already did a lot of testing and monitoring within the last weeks to narrow down the cause, but it is definitely the WiFi connection. I persisted all MQTT messages to monitor free memory etc. but the only problem is WiFi. I did ping monitoring on the devices and also checked my router and they always disappear after a certain time. I am using a AVM Fritzbox 7590 WiFi router which works absolutely falwless with tons of other devices in my home so the problem lies not with the router but with the ESP32 devices flashed with MQTT Gateway 0.95. The WiFi problem is most obvious with the M5Stack board as the display shows the messages:
grafik

So apparently the Gateway tries to reinit the WiFi connection but without success. As this state blocks all further operations until a repower/reboot the devices are unfortunately not really usable with WiFi operation at the moment (I flashed one of my Olimex Gateways with the Ethernet version for testing purposes and operated it via cable which seems to run stable).
I already tried working around the problem by sending a “restart” command via MQTT every 60 minutes to the device but it does not help. The only remedy so far is to put a remote controlled relay switch to the power line and interrupt power for a couple of seconds when the device stops sending MQTT updates as after a repower the device restarts operation (but this is of course no final solution).
My question is: Would it be possible to improve the WiFi reinitialisation process within the Gateway software? Perhaps in a way that it performs a full reset in order to regain operation?

Thank you very much for any help!

Hello,

Could you indicate if you are using wifi manager or the wifi manual setup?

I used the wifi manager so far. Do you think it would help to try the manual setup instead?

It could but in the future. I need to do some change.

In the meantime could you try this branch:

Thank you very much for your quick support, much appreciated. I will test it tonight.
Should I try this branch with the wifi manager or with a manual setup build?

With the wifi manager please

Thank you for clarifying. I just flashed the device with the branch version, now let’s wait and see. Thanks again for the fast help!

1 Like

Unfortunately the device went offline again with the new branch after 22,5 hours in operation. It did not recover by itself:
grafik

A short press on the reset button however immediately brought it back to life.
Would it be possible to implement a complete reset/restart if the device is unable to reconnect for more than 5 minutes or so?

I experience the same behavior here. Unit (ESP-32) disconnects from Wifi roughly every 36h and won’t reconnect. Fortunately I have automation in place and cycle the power every night as a workaround. Would be nice to fix it though.
Willing to test new branch.
Thx

Short update: After the restart yesterday the device just went offline again after 17 hours of operation.

Before outgoing v0.9.6 I will propose a branch for test with simplication of the wifi reconnection mechanism. It will be interesting to have your feedbacks.

I would be happy to help testing. :wink:

I just wanted to report back that the 0.9.6 version really seems to solve the issues. Even my most instable ESP32 board (instable for holding WiFi connection) now works smoothly for 10 days in a row without losing the WiFi/MQTT connection. I can see in my persisted data that the device already restarted itself 44 times within the last 10 days but it always comes back to connectivity quickly which is great.
So thank you very much for this fix and the great software. Keep up the good work, I really like OMG! :+1:

1 Like

Thanks for the feedback!