-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnect to wifi #26
Comments
Well, this one is interesting. I thought I fixed automatic WiFi reconnect in b21f532 Back then I've found several examples, which suggested doing it this way. Since I've never observed any issues, I thought it just works 🤷♂️ Will look into this, as soon I have time. |
I tried to recreate the issue yesterday: I've been playing around with a WiFi hotspot created using my Android phone. The esp is always reconnecting in case WiFi hotspot is disabled and reenabled. Maybe it is due to the network topology or router, but it is strange, since the auto reconnect behavior seems to be the default arduino esp32 behavior anyway 🤷♂️ What kind of router are you using? Do you use the latest platform framework libraries? Maybe a |
Hello @tspopp , If I restart WiFi on my router, it succeeds to reconnect. If I reboot my router, it fails to reconnect. I see nothing on router logs. I have reflashed the esp after an pio pkg update but it changes nothing. |
Well, unfortunately, I can confirm the behaviour. Today, I needed to reconfigure my Ubiquiti stuff and this caused a WiFi downtime of about 30s. Every device reconnected, even plenty of ESP32s (WLED, e.g.) but the AquaMQTT didn't. Although, my console told me, it was still connected but didn't receive an IP. According to https://esp32.com/viewtopic.php?f=19&t=39116 it could be a problem that the WiFi.setAutoReconnect function doesn't work if the station gets "properly" disconnected (AP sending a disconnect message). It only seems to work if the loss of WiFi appears suddenly and uncontrolled. One suggests that you could actively monitor the WiFi events and act accordingly. Maybe by introducing a loop or even doing a complete reboot after x sec of no connectivity? |
Hm, I hoped they address such issues within the official esp32 framework libraries and I don't need an individual hack in a loop to check for WiFi connectivity. Reboot is not an option, we would loose any configuration previously made through MQTT since previous configuration is currently not stored/restored. I will try re-creating this issue as soon as I have some spare time. I really want to make sure the fix will address the issue and does not cause any other side effects.. |
I was not able to reproduce the issue, but I basically followed the advice do not trust the auto reconnect routine, just as proposed by @kopierschnitte. Therefore I added something customized which is basically sequentially checking for the WiFi connection and attempting a hard reconnect if something is wrong. I've tested this using an Android Hotspot and it was always reconnecting fine. I hope this will finally address this issue. I will close this issue as soon as I've merged the PR, but you may feel free to reopen it in case it re-occurs. |
Thanks, I have updated the Arduino with the new code, I will inform you if the problem is solved. |
Hello, |
I have an issue about wifi. Indeed, after an firmware update of my router I discovered that the ESP32 didn't reconnect. I have to reboot it to see it again on the network.
I made additionals test, each time I reset my wifi or reboot my router, the ESP32 didn't reconnect.
I have a lot of devices at home (with some esp) and this is the only one with this behaviour.
How is implemented the strategy when the device lost the wifi connexion ?
The text was updated successfully, but these errors were encountered: