[GH-ISSUE #881] How to re-connect Wifi in Loop function? if wifi is in sleep mode then how to connect saved network??? #744

Open
opened 2026-02-28 01:26:51 +03:00 by kerem · 8 comments
Owner

Originally created by @Urenthummar on GitHub (May 5, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/881

PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed.

POST SERIAL OUTPUT !

Issues without basic info will be ignored or closed!

Please fill the info fields, it helps to get you faster support ;)

if you have a stack dump decode it:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst

for better debug messages:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst

----------------------------- Remove above -----------------------------

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

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

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

Problem description

Settings in IDE

Module: NodeMcu, Wemos D1

Additional libraries:

Sketch


#include <Arduino.h>

void setup() {

}

void loop() {

}

Debug Messages

messages here
Originally created by @Urenthummar on GitHub (May 5, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/881 ## PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed. ## ## POST SERIAL OUTPUT ! Issues without basic info will be ignored or closed! Please fill the info fields, it helps to get you faster support ;) if you have a stack dump decode it: https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst for better debug messages: https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst ----------------------------- Remove above ----------------------------- ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [x] Master - [ ] Development **Esp8266/Esp32:** - [x] ESP8266 - [ ] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [x] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [ ] 2.4.0 - [ ] staging (master/dev) ### Description Problem description ### Settings in IDE Module: NodeMcu, Wemos D1 Additional libraries: ### Sketch ```cpp #include <Arduino.h> void setup() { } void loop() { } ``` ### Debug Messages ``` messages here ```
Author
Owner

@tablatronix commented on GitHub (May 6, 2019):

WiFi.begin()
This is standard esp stuff not WM

<!-- gh-comment-id:489604272 --> @tablatronix commented on GitHub (May 6, 2019): WiFi.begin() This is standard esp stuff not WM
Author
Owner

@Urenthummar commented on GitHub (May 6, 2019):

Wifi.begin();
not working, i'm using it in function to wake nodemcu & connect to Wifi network.
here is my code......

void wifiConnect() {
WiFi.forceSleepWake();
WiFi.mode(WIFI_STA);
delay(10);
WiFi.begin();
Serial.print("Connecting to ");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

<!-- gh-comment-id:489674925 --> @Urenthummar commented on GitHub (May 6, 2019): Wifi.begin(); not working, i'm using it in function to wake nodemcu & connect to Wifi network. here is my code...... void wifiConnect() { WiFi.forceSleepWake(); WiFi.mode(WIFI_STA); delay(10); WiFi.begin(); Serial.print("Connecting to "); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); }
Author
Owner

@Daemach commented on GitHub (May 6, 2019):

How can WiFi Manager turn into a complete wifi management solution? In a
perfect world it would combine the best of wifimulti and wifi manager, and
hit the following bullet points:

  • Attempt to connect to (potentially multiple) networks with provided
    credentials
  • If that fails, attempt to connect to available open APs
  • If that fails, launch wifiManager
  • Or launch wifiManager on demand if a button is pressed.
  • In sleep mode, or if wifi is lost for some reason, the system should
    try to reconnect in this order every time.

On Mon, May 6, 2019 at 9:01 AM Urenthummar notifications@github.com wrote:

Wifi.begin();
not working, i'm using it in function to wake nodemcu & connect to Wifi
network.
void wifiConnect() {
WiFi.forceSleepWake();
WiFi.mode(WIFI_STA);
delay(10);
WiFi.begin();
Serial.print("Connecting to ");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489674925,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC7Y5YOIF75XGPKWL7WISTDPUBI4RANCNFSM4HK27DDA
.

<!-- gh-comment-id:489681341 --> @Daemach commented on GitHub (May 6, 2019): How can WiFi Manager turn into a complete wifi management solution? In a perfect world it would combine the best of wifimulti and wifi manager, and hit the following bullet points: - Attempt to connect to (potentially multiple) networks with provided credentials - If that fails, attempt to connect to available open APs - If that fails, launch wifiManager - Or launch wifiManager on demand if a button is pressed. - In sleep mode, or if wifi is lost for some reason, the system should try to reconnect in this order every time. On Mon, May 6, 2019 at 9:01 AM Urenthummar <notifications@github.com> wrote: > Wifi.begin(); > not working, i'm using it in function to wake nodemcu & connect to Wifi > network. > void wifiConnect() { > WiFi.forceSleepWake(); > WiFi.mode(WIFI_STA); > delay(10); > WiFi.begin(); > Serial.print("Connecting to "); > while (WiFi.status() != WL_CONNECTED) { > delay(500); > Serial.print("."); > } > Serial.println(); > Serial.println("WiFi connected"); > Serial.println("IP address: "); > Serial.println(WiFi.localIP()); > } > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489674925>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AC7Y5YOIF75XGPKWL7WISTDPUBI4RANCNFSM4HK27DDA> > . >
Author
Owner

@tablatronix commented on GitHub (May 6, 2019):

well the esp auto connects on its own already, so if thats not working something else is wrong with your board, try erasing flash and reload

I imagine very few people need wifi multi or auto connect to open, but there is no reason it needs to be in wm , it is easy to code those functions.

<!-- gh-comment-id:489705069 --> @tablatronix commented on GitHub (May 6, 2019): well the esp auto connects on its own already, so if thats not working something else is wrong with your board, try erasing flash and reload I imagine very few people need wifi multi or auto connect to open, but there is no reason it needs to be in wm , it is easy to code those functions.
Author
Owner

@Daemach commented on GitHub (May 6, 2019):

Would wifimulti conflict with the connection attempt that wifimanager is
trying to do?

On Mon, May 6, 2019 at 10:31 AM Shawn A notifications@github.com wrote:

well the esp auto connects on its own already, so if thats not working
something else is wrong with your board, try erasing flash and reload

I imagine very few people need wifi multi or auto connect to open, but
there is no reason it needs to be in wm , it is easy to code those
functions.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489705069,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC7Y5YIVM345VQG4GUIG3RLPUBTOFANCNFSM4HK27DDA
.

<!-- gh-comment-id:489716681 --> @Daemach commented on GitHub (May 6, 2019): Would wifimulti conflict with the connection attempt that wifimanager is trying to do? On Mon, May 6, 2019 at 10:31 AM Shawn A <notifications@github.com> wrote: > well the esp auto connects on its own already, so if thats not working > something else is wrong with your board, try erasing flash and reload > > I imagine very few people need wifi multi or auto connect to open, but > there is no reason it needs to be in wm , it is easy to code those > functions. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489705069>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AC7Y5YIVM345VQG4GUIG3RLPUBTOFANCNFSM4HK27DDA> > . >
Author
Owner

@tablatronix commented on GitHub (May 6, 2019):

if you call autoconnect after already connected then it just exits

<!-- gh-comment-id:489724243 --> @tablatronix commented on GitHub (May 6, 2019): if you call autoconnect after already connected then it just exits
Author
Owner

@Daemach commented on GitHub (May 6, 2019):

Will it unload the webserver completely? I'm using the ESP32 with
asyncwebserver - a far more advanced and capable webserver that can support
mulltiple clients, websockets, etc. They both want to bind to port 80 so I
need to make sure wifimanager doesn't conflict.

On Mon, May 6, 2019 at 11:26 AM Shawn A notifications@github.com wrote:

if you call autoconnect after already connected then it just exits


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489724243,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC7Y5YI23QYNDXUO75WL22TPUBZ4TANCNFSM4HK27DDA
.

<!-- gh-comment-id:489726335 --> @Daemach commented on GitHub (May 6, 2019): Will it unload the webserver completely? I'm using the ESP32 with asyncwebserver - a far more advanced and capable webserver that can support mulltiple clients, websockets, etc. They both want to bind to port 80 so I need to make sure wifimanager doesn't conflict. On Mon, May 6, 2019 at 11:26 AM Shawn A <notifications@github.com> wrote: > if you call autoconnect after already connected then it just exits > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/881#issuecomment-489724243>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AC7Y5YI23QYNDXUO75WL22TPUBZ4TANCNFSM4HK27DDA> > . >
Author
Owner

@tablatronix commented on GitHub (May 6, 2019):

you are probably going to have issues, either with webserver or dns server, I would not suggest it

<!-- gh-comment-id:489726825 --> @tablatronix commented on GitHub (May 6, 2019): you are probably going to have issues, either with webserver or dns server, I would not suggest it
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#744
No description provided.