[GH-ISSUE #1076] Changing ssid & password programatically for use by autoConnect() #916

Closed
opened 2026-02-28 01:27:40 +03:00 by kerem · 3 comments
Owner

Originally created by @jg1xmv on GitHub (Jun 8, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1076

When originally connecting I entered a ssid and password via the AP which is then stored in memory by the library for the next start.

How can I change to some new ssid & pw in memory before triggering autoconnect so that it connects to those and not to the originally saved ssid & pw when I first entered those via the AP mode?

I have tried using WiFi.begin(ssidnet,pwnet), where ssidnet & pwnet are the new ones I saved.

It works when using a fixed ip by doing the following:
wifiManager.setSTAStaticIPConfig(fixed ip details here);
WiFi.mode(WIFI_STA);
WiFi.begin(ssidnet, pwnet);

Somehow though, using WiFi.begin(ssidnet, pwnet) before autoconnect() does not seem to make it go and fetch the new ssid & pw I saved but the original ones to which I connected via the AP first time around.

I am wondering of there is a way to make autoConnect() fetch the new ssidnet & pwnet i/o the original ones.

Thanks.

Originally created by @jg1xmv on GitHub (Jun 8, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1076 When originally connecting I entered a ssid and password via the AP which is then stored in memory by the library for the next start. How can I change to some new ssid & pw in memory before triggering autoconnect so that it connects to those and not to the originally saved ssid & pw when I first entered those via the AP mode? I have tried using WiFi.begin(ssidnet,pwnet), where ssidnet & pwnet are the new ones I saved. It works when using a fixed ip by doing the following: wifiManager.setSTAStaticIPConfig(fixed ip details here); WiFi.mode(WIFI_STA); WiFi.begin(ssidnet, pwnet); Somehow though, using WiFi.begin(ssidnet, pwnet) before autoconnect() does not seem to make it go and fetch the new ssid & pw I saved but the original ones to which I connected via the AP first time around. I am wondering of there is a way to make autoConnect() fetch the new ssidnet & pwnet i/o the original ones. Thanks.
kerem closed this issue 2026-02-28 01:27:40 +03:00
Author
Owner

@tablatronix commented on GitHub (Jun 8, 2020):

WiFi.begin(ssidnet, pwnet); should work, we do not save those that is all esp code.
Maybe add a connect loop

<!-- gh-comment-id:640597924 --> @tablatronix commented on GitHub (Jun 8, 2020): WiFi.begin(ssidnet, pwnet); should work, we do not save those that is all esp code. Maybe add a connect loop
Author
Owner

@jg1xmv commented on GitHub (Jun 9, 2020):

Yes, in a way once the ssid and pw are saved I do not need the AP anymore and can just call WiFi.begin instead of autoConnect.

I'll add a check to verify if credentials are already saved and then either use autoConnect to use the AP or WiFi.begin with the previously saved credentials otherwise.

Thanks.

<!-- gh-comment-id:641018422 --> @jg1xmv commented on GitHub (Jun 9, 2020): Yes, in a way once the ssid and pw are saved I do not need the AP anymore and can just call WiFi.begin instead of autoConnect. I'll add a check to verify if credentials are already saved and then either use autoConnect to use the AP or WiFi.begin with the previously saved credentials otherwise. Thanks.
Author
Owner

@tablatronix commented on GitHub (Jun 9, 2020):

Well either way, that is all autoconnect does. anyway , it just calls begin, the esp lib is what saves it

<!-- gh-comment-id:641025323 --> @tablatronix commented on GitHub (Jun 9, 2020): Well either way, that is all autoconnect does. anyway , it just calls begin, the esp lib is what saves it
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#916
No description provided.