Closed jbaumann closed 2 years ago
HI @jbaumann
Thanks for your interest in the library and the enhancement request.
Have a look at retries block the main loop #18 to know that you won't have issue after connected to WiFi once. In the loop, you can do whatever you'd like, including going to sleep mode.
If you don't like to have CP when restart the board without WiFi presence, you have to write the code yourself. What do you expect a WiFiManager
to do whenever a connection has never been made?
I'm sorry that no library can be applied perfectly in all use-cases or it'll be so complex for normal users to go thru the configuration maze. So I won't add the feature now, until there are many more users' requests.
You can write the code yourself to apply into your use-case.
You can have a look of the sample code, written for ESP_WiFiManager here: ConfigOnDoubleReset.ino#L800-L807
if ( (Router_SSID != "") && (Router_Pass != "") )
{
LOGERROR3(F("* Add SSID = "), Router_SSID, F(", PW = "), Router_Pass);
wifiMulti.addAP(Router_SSID.c_str(), Router_Pass.c_str());
ESP_wifiManager.setConfigPortalTimeout(120); //If no access point name has been previously entered disable timeout.
Serial.println(F("Got ESP Self-Stored Credentials. Timeout 120s for Config Portal"));
}
Just adapt to apply into your case.
Good Luck,
Is your feature request related to a problem? Please describe.
I want to use the WiFiManager_Lite with unstable WiFi connections. If there is no WiFi connection, the WiFiManager_Lite starts the ConfigPortal even when valid configuration data is avalailable.
Describe the solution you'd like
A mode for the WiFiManager_Lite that does not start the ConfigPortal if no WiFi connection can be made, provided that valid config data is available. This could be done by adding a #define that when set lets the begin() method return without starting the config portal.
Additional context
If you have remote EPS installation for which the WiFi connectivity is established only from time to time the ESP should sleep for some time, then test the WiFi, if not accessible, sleep again, until a connection can be established. I cannot implement this if the ESP goes into the Config Portal mode as soon as no connection can be established in the begin() method.