mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #448] Programatically changing SSID & Password while connected? #379
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#379
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 @gjt211 on GitHub (Nov 3, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/448
I have been using this excellent library for some time now and would like to implement something that I can't find or work out a solution for.
I would like on rare occasions to change the SSID & password.
In my scenario, the ESP8266 is connected to an AP, and also to an MQTT server.
What I would like to do is send a new SSID and password, then have them stored wherever they need to go, then I can reboot the ESP8266 and it will connect to the newly stored AP.
I am not asking how to send the values, I can already do that. What I want to know is once I have the values in variables, how can I update the existing ones?
Can this be done?
@tablatronix commented on GitHub (Nov 3, 2017):
You can just call begin("ssid","password") using standard esp calls, and grab the ssid and password however you want, then esp.reset().
@gjt211 commented on GitHub (Nov 3, 2017):
@tablatronix, thanks for your response.
Maybe because I just woke up or I am not overly bright, I am having trouble understanding your answer.
Nowhere in my code is the call
begin("ssid","password")as WiFiManager handles all that for me. So I am a little confused about adding it.When you say "grab the ssid and password" doesn't help me, I (the ESP) already knows what the ssid & password are, but I want to change them.
There is a good chance I didn't explain my problem very well. I will try again...
As a bit of a fail-safe, my code will keep a copy of the original (AP1) ssid & password in eeprom along with a flag to say we have tried changing them. If the connect attempt to the new (AP2) fails, I will put the original (AP1) settings back and reconnect to that.
Thanks in advance.
@tablatronix commented on GitHub (Nov 4, 2017):
Wifimanager does not manage your sta it just calls begin using the esp stored creds
Begin saves them if persistent is true
So all you have to do it call begin with a2
And reboot
@tablatronix commented on GitHub (Nov 4, 2017):
Or do a wlconnected loop and fallback to old or use the multi capability built in to esp
@gjt211 commented on GitHub (Dec 6, 2017):
Just thought I would add an update to let everyone know I have this partially working.
I am using a different project, so currently I am receiving the new SSID & PSK via the UART interface.
I have a command interpreter that receives commands as follows (in the Arduino serial terminal);
I then execute the command
If this command is received, my device then runs the following code
The
rebootflag is tested in my main loop and runs my reboot function.The ESP8266 then reboots and attempts connection using the updated ssid/password.
FYI: My command interpreter stores the ssid and password in EEPROM using a struct. The struct contains other stuff as well, but thats where the
configuration.my_ssidandconfiguration.my_pskcome from.@skx commented on GitHub (Jan 8, 2018):
Thanks for the update @gjt211. Since it is now working for you would you mind closing the issue?
@tablatronix commented on GitHub (Dec 18, 2018):
Thats a pretty good idea, I like the uart way of setting default creds, very useful for programming as you do not need to do it everytime, you could also load from spiffs if no ssid set, and use spiffs upload to upload fs automatically ( at least with platformio )
Should I include an example for something like this?