[GH-ISSUE #738] Reconnect after setup #617

Closed
opened 2026-02-28 01:26:14 +03:00 by kerem · 1 comment
Owner

Originally created by @Gregauriz on GitHub (Sep 20, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/738

Basic Infos

Wifi is idle if no wifi was able to connect during setup

Hardware

WiFimanager Branch/Release:
Master

Esp8266/Esp32:
ESP8266

Hardware: ESP-12e, esp01, esp25

  • ESP12 E/F/S (nodemcu, wemos, feather)

ESP Core Version: 2.4.0, staging
staging (master/dev)

Description

If during the setup (where the autoconnect is) no wifi is available or no setup made on the portal, there is no way to connect to any wifi in the loop, the only solution would be to reset the all ship. The problem is that once you are in the loop the wifi is idle so impossible to connect even if the settings saved are good. So this could be an issue for example your board start faster then your wifi router after an electricity drop...
I tried to add a simple WiFi.begin(); did not work, I tried to add a autoconnect, not better.. I also try to put everything in the loop and nothing in the setup, not good either... I guess the pb is that during the loop the wifi is idle so the reconnect with saved setting doesn't work.

The best would be to be able to just send a reconnect (with setting saved) in case off lost connection during the loop.

Beside that you did an amazing job and I love your lib ! Well done !

Settings in IDE

Module: NodeMcu

Sketch

#include <Arduino.h>

void setup() {
  WiFiManager wifiManager;
  wifiManager.setConfigPortalTimeout(120); 
  wifiManager.setTimeout(20);
  wifiManager.autoConnect('XXXX');
  Serial.println("Connected to Wifi");
}

void loop() {
 if (WiFi.status() != WL_CONNECTED) {
  WiFiManager wifiManager;
  wifiManager.setConfigPortalTimeout(120); 
  wifiManager.setTimeout(20);
  wifiManager.autoConnect('XXXX');
  Serial.println("Connected to Wifi");
 }else{
   // do the online stuff
 }
}

Debug Messages

*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 1
*WM:
*WM: Configuring access point...
*WM: XXXXXXXX
*WM: AP IP address:
*WM: 192.168.4.1
*WM: HTTP server started
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM:
*WM: Configuring access point...
*WM: XXXXXXXX
*WM: AP IP address:
*WM: 192.168.4.1
*WM: HTTP server started

Originally created by @Gregauriz on GitHub (Sep 20, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/738 ### Basic Infos Wifi is idle if no wifi was able to connect during setup #### Hardware **WiFimanager Branch/Release:** Master **Esp8266/Esp32:** ESP8266 **Hardware: ESP-12e, esp01, esp25** - [X] ESP12 E/F/S (nodemcu, wemos, feather) **ESP Core Version: 2.4.0, staging** staging (master/dev) ### Description If during the setup (where the autoconnect is) no wifi is available or no setup made on the portal, there is no way to connect to any wifi in the loop, the only solution would be to reset the all ship. The problem is that once you are in the loop the wifi is idle so impossible to connect even if the settings saved are good. So this could be an issue for example your board start faster then your wifi router after an electricity drop... I tried to add a simple `WiFi.begin();` did not work, I tried to add a autoconnect, not better.. I also try to put everything in the loop and nothing in the setup, not good either... I guess the pb is that during the loop the wifi is idle so the reconnect with saved setting doesn't work. The best would be to be able to just send a reconnect (with setting saved) in case off lost connection during the loop. Beside that you did an amazing job and I love your lib ! Well done ! ### Settings in IDE Module: NodeMcu ### Sketch ``` #include <Arduino.h> void setup() { WiFiManager wifiManager; wifiManager.setConfigPortalTimeout(120); wifiManager.setTimeout(20); wifiManager.autoConnect('XXXX'); Serial.println("Connected to Wifi"); } void loop() { if (WiFi.status() != WL_CONNECTED) { WiFiManager wifiManager; wifiManager.setConfigPortalTimeout(120); wifiManager.setTimeout(20); wifiManager.autoConnect('XXXX'); Serial.println("Connected to Wifi"); }else{ // do the online stuff } } ``` ### Debug Messages *WM: *WM: AutoConnect *WM: Connecting as wifi client... *WM: Using last saved values, should be faster *WM: Connection result: *WM: 1 *WM: *WM: Configuring access point... *WM: XXXXXXXX *WM: AP IP address: *WM: 192.168.4.1 *WM: HTTP server started *WM: *WM: AutoConnect *WM: Connecting as wifi client... *WM: Using last saved values, should be faster *WM: Connection result: *WM: **0** *WM: *WM: Configuring access point... *WM: XXXXXXXX *WM: AP IP address: *WM: 192.168.4.1 *WM: HTTP server started
kerem 2026-02-28 01:26:14 +03:00
  • closed this issue
  • added the
    duplicate
    label
Author
Owner

@tablatronix commented on GitHub (Sep 21, 2018):

#706

<!-- gh-comment-id:423601588 --> @tablatronix commented on GitHub (Sep 21, 2018): #706
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#617
No description provided.