ESPAsyncWiFiManager icon indicating copy to clipboard operation
ESPAsyncWiFiManager copied to clipboard

ESPAsyncWiFiManager forgets data after reboot

Open dansiebert opened this issue 3 years ago • 10 comments

I have the problem that the Wemos D1 mini (ESP8266) forgets the wifi data after every reboot. Usually the once entered data is saved. However, this only happens after updating Core in PlatformIO to [email protected]. If I switch back to [email protected], it works. Is it possible that with Core 3.0.0 there is a problem with the file system in the flash of the ESP8266? Is SPIFFS unsupported any more? I ask, because I think, that ESPAsyncWebServer uses SPIFFS. There are at least warning messages while compiling. And ESPAsyncWiFiManager uses ESPAsyncWebServer, right?

dansiebert avatar Jun 08 '21 14:06 dansiebert

Hello, i think i found the reason. It is a wanted modification in the 3.0.0 core https://github.com/esp8266/Arduino/pull/7902 Probably we should add back the WiFi.persistent(true) to get the previous behaviour. I think it should be enough to add this when the captive portal is enabled, not always (once credentials are stored, they can be used by a simple wifi.begin()) (i forgot: and also before the disconnect. Reference in the manual: https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html ) i'll give a try this evening.. bye!

MassiPi avatar Jun 09 '21 09:06 MassiPi

Yes, it seems it works. I took advantage of the callbacks: in the configModeCallback (since this is called upon connection fail) i enabled the persistency. in the setSaveConfigCallback (since this is called when the connection is estabilished) i disabled the persistency you also have to enable persistency right before the resetSettings

Suggestion for @dansiebert

  • include in the resetSettings function, just before the disconnect(true), a WiFi.persistent(true)
  • there is also a typo in the first page in the definition of the configModeCallback. The variable tipe should be AsyncWiFiManager, not WiFiManager, or you'll get a compile error

MassiPi avatar Jun 09 '21 11:06 MassiPi

forgets the wifi data after every reboot

For me it's ESP01-S. Same issue. ESP8266 3.0.0.

I tried what @MassiPi suggested. For me it doesn't work. If I am using esp8266 2.6.3 it does save credentials well. I

me-cooper avatar Jul 01 '21 19:07 me-cooper

with 3.0.0 they removed the default "persistent(true)", that's why it does not save credentials (or save them) between reboots i can only suggest you to add a WiFi.persistent(true) before every need to save (or delete) credentials. Or just try enabling it for everything, but it's definitely the solution Ciao

MassiPi avatar Jul 02 '21 07:07 MassiPi

I've got the same issue, but I'm confused about where the changes need to be made to correct the problem and persist the SSID/password

numericOverflow avatar Jul 21 '21 02:07 numericOverflow

in the example add

WiFi.persistent(true); just before AsyncWiFiManager wifiManager(&server,&dns);

and it persist the settings

mdwarby avatar Jul 25 '21 15:07 mdwarby

@dansiebert proposed solutions do work, were you able to test any of them ?

hmronline avatar Aug 02 '21 16:08 hmronline

I did not. I am not at home and don’t have a test setup.

alanswx avatar Aug 03 '21 12:08 alanswx

@dansiebert proposed solutions do work, were you able to test any of them ?

@hmronline, I added the line as suggested by @mdwarby you my code and it seems to work. I haven't tested too much, but had a chance last night to reflash and the WiFi connection persisted across several reboots.

numericOverflow avatar Aug 03 '21 12:08 numericOverflow

in the example add

WiFi.persistent(true); just before AsyncWiFiManager wifiManager(&server,&dns);

and it persist the settings

This solution work for me, many thanks!!

jmcastillejo avatar Jul 02 '22 17:07 jmcastillejo