mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 09:05:56 +03:00
[GH-ISSUE #1375] Auto toggle between Autoconnect and AP? #1179
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1179
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Abhesheksh on GitHub (Mar 23, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1375
Basic Infos
Hardware
WiFimanager Branch/Release: Master
Esp8266/Esp32: ESP8266
Hardware: ESP-12e, esp01, esp25
ESP12E
Core Version: 2.4.0, staging
Description
In my case, the internet connection can go off for as long as 30-60 minutes, sometimes even more. Right now, after failing to connect, the ESP goes to AP mode and remains in AP mode forever. However, I would like it to change between AP mode and Autoconnect mode every 5-10 minutes. This is my relevant code right now below. What values should I use in setConfigPortalTimeout & setConnectTimeout to implement this?
WiFi.mode(WIFI_STA);
wifiManager.setConfigPortalTimeout(300);
wifiManager.setConnectTimeout(600);
wifiManager.setWiFiAPHidden(false);
//wifiManager.setSTAStaticIPConfig(IPAddress(192, 168, 1, 99), IPAddress(192, 168, 1, 1), IPAddress(255, 255, 255, 0));
wifiManager.autoConnect("ESP_WIFI_AP");
if (wifiManager.autoConnect("ESP_WIFI_AP") == true)
{
Serial.println("Conneted to Internet");
ticker.detach();
digitalWrite(LED, LOW);
}
else
{
Serial.println("Connection Lost");
send_email();
}
Settings in IDE
Module: NodeMcu, Wemos D1
NodeMCU
Additional libraries:
#include <Ticker.h>
#include <ESP8266WiFi.h>
#include "ESP8266Ping.h"
#include <WiFiManager.h>
#include <EasyButton.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
@Abhesheksh commented on GitHub (Mar 23, 2022):
So basically, when wifi credentials are saved in the ESP but the saved network is switched off, it tries to autoconnect for a while but then goes to AP mode forever despite setting wifiManager.setConfigPortalTimeout(300) to 5 minutes. How do I make the ESP come back from AP mode and try connecting to the wifi network again?
@tablatronix commented on GitHub (Mar 23, 2022):
It should close the cp after 300 seconds, do you have logs?
@Abhesheksh commented on GitHub (Mar 24, 2022):
I think its working now when I check it over Serial on NodeMCU. I will run the program on the actual PCB again and check.