ESPAsyncWiFiManager icon indicating copy to clipboard operation
ESPAsyncWiFiManager copied to clipboard

WM: No saved credentials

Open tueddy opened this issue 7 years ago • 8 comments

Hi,

i try to use your library together with ESPWebserver to replace the sync->async versions. Captive portal works fine, i can connect to my WIFI. But after hard resetting the AP is opened again, message is WM: No saved credentials.

As far as i see WiFi.SSID cannot be read if not connected. Credentials are saved but not accessable if Wifi.begin(); is not yet called.

Problem seems in ESPAsyncWiFiManager.cpp:

AsyncWiFiManager::connectWifi(String ssid, String pass); .. WiFi.SSID() is empty even if a connection was made before reset.

After making this changes the credentials are working fine: before (Line 530): DEBUG_WM("No saved credentials"); after: DEBUG_WM("Try to connect with saved credentials"); WiFi.begin();

I use latest ESP32 aduino github version 20. march 2018 and your library version 0.13

Best regards Dirk

tueddy avatar Mar 20 '18 20:03 tueddy

Does that work? Do you want to patch it? It has been a while since I pulled this together, I am a bit confused about what all the different states are.

alanswx avatar Mar 20 '18 21:03 alanswx

Hi Alan,

yes i've patched and it works (at least for me). Something must have been changed in handling saving ssid/password for arduino ESP-32. regards Dirk

tueddy avatar Mar 21 '18 09:03 tueddy

Can you submit a pull request and I will update it. Please update the version number too.

alanswx avatar Mar 22 '18 01:03 alanswx

Hello all, I patched the ESPAsyncWiFiManager.cpp with

boolean AsyncWiFiManager::autoConnect(char const *confName, char const *confPassword, char const *apName, char const *apPassword) { DEBUG_WM(F("")); DEBUG_WM(F("AutoConnect")); String ssid = confName; String pass = confPassword; WiFi.mode(WIFI_STA); if (connectWifi(ssid, confPassword) == WL_CONNECTED) { DEBUG_WM(F("IP Address:")); DEBUG_WM(WiFi.localIP()); //connected return true; } return startConfigPortal(apName, apPassword); }

Now I can use a SSID from a config file

wifiManager.autoConnect(config_WIFISSID, config_WifiPass., "ESP-AP", "123456789");

pa4th avatar Apr 12 '18 12:04 pa4th

Do you want to submit a pull request? Does that fix the other problem as well?

alanswx avatar Apr 14 '18 12:04 alanswx

I confirm the problem ... after hard resetting the AP is opened again... you can check in your example AutoConnectWithFSParametersAndCustomIP.ino

dmytro-nff avatar Apr 27 '18 08:04 dmytro-nff

Can someone submit a fix so I can merge it in? thanks!

alanswx avatar Apr 27 '18 22:04 alanswx

I dont know how to fix this, but what I do is write all WiFi settings to SPIFFs and read it back on startup and do a WiFi.begin with these value before starting AsyncWiFiManager. See: here. But a clear solution on the library front would be ideal. I can create a PR, but don't know what to change to get this to save after successful connect. If someone knows what to change let me know I will create a PR.

debsahu avatar May 02 '18 21:05 debsahu