mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #918] Storing SSID, IP #775
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#775
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 @esp8 on GitHub (Jul 30, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/918
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
I am playing with example AutoConnectWithStaticIP.ino . I changed only IP address. The problem is with storing parameters . When I try to save new ssid informations, It seems that the parameters are not written in to the memory.
Example AutoConnect.ino works OK. If I upload AutoConnectWithStaticIP.ino after storing ssid and password with AutoConnect.ino example (and not erase the memory) than esp connects to my network, but the parameters are fixed. It is not possible to change values. On the log output it is all normal. Any idea?
Debug Messages
@tablatronix commented on GitHub (Jul 30, 2019):
parameters are not stored anywhere, you have to save them yourself.
@esp8 commented on GitHub (Jul 31, 2019):
hmm.
In example AutoConnect.ino when I am in AP mode and save SSID and password, these parameters are stored somewhere, because after cycling power esp connects to network.
If i do the same with AutoConnectWithStaticIP.ino SSID and password is lost.
I tried on 3 nodemcu v1.0 and the situation is always the same.
@tablatronix commented on GitHub (Jul 31, 2019):
oh ok, hmm well esp does the saving for wifi creds, might be something wrong with those examples, you tested both on the same hardware? Sometimes flash needs to be erased as it gets corrupted.
I will take a look.
@wvsbsp commented on GitHub (Aug 11, 2019):
I'm currently developing a project, where i am saving SSID, password, mqtt-server and topic into a config-file in the SPIFFS. I had the problem of getting the SSID and Password out of the WifiManager.
My solution to this was to edit the wifimanager.cpp, Lines 350 ff.
Here two getter-functions are commented out, which are String WiFiManager::getSSID() and String WiFiManager::getPassword().
Also the if-clause mae problems, so my getter-function just looks like this:
String WiFiManager::getSSID() {/*if (_ssid == "") {DEBUG_WM(F("Reading SSID"));_ssid = WiFi.SSID(); <<<<=== this seems to be a problem in the original codeDEBUG_WM(F("SSID: "));DEBUG_WM(_ssid);}*/return _ssid;}Then add the prototypes in wifimanager.h and you're done. In my project i'm reading the custom values and SSID and password like this:
strcpy(mqtt_server, custom_mqtt_server.getValue());strcpy(mqtt_port, custom_mqtt_port.getValue());strcpy(mqtt_topic, custom_mqtt_topic.getValue());// SSID and Passwort from WifiManagerString sTemp=wifiManager.getSSID();if(sTemp != "") strcpy(ssid, sTemp.c_str()); // don't overwrite with empty stingsTemp=wifiManager.getPassword();if(sTemp != "") strcpy(pass, sTemp.c_str()); // don't overwrite with empty stingSerial.println("New values: ");Serial.println(ssid);Serial.println(pass);Serial.println(mqtt_server);Serial.println(mqtt_topic);// save configuration in SPIFFSsaveConfig();I would like to see the getter-functions reactivated in the next version of WifiManager (which is a superb library!)
Edit: unfortunately, code formatting doesn't work properly, no new lines :-(
@tablatronix commented on GitHub (Aug 11, 2019):
The esp already provides these
@wvsbsp commented on GitHub (Aug 11, 2019):
what do you mean? I'm currently using WifiManager Version 0.14.0 and i had to remove the comment and add prototypes to make the getter-functions working. Is it meant to be like that or is there a newer version of WifiManager with those functions enabled?
Or do you mean the ESP is storing the Wifi-credentials? In my case, i want to have a system where i can control and save the AP the system is connecting to when WifiManager is not involved. In that case i need some source to fill the values for ssid and password before calling
WiFi.begin(ssid, pass);The board should only connect with one network, but that has to be configurable. After reset, i'm waiting for a button-press to start the wifiManager. If the button is not pressed, the system has to connect to the SSID that was previousely configured and saved in wifiManager.
@tablatronix commented on GitHub (Aug 12, 2019):
the ESP stores credentials itself, wifimanager does not handle it.
looks in development branch, i added a helper getter
@tablatronix commented on GitHub (Aug 12, 2019):
https://github.com/tzapu/WiFiManager/issues/887
connectWifipublic method #1679