[GH-ISSUE #277] No static IP after ConfigPortal timed out #233

Closed
opened 2026-02-28 01:24:13 +03:00 by kerem · 0 comments
Owner

Originally created by @wewa00 on GitHub (Jan 6, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/277

Why does the ESP use no static IP configuration if the ConfigPortal timed out?

I used to modify the AutoConnectWithFSParametersAndCustomIP.ino-example so that the ConfigPortal shows on every startup and I also set a time out. Here are the changes I made.

--- AutoConnectWithFSParametersAndCustomIP.ino
+++ AutoConnectWithFSParametersAndCustomIP_MyVersion.ino
@@ -126,19 +126,19 @@
   //defaults to 8%
   wifiManager.setMinimumSignalQuality();
   
   //sets timeout until configuration portal gets turned off
   //useful to make it all retry or go to sleep
   //in seconds
-  //wifiManager.setTimeout(120);
+  wifiManager.setTimeout(120);
 
   //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", "password")) {
+  if (!wifiManager.startConfigPortal("AutoConnectAP", "password")) {
     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);
   }

I made a valid Configuration and connected to an AP over ConfigPortal settings. Then I restart the ESP (power off and on) and let the ConfigPortal time out. After timeout, the ESP connects to the AP (I configured the time before) and uses a dynamic IP.

Here is the serial output:

mounting FS...
mounted file system
reading config file
opened config file
{"mqtt_server":"myserver","mqtt_port":"8081","blynk_token":"YOUR_BLYNK_TOKEN1",}
                                                                               n
setting custom ip from config
192.168.0.22
192.168.0.22
YOUR_BLYNK_TOKEN1
myserver
*WM: Adding parameter
*WM: server
*WM: Adding parameter
*WM: port
*WM: Adding parameter
*WM: blynk
*WM: SET AP STA
*WM:
*WM: Configuring access point...
*WM: AutoConnectAP
*WM: password
*WM: AP IP address:
*WM: 192.168.4.1
*WM: HTTP server started
connected...yeey :)
local ip
192.168.0.119
192.168.0.1
255.255.255.0

Why is the ESP connecting after timeout and why is it using a dynamic ip instead of the configured static ip?

Originally created by @wewa00 on GitHub (Jan 6, 2017). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/277 Why does the ESP use no static IP configuration if the ConfigPortal timed out? I used to modify the AutoConnectWithFSParametersAndCustomIP.ino-example so that the ConfigPortal shows on every startup and I also set a time out. Here are the changes I made. ``` --- AutoConnectWithFSParametersAndCustomIP.ino +++ AutoConnectWithFSParametersAndCustomIP_MyVersion.ino @@ -126,19 +126,19 @@ //defaults to 8% wifiManager.setMinimumSignalQuality(); //sets timeout until configuration portal gets turned off //useful to make it all retry or go to sleep //in seconds - //wifiManager.setTimeout(120); + wifiManager.setTimeout(120); //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", "password")) { + if (!wifiManager.startConfigPortal("AutoConnectAP", "password")) { 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); } ``` I made a valid Configuration and connected to an AP over ConfigPortal settings. Then I restart the ESP (power off and on) and let the ConfigPortal time out. After timeout, the ESP connects to the AP (I configured the time before) and uses a dynamic IP. Here is the serial output: ``` mounting FS... mounted file system reading config file opened config file {"mqtt_server":"myserver","mqtt_port":"8081","blynk_token":"YOUR_BLYNK_TOKEN1",} n setting custom ip from config 192.168.0.22 192.168.0.22 YOUR_BLYNK_TOKEN1 myserver *WM: Adding parameter *WM: server *WM: Adding parameter *WM: port *WM: Adding parameter *WM: blynk *WM: SET AP STA *WM: *WM: Configuring access point... *WM: AutoConnectAP *WM: password *WM: AP IP address: *WM: 192.168.4.1 *WM: HTTP server started connected...yeey :) local ip 192.168.0.119 192.168.0.1 255.255.255.0 ``` Why is the ESP connecting after timeout and why is it using a dynamic ip instead of the configured static ip?
kerem closed this issue 2026-02-28 01:24:14 +03:00
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#233
No description provided.