[GH-ISSUE #1687] setConfigPortalTimeout not timing out the portal bug? #1434

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

Originally created by @Halvhjearne on GitHub (Dec 7, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1687

idk if its just me doing it wrong or if this is a bug, but i noticed setConfigPortalTimeout will not work for me and the portal just keeps running, am i the only one with this problem?

i have not tried to figure out why (yet), but i tried making a custom timeout and that will close the portal, but without it, the portal will just keep running forever.

here is some relevant code, maybe i missed something:
(wifisetup is called in setup and open_portal is called when i need the portal)


void open_portal() {

  wifiManager.setConfigPortalTimeout(300);
  // wifiManager.setConfigPortalBlocking(false);
  wifiManager.setWebPortalClientCheck(true);
  wifiManager.startWebPortal();

  while (startPortal) {
    // if (!wifiManager.getWebPortalActive() || millis() - portalstarttime > PORTALTIMEOUT) startPortal = false;
    if (!wifiManager.getWebPortalActive()) startPortal = false;

    if (mqttclient.connected()) {mqttclient.loop();} else {mqttreconnect();}
    setGPIO();
    wifiManager.process();
  }
  wifiManager.stopWebPortal();
  mqttSendValues();

}

void wifisetup(){
  // Connect to Wi-Fi
  wifiManager.setDebugOutput(false);

  const char* menuhtml = "<form action='/settings' method='get'><button>Bulb setup</button></form><br/>\n";
  wifiManager.setCustomMenuHTML(menuhtml);

  wifiManager.setTitle("Bulb portal:");
  wifiManager.setDarkMode(true); // invert theme, dark 
  wifiManager.setWebServerCallback(bindServerCallback);
  wifiManager.setConfigResetCallback(handleReset);
  wifiManager.setPreOtaUpdateCallback(handleOTA);
  wifiManager.setWebPortalClientCheck(false);
  wifiManager.setScanDispPerc(true);       // show RSSI as percentage not graph icons
  std::vector<const char *> wm_menu = {"wifi","wifinoscan","sep","custom","sep","update","info","sep","restart","exit"};
  wifiManager.setMenu(wm_menu);

  wifiManager.setAPStaticIPConfig(IPAddress(4,3,2,1), IPAddress(4,3,2,1), IPAddress(255,255,255,0));
  wifiManager.setConfigPortalBlocking(false);
  // wifiManager.setConfigPortalTimeout(300);
  wifiManager.setWiFiAutoReconnect(true);
  wifiManager.setHostname(APNAME);
  if(!wifiManager.autoConnect(APNAME, APPASS)) {
    while(WiFi.status() != WL_CONNECTED){

      setGPIO();
      wifiManager.process();
    }
    rebootESP("WiFi Connected");
  }
}

Originally created by @Halvhjearne on GitHub (Dec 7, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1687 idk if its just me doing it wrong or if this is a bug, but i noticed setConfigPortalTimeout will not work for me and the portal just keeps running, am i the only one with this problem? i have not tried to figure out why (yet), but i tried making a custom timeout and that will close the portal, but without it, the portal will just keep running forever. here is some relevant code, maybe i missed something: (wifisetup is called in setup and open_portal is called when i need the portal) ``` void open_portal() { wifiManager.setConfigPortalTimeout(300); // wifiManager.setConfigPortalBlocking(false); wifiManager.setWebPortalClientCheck(true); wifiManager.startWebPortal(); while (startPortal) { // if (!wifiManager.getWebPortalActive() || millis() - portalstarttime > PORTALTIMEOUT) startPortal = false; if (!wifiManager.getWebPortalActive()) startPortal = false; if (mqttclient.connected()) {mqttclient.loop();} else {mqttreconnect();} setGPIO(); wifiManager.process(); } wifiManager.stopWebPortal(); mqttSendValues(); } void wifisetup(){ // Connect to Wi-Fi wifiManager.setDebugOutput(false); const char* menuhtml = "<form action='/settings' method='get'><button>Bulb setup</button></form><br/>\n"; wifiManager.setCustomMenuHTML(menuhtml); wifiManager.setTitle("Bulb portal:"); wifiManager.setDarkMode(true); // invert theme, dark wifiManager.setWebServerCallback(bindServerCallback); wifiManager.setConfigResetCallback(handleReset); wifiManager.setPreOtaUpdateCallback(handleOTA); wifiManager.setWebPortalClientCheck(false); wifiManager.setScanDispPerc(true); // show RSSI as percentage not graph icons std::vector<const char *> wm_menu = {"wifi","wifinoscan","sep","custom","sep","update","info","sep","restart","exit"}; wifiManager.setMenu(wm_menu); wifiManager.setAPStaticIPConfig(IPAddress(4,3,2,1), IPAddress(4,3,2,1), IPAddress(255,255,255,0)); wifiManager.setConfigPortalBlocking(false); // wifiManager.setConfigPortalTimeout(300); wifiManager.setWiFiAutoReconnect(true); wifiManager.setHostname(APNAME); if(!wifiManager.autoConnect(APNAME, APPASS)) { while(WiFi.status() != WL_CONNECTED){ setGPIO(); wifiManager.process(); } rebootESP("WiFi Connected"); } } ```
Author
Owner

@tablatronix commented on GitHub (Dec 8, 2023):

configportaltimeout does not work on webportal, nor non blocking I think.
There has been a request or 2 to enable it. I would have to find that issue and take a look

<!-- gh-comment-id:1847363546 --> @tablatronix commented on GitHub (Dec 8, 2023): configportaltimeout does not work on webportal, nor non blocking I think. There has been a request or 2 to enable it. I would have to find that issue and take a look
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#1434
No description provided.