Skip to content
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

Error esp32 don't reconnect to Wifi AP #18

Closed
limkinZero opened this issue Jan 5, 2024 · 8 comments
Closed

Error esp32 don't reconnect to Wifi AP #18

limkinZero opened this issue Jan 5, 2024 · 8 comments

Comments

@limkinZero
Copy link
Contributor

Hi @rbroker ,

Merry Christmas! I think there is an issue when reconnecting to the Wi-Fi network if the router reboots.

This Christmas I noticed that when I was configuring my new router, the Ecodan local integration was not connecting to my Wi-Fi network. I had to press the reset button on the board for it to come back.

@mharizanov
Copy link

I had the same issue with my home setup of 4 ASUS routers in a mesh setup. Fixed it with a more aggressive reconnection strategy, see my branch here: main...mharizanov:ecodan-ha-local:main
The code is too quick and dirty to request a merge though.

@rbroker
Copy link
Owner

rbroker commented Jan 6, 2024

I'll take a look. The code which resets the WiFi configuration tries to do that in case people's WiFi setup changes, so they don't need to physically access / re-flash things. I guess the restart from your fork is needed for that @mharizanov, which is missing from mine.

Out of interest was rebooting every 24h needed for you? Or just being defensive?

@mharizanov
Copy link

mharizanov commented Jan 6, 2024

The code which resets the WiFi configuration tries to do that in case people's WiFi setup changes, so they don't need to physically access / re-flash things.

I understand, but that may also pose a security risk.

Out of interest was rebooting every 24h needed for you? Or just being defensive?

The 24-hour restart timer is just a precaution, I admit it is not the best of practices but it gives me peace of mind that worst-case downtime would be 24 hours.

@rbroker
Copy link
Owner

rbroker commented Jan 6, 2024

I understand, but that may also pose a security risk.

Yeah, fair enough. It should preserve the password for that reason, but I can see that no everyone would want that behaviour.

The 24-hour restart timer is just a precaution

Understood, thanks!

rbroker added a commit that referenced this issue Jan 6, 2024
- If WiFi is disconnected for more than 10 mins after successful startup, try to reboot the ESP32.
- Extend connection wait on boot to 10 minutes.
- Allow user to disable "fallback to AP mode" behaviour if WiFi connection cannot be established.
- Add new LED flash mode (rapid even blinking) if WiFi becomes disconnected
@rbroker
Copy link
Owner

rbroker commented Jan 6, 2024

I've made some changes in commit #97243e1 which extends the time we wait for WiFi reconnects to 10 mins, and will reset the board after those 10 mins if the WiFi connection hasn't been re-established (in theory it should figure it out if the SSID/password haven't changed because of this).

It'll now log when the WiFi connection is lost, and how long it takes to recover it too:

[00:07:54] WiFi disconnection detected... allowing up to 10 minutes to recover...
[00:08:42] WiFi connection re-established after (48) seconds.

There's now also a setting to stop the ESP32 falling back to captive portal mode if the connection can't be established on boot ("Auto-Reset WiFi Settings") for people who don't want it that (it'll just reboot every 10 minutes until the originally-configured WiFi network comes back)

Hopefully that improves things!

@rbroker rbroker closed this as completed Jan 6, 2024
@limkinZero
Copy link
Contributor Author

Thanks for your work Robert. I'll test it

@mharizanov
Copy link

This version works well in my Asus router mesh WiFi setup. Thanks!

@limkinZero
Copy link
Contributor Author

limkinZero commented Jan 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants