[GH-ISSUE #1826] Question: proper use of autoConnect #1535

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

Originally created by @ChumKiu on GitHub (Jul 24, 2025).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1826

I'm using an ESP32 WROOM32 module, my system can be used away from the WiFi acces point so the connection can be lost, but after some time the module is again into the Access Point range and have to reconnect to the Access Point stored credentials automatically.
Now in my loop() method I handle the reconnection task in this way, but I'm not sure if this is the proper way:

// --------------------------------------------------
// WiFi connection monitor
// If WiFi is down try to reconnect
// --------------------------------------------------

curWiFiMillis = millis();
if ( (WiFi.status() != WL_CONNECTED) &&
(curWiFiMillis - prevWiFiMillis >= WiFiCheckInterval))
{
Serial.println("(Main) Reconnecting to WiFi...");
//WiFi.disconnect();
//WiFi.reconnect();
wm.autoConnect();
prevWiFiMillis = curWiFiMillis;
}

so the expected behavior should be when the Access Point is again available (module is again near the Access Point) the module should be reconnect in automatic way and then I should be able to reconnect it through websocket from the client code that is running on a Raspberry computer board linked to same SSID Wi-Fi network.

I'm using the autoConnect() feature in a proper way or I've to use another approach?

Thanks for clarification.
BR

Originally created by @ChumKiu on GitHub (Jul 24, 2025). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1826 I'm using an ESP32 WROOM32 module, my system can be used away from the WiFi acces point so the connection can be lost, but after some time the module is again into the Access Point range and have to reconnect to the Access Point stored credentials automatically. Now in my loop() method I handle the reconnection task in this way, but I'm not sure if this is the proper way: // -------------------------------------------------- // WiFi connection monitor // If WiFi is down try to reconnect // -------------------------------------------------- curWiFiMillis = millis(); if ( (WiFi.status() != WL_CONNECTED) && (curWiFiMillis - prevWiFiMillis >= WiFiCheckInterval)) { Serial.println("(Main) Reconnecting to WiFi..."); //WiFi.disconnect(); //WiFi.reconnect(); wm.autoConnect(); prevWiFiMillis = curWiFiMillis; } so the expected behavior should be when the Access Point is again available (module is again near the Access Point) the module should be reconnect in automatic way and then I should be able to reconnect it through websocket from the client code that is running on a Raspberry computer board linked to same SSID Wi-Fi network. I'm using the autoConnect() feature in a proper way or I've to use another approach? Thanks for clarification. BR
Author
Owner

@jimbo1969 commented on GitHub (Jan 31, 2026):

I have the same question, more-or-less. So I was hoping you found the answer and would share your knowledge. I've been reading the docs to try to figure out if it "checks" for the originally-configured WiFi availability (and reconnects to it) AFTER having previously given up on it and entered "AP mode" with all the captive portal stuff. I don't want a few minutes of downtime of my infrastructure WAP to result in this thing being kicked out until a knowledgeable human intervenes -- I want it to just go back to its already-configured WiFi settings, reconnect, and resume its tasks, so long as there is no client connected to it in AP mode.

<!-- gh-comment-id:3828117947 --> @jimbo1969 commented on GitHub (Jan 31, 2026): I have the same question, more-or-less. So I was hoping you found the answer and would share your knowledge. I've been reading the docs to try to figure out if it "checks" for the originally-configured WiFi availability (and reconnects to it) AFTER having previously given up on it and entered "AP mode" with all the captive portal stuff. I don't want a few minutes of downtime of my infrastructure WAP to result in this thing being kicked out until a knowledgeable human intervenes -- I want it to just go back to its already-configured WiFi settings, reconnect, and resume its tasks, so long as there is no client connected to it in AP mode.
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#1535
No description provided.