mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1394] Example on using wifimanager with deep sleep #1193
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#1193
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 @kargarisaac on GitHub (Apr 14, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1394
Hi,
Is there any simple esp32 example on how to use wifimanager with deep sleep? I have to configure wifi credentials after each deep sleep/wake up round. I couldn't find any example over the internet.
Thank you
@tablatronix commented on GitHub (Apr 14, 2022):
hmm perhaps try rebooting after save, wifi creds should be persistent.
do you have example code? I have not used it much or tested it
@gfaman commented on GitHub (Aug 14, 2022):
Hi,
I spent countless time to try to find a reconnection solution with WM after deep sleep or light sleep. It never reconnect by itself.
Read many comments, proposals. Seems it should be reconnected by itself but never in my case.
The first solution but not recommended by Tablatronix was to add a loop with wifiManager.autoConnect("ESP_AP", "12345678") after the sleep if Wifi not connected. It works sometimes but also it create self reset. Not reliable.
Finally, it seems I found a solution for light_sleep (need test on deep_sleep):
I didn t figure out yet which part makes the connection, the reconnect or the begin but definitively, the stop and start make the job.
Hope it is helping.
Laurent
@tablatronix commented on GitHub (Aug 14, 2022):
hmm i started a test somewhere and forgot about it, you definitely have to manually handle the wifi state, I know i found at least one bug in wm for this, I think i fixed it, but not in reconnect, only autoconnect
@gfaman commented on GitHub (Aug 15, 2022):
Thanks Shawn for your consideration. So far, that workaround is working. Only one reset during the night (after multiple tentatives for reconnection).
Honestly, I'm quite surprising that not many people discussed about this reconnection issue after sleep mode. Not sure it is only me and my particular case.
For sake of clarity, please find the workaround I'm using:
// delay(period * 1000);
delay(500);
uint16_t loop = 0;
if(WiFi.status() != WL_CONNECTED)
{
TRACE_WIFI_DISCONNECTED_SLEEP;
WiFi.reconnect();
delay(1000);
if(WiFi.status() != WL_CONNECTED)
{
WiFi.begin();
}
}
while(WiFi.status() != WL_CONNECTED)
{
Serial.println("Wifi disconnected. Need reconnect");
Serial.println("failed to connect and hit timeout");
delay(300);
if(loop++ >= (31560))// 15 min
{
TRACE_WIFI_SLEEP;
ESP.restart();
delay(5000);
}
}
@gfaman commented on GitHub (Aug 17, 2022):
After few days on 2 different devices, results is soso. One device reset only one time per day. It is fine. But the other one, probably link to the Wifi router configuration, continuously reset after each light_sleep. Need fallback to delay() instead of light_sleep. No solution for that device. Only, before, by recall wifiManager.autoConnect after the sleep, it works sometimes.