mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #511] Cannot reconnect to saved Wifi network after WiFi.disconnect() without first rebooting #427
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#427
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @horendus on GitHub (Feb 10, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/511
I'm finding that if I call WiFi.disconnect() and then try to reconnect with wifiManager.autoConnectNoConfigPortal() or wifiManager.autoConnect I fail to reconnect to the same wifi network again.
The connection result are
*WM: Connection timed out
*WM: Connection result:
*WM: 0
If I reboot my ESP8266 which calls wifiManager.autoConnectNoConfigPortal() at startup it connects without issue, so the wifi details are being stored.
If I call WiFi.begin(SSID,PWD) AFTER a WiFi.disconnect() I am able to connect without issue, but as you see I have had to specify the SSID and PWD instead of using the saved ones from WiFiManager.
If I run WiFi.disconnect() and then print the Wifi details to serial I can see the SSID and PSK are blank. But like I have mentioned, if I power cycle the ESP8266 the details are back.
Serial.print(F("SSID:"));Serial.println(WiFi.SSID());
Serial.print(F("PWD:"));Serial.println(WiFi.psk());
Does anyone have a work around for this? My project needs to be able to enabled/disable wifi within the code and rebooting every time I want to reconnect isnt a good solution for this project.
@tablatronix commented on GitHub (Feb 10, 2018):
wifi.disconnect wipes config in esp8266
@tablatronix commented on GitHub (Feb 10, 2018):
also try development branch
@horendus commented on GitHub (Feb 13, 2018):
Changed WiFi.disconnect() to WiFi.mode(WIFI_OFF)
Seems to allow me to disconnect wifi without loosing details, then re connect with wifiManager.autoConnect
So far have had no issues during testing doing it this way, thoughts? Bad idea?
@tablatronix commented on GitHub (Feb 13, 2018):
You can do pesistent(false); WiFi.disconnect()
maybe I will add a public method to wifimanager to help non persistent disconnects, It already exists.