mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1752] Enhancement request : reconnect to AP when available, even if portal was started #1485
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#1485
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 @alka79 on GitHub (Jul 16, 2024).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1752
For static devices, most of the time, connection loss is due to AP reboot or power failure.
In that situation, you mostly just want to reconnect to the AP as soon as it is back online and avoid long timeouts.
My I suggest the following behaviour: (I am thinking non-blocking )
When portal is automatically started because of AP connection loss, run every N seconds a passive scan for APs in the background .
When the AP is available again and no-one is connected to the portal, close the portal and reconnect to AP immediately.
Hope you will consider,
@TheToymaker93 commented on GitHub (Nov 5, 2024):
@alka79 Did you figure out a way to get this working? I'm trying to achieve a similar thing and having no luck. Don't suppose you came up with a work-around?
@gpena208777 commented on GitHub (Nov 13, 2024):
Bumping this
@klasik16 commented on GitHub (Jan 3, 2025):
We all need this feture. in other case this lib cannot be used in serious projects.
@klasik16 commented on GitHub (Jan 3, 2025):
@tablatronix what about this?
@phelbas commented on GitHub (Apr 20, 2025):
This is a key usage problem with this library. If it cannot connect upon start up - for whatever transient reason! - and drops into config mode, the device becomes useless unless power cycled again.
@tablatronix commented on GitHub (Apr 20, 2025):
Setconfigportaltimeout
@alka79 commented on GitHub (Apr 20, 2025):
@tablatronix Sorry to raise this again. Setconfigportaltimeout exists for a while, it is not an appropriate solution. It is pretty obvious IMHO when you try to use it.
How long do you set Setconfigportaltimeout ?
Either you set a short delay (say 30 sec) to have a relative fast reconnect after connection loss. But then you only have 30sec windows to connect to the Portal when it is really required, ie not realistic in real life.
To be practical, you MUST set Setconfigportaltimeout to a reasonably long delay, at least a few minutes. And then you ALWAYS wait for that timeout.
This is what I meant by "without waiting for long timeout". I did not elaborate, thinking that you would get the point.
I iimplemented the logic in my code. It works fine:
I also added led blinking to visually indicate that SoftAP is open.
@tablatronix commented on GitHub (Apr 20, 2025):
Set it to 30 seconds and reboot. This was supposed to leverage esp autoreconnect. But it seems to be unreliable. I will see about this.
The proper workflow should be
User code logic, reboot counter, autoconnect loop for 60seconds etc. reboot and retry whatever.
Start cp
User loop check for wifi status changes or use wifi events, stop cp etc.
Not sure there is a surefire way to implement in library not user code. I will find issues with autoreconnect and see about doing automatic scan for ap callbacks or auto exit cp config
You can always use reconnecttimeout of 60 seconds and cp for 2 minutes