mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #266] Cannot automatically reconnect after router power cycle #220
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#220
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 @reynolga on GitHub (Dec 17, 2016).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/266
The wifi manager works well for the most part. I've encountered a strange issue though. If the router is reset while a device is connected to it, the device is unable to remember the credentials previously used. The device must be restarted and it will set up an Autoconnect network to configure the SSID and password. I haven't been able to solve this. Any ideas?
@cosmocracy commented on GitHub (Jan 3, 2017):
How do you know that the device has "forgotten" the credentials and just can't reconnect? I'm troubleshooting something similar and was just wondering how you've been able to troubleshoot this. Thanks!
@reynolga commented on GitHub (Jan 3, 2017):
So the device seems to be stuck after the router power cycle. I don't detect the device on my server and it does not set up an access point. I've also had it connected to my computer during this process and I don't see any serial printouts after the router power cycle,
To fix this I have I go to the ESP8266 device and disconnect it and reset the power. After the ESP8266 powers back up, it will set up a webserver - "Autoconnect" which sets up when it can't connect with other credentials. So that is why I say it "forgot" the credentials. It has no recollection of being previously connected.
If the ESP device is not powered up during this router power cycle. These will be fine and connect to the network the next time the ESP device powers on. It only affects the devices that are currently connected to the network.
That's all I've figured so far.. let me know if you find more!!
@cosmocracy commented on GitHub (Jan 3, 2017):
@reynolga Thanks for the info. While surfing for ESP8266 and disconnect/reconnect code, I saw so many examples--some of which worked and some that didn't. I also came across this issue with the ESP8266 Wifi library itself which suggests that the latest version could have some quirks, too: https://github.com/esp8266/Arduino/issues/2174
I've added a suggestion for @tzapu that we somehow encapsulate reconnection code to make it dead-simple for sketch programmers to call within their loop() code. See issue #272
@reynolga commented on GitHub (Jan 4, 2017):
Good work, looks like you spent quite a bit of time troubleshooting this. I'm tracking your issue #272 . Hopefully we can get something working here. Having all of the devices lose connection and have to be manually reset is such a pain.
@tablatronix commented on GitHub (Feb 8, 2017):
The esp reconnects by itself, there is no code required in loop. The only thing it does is what your sketch tells it to. if you have autoconnect on startup and it cannot connect, it will start configportal, if you have a timeout set it will exit automatically and continue to retry ( the esp sdk does this internally )
I am not sure how this loss of connection is happening but it is hard to pin in on this library , i have been trying to reproduce.
you guys also do not mention anything you are using, what sdk, what branches?
what code ?
@sabretus commented on GitHub (Nov 4, 2017):
@tablatronix I'm using this project.
I have 0.96" screen attached to my ESP. Sometimes when there is a power outage at home, all devices are turned off and on at the same time. WIFI router boot time takes longer than ESP, and then I see the following message on the ESP screen: "Wifi manager, please connect to xxxxx". It behaves like it requires initial setup.
Once power on the ESP reset manually, it's successfully connected to WIFI AP.
@tablatronix commented on GitHub (Nov 4, 2017):
Are you using setconfigportaltimout ?
Do you have a large enough timeout for autoconnect?
Are you losing wifi credentials also ?
@ofekp commented on GitHub (Aug 18, 2018):
To anyone encountering the same issue in the future, this is my WiFi connection method which works well.
Before using
delay(1200);it did not work and stalled onWiFi.status() != WL_CONNECTED.@devabhixda commented on GitHub (Jan 21, 2020):
Adding a delay of about 2 min before initializing auto connect should solve the issue as nearly every router would be able to turn on in the given duration after power comes back. Not an issue with WifiManager.
@erickfloors commented on GitHub (Feb 16, 2021):
which one Adding a delay of about 2 min before initializing auto connect ? can you tell me..which part should I add
@devabhixda commented on GitHub (Feb 16, 2021):
WiFiManager wifiManager;//Delay
delay(300000);wifiManager.autoConnect();@erickfloors commented on GitHub (Feb 16, 2021):
my code like this..
if (!wifiManager.autoConnect("SmartHome", "password123")) {
Serial.println("Failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(5000);
}
which part should I add ? Thanks You
@devabhixda commented on GitHub (Feb 16, 2021):
Before the autoconnect block
@erickfloors commented on GitHub (Feb 16, 2021):
WiFiManagerParameter custom_blynk_token("blynk", "blynk token", blynk_token, 33); // was 32 length
Serial.println(blynk_token);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
wifiManager.setSaveConfigCallback(saveConfigCallback); //set config save notify callback
//set static ip
// this is for connecting to Office router not GargoyleTest but it can be changed in AP mode at 192.168.4.1
//wifiManager.setSTAStaticIPConfig(IPAddress(192,168,10,111), IPAddress(192,168,10,90), IPAddress(255,255,255,0));
wifiManager.addParameter(&custom_blynk_token); //add all your parameters here
//wifiManager.resetSettings(); //reset settings - for testing
//set minimu quality of signal so it ignores AP's under that quality
//defaults to 8%
//wifiManager.setMinimumSignalQuality();
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep, in seconds
wifiManager.setTimeout(600);
//fetches ssid and pass and tries to connect, if it does not connect it starts an access point with the specified name
//and goes into a blocking loop awaiting configuration
if (!wifiManager.autoConnect("SmartHome", "password123")) {
Serial.println("Failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(5000);
}
//if you get here you have connected to the WiFi
Serial.println("Smart Home is Connected");
can you tell me or give a sample with code above? please
@erickfloors commented on GitHub (Feb 18, 2021):
can you give a sample on my code on below?
@devabhixda commented on GitHub (Feb 18, 2021):
https://del.dog/phycogaper.txt
@erickfloors commented on GitHub (Feb 18, 2021):
thanks you very much..i will try