mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #566] wifi connection timeout #476
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#476
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 @mutthunaveen on GitHub (Mar 17, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/566
Hello
im using your code for configuring and connecting wifi. it is great.
im in a environment where there will be frequent power fluctuations. so, each time my wifi router will take around 60 sec to init. by the time your code will goto AP mode and ask for config change.
after searching few threads in this repository i found this.. ->
wifiManager.setConnectTimeout(70);i used 70sec as timeout.above code as shown below..
wifiManager.setConnectTimeout(70); // seconds wait before AP if (!wifiManager.autoConnect()) {after compiling the esp, i restarted both wifi router and ESP,
any Help??
thank you.
@tablatronix commented on GitHub (Mar 17, 2018):
Connect timeout is how long to leave the portal open before it closes.. not sure what you are trying to do. You might want to just add your own connected wait loop and only start autoconnect if not connected after that interval, so it doesnt always start the configportal
Maybe explain your problem better
@mutthunaveen commented on GitHub (Mar 18, 2018):
Ok... Got it... I need to develop my own code for connecting before it goes to autoconnect.....
I will explain again my problem....Here is my problem for which i need a solution....
I have a Wi-Fi router in my home... And my Wi-Fi router is prone to several restarts due to power fluctuations. Each time a power on reset causes 60 seconds for my Wi-Fi router to switch on completely.. after 60 second any device can be connected without any hassle... Before 60 seconds I cannot make because Wi-Fi router will be in initiation phase..
So when I program my ESP using Wi-Fi manager, during power on reset my ESP checks for available networks and if you did not find anything it immediately goes to AP mode asking configuration settings..
In my case my ESP should continuosly try to connect until 60 seconds, with my predefined credentials available in ESP. if predefined credential Wi-Fi network is not available even after 60 seconds then the ESP is allowed to go to auto connect on AP mode..
I hope you understand my problem... Thanks for the help
@tablatronix commented on GitHub (Mar 18, 2018):
Nono the esp autoconnects on its own, you can just add a small while not connected loop before autoconnect
@malikit786 commented on GitHub (Dec 16, 2020):
in my cases wifiManager.setConnectTimeout(180); does not wait for 180 sec, But only 60 sec. my router takes about 2 minutes to setup after power outage my esp does not connect to the router until it hard reset.
code is here for your reviews.
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
//reset settings - for testing
//wifiManager.resetSettings();
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
//******this
wifiManager.setConnectTimeout(180);
wifiManager.setTimeout(180);
//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if(!wifiManager.autoConnect("AutoConnectAP")) {
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("connected...yeey :)");
}
void loop() {
// put your main code here, to run repeatedly:
}
@tablatronix commented on GitHub (Dec 16, 2020):
hmm interesting, not sure why the timer would be wrong
@tarontop commented on GitHub (Mar 17, 2021):
Yes, I also have this kind of problem. Sometimes this timer is a random one. I don’t know if you have a solution.