[GH-ISSUE #740] Need to fill SSID second time in WebPortal #618

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

Originally created by @dontsovcmc on GitHub (Sep 23, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/740

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Development

Esp8266/Esp32:

  • ESP8266

Hardware: ESP-12e, esp01, esp25

  • ESP01

1.8.0 version of https://github.com/platformio/platform-espressif8266

Description

Run WebPortal and ESP connects to router successful.
ESP connects to router after deep sleep.
Run WebPortal (see SSID name in field) and didn't select SSID, password fields. Change only custom parameters. Press OK.

Debug Messages

*WM: [2] -------------------- 
*WM: [3] Sent wifi save page 
*WM: [2] process connect 
*WM: [2] No ssid, skipping wifi 
*WM: [3] WIFI station disconnect 
*WM: [3] WiFi station enable 
*WM: [2] Disabling STA 
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_DISCONNECTED
*WM: [2] WiFi Scan ASYNC started 
*WM: [2] Portal Timeout In 299 seconds
*WM: [2] WiFi Scan ASYNC completed in 2187 ms
*WM: [2] WiFi Scan ASYNC found: 8
*WM: [2] Portal Timeout In 269 seconds
*WM: [2] <- HTTP WiFi save  
*WM: [3] Method: POST
*WM: [2] Parameters 
*WM: [2] -------------------- 

Source

I had a lot of additional code and little ESP code.

void loop() {
   
    if (setup) {   
        WiFiManager wm;
        wm.setConfigPortalTimeout(300);
        wm.setConnectTimeout(15);
        wm.startConfigPortal( AP_NAME );
    } 
    else {  
       WiFi.begin();  
       //do smth
    }
    ESP.deepSleep(0, RF_DEFAULT);
}

Additional news:

  1. branch: hotfix, development
    If I set this
        WiFi.persistent(false);  
        WiFi.disconnect(); 
        WiFi.mode(WIFI_AP);         
        WiFi.persistent(true);

before wm.startConfigPortal( AP_NAME ):
Run ESP startConfigPortal, refill saved SSID, password, push OK.
ESP doesn't connect to router, that has been already connected before.

  1. branch: development
    If router turn off ESP connecting failed after timeout correctly.

  2. branch: development
    Cyrillic labels shows nice in ConfigPortal.

Idea about Integration tests:

I see a lot of Issues with abnormal behaviour in different modes, routers and some other stuff...
Maybe it possible to create Python/Bash script and ESP test sketch to preserve regression bugs in depending libraries and helps users to check their routers & code?

I think, we can turn on wi-fi active point in linux PC by command line commands, we can talk with ESP by Serial and check it states.

Originally created by @dontsovcmc on GitHub (Sep 23, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/740 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [x] Development **Esp8266/Esp32:** - [X] ESP8266 **Hardware: ESP-12e, esp01, esp25** - [X] ESP01 1.8.0 version of https://github.com/platformio/platform-espressif8266 ### Description Run WebPortal and ESP connects to router successful. ESP connects to router after deep sleep. Run WebPortal (see SSID name in field) and didn't select SSID, password fields. Change only custom parameters. Press OK. ### Debug Messages ``` *WM: [2] -------------------- *WM: [3] Sent wifi save page *WM: [2] process connect *WM: [2] No ssid, skipping wifi *WM: [3] WIFI station disconnect *WM: [3] WiFi station enable *WM: [2] Disabling STA *WM: [3] -> captive.apple.com *WM: [2] <- Request redirected to captive portal *WM: [2] <- HTTP Root *WM: [3] -> 192.168.4.1 *WM: [3] lastconxresult: WL_DISCONNECTED *WM: [2] WiFi Scan ASYNC started *WM: [2] Portal Timeout In 299 seconds *WM: [2] WiFi Scan ASYNC completed in 2187 ms *WM: [2] WiFi Scan ASYNC found: 8 *WM: [2] Portal Timeout In 269 seconds *WM: [2] <- HTTP WiFi save *WM: [3] Method: POST *WM: [2] Parameters *WM: [2] -------------------- ``` ### Source I had a lot of additional code and little ESP code. ``` void loop() { if (setup) { WiFiManager wm; wm.setConfigPortalTimeout(300); wm.setConnectTimeout(15); wm.startConfigPortal( AP_NAME ); } else { WiFi.begin(); //do smth } ESP.deepSleep(0, RF_DEFAULT); } ``` ### Additional news: 1. branch: hotfix, development If I set this ``` WiFi.persistent(false); WiFi.disconnect(); WiFi.mode(WIFI_AP); WiFi.persistent(true); ``` before wm.startConfigPortal( AP_NAME ): Run ESP startConfigPortal, refill saved SSID, password, push OK. ESP *doesn't connect* to router, that has been already connected before. 2. branch: development If router turn off ESP connecting failed after timeout correctly. 3. branch: development Cyrillic labels shows nice in ConfigPortal. ### Idea about Integration tests: I see a lot of Issues with abnormal behaviour in different modes, routers and some other stuff... Maybe it possible to create Python/Bash script and ESP test sketch to preserve regression bugs in depending libraries and helps users to check their routers & code? I think, we can turn on wi-fi active point in linux PC by command line commands, we can talk with ESP by Serial and check it states.
kerem 2026-02-28 01:26:14 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tablatronix commented on GitHub (Sep 23, 2018):

What do you mean you need to refill, you mean it does not reconnect on save with ssid empty? I think this issue is confusing, I am not sure what you are inferring with the side notes also

<!-- gh-comment-id:423845333 --> @tablatronix commented on GitHub (Sep 23, 2018): What do you mean you need to refill, you mean it does not reconnect on save with ssid empty? I think this issue is confusing, I am not sure what you are inferring with the side notes also
Author
Owner

@dontsovcmc commented on GitHub (Sep 23, 2018):

If I don't write SSID when I open ConfigPortal, ESP doesn't connect. I think SSID&pwd are saved in memory and need not be filled every time when I open ConfigPortal...

If user should fill SSID every time in ConfigPortal, please don't show previous SSID name in the field.

<!-- gh-comment-id:423851531 --> @dontsovcmc commented on GitHub (Sep 23, 2018): If I don't write SSID when I open ConfigPortal, ESP doesn't connect. I think SSID&pwd are saved in memory and need not be filled every time when I open ConfigPortal... If user should fill SSID every time in ConfigPortal, please don't show previous SSID name in the field.
Author
Owner

@tablatronix commented on GitHub (Jan 31, 2019):

#782

<!-- gh-comment-id:459487845 --> @tablatronix commented on GitHub (Jan 31, 2019): #782
Author
Owner

@dontsovcmc commented on GitHub (Nov 27, 2019):

@tablatronix it's easy to fill down saved SSID & password to the input web form:

  pitem = FPSTR(HTTP_FORM_WIFI);
  pitem.replace(FPSTR(T_v), WiFi_SSID());  //move T_v from placeholder to value
  pitem.replace("{pwd}", WiFi_psk());  //add value='{pwd}' to template
placeholder='' value='{v}'>
type='password' placeholder='' value='{pwd}'

Now you can run Captive Portal for custom parameters changes without refilling SSID & pwd.
I can make pull request if this way ok. I don't know why it wasn't done before.

<!-- gh-comment-id:559273357 --> @dontsovcmc commented on GitHub (Nov 27, 2019): @tablatronix it's easy to fill down saved SSID & password to the input web form: ``` pitem = FPSTR(HTTP_FORM_WIFI); pitem.replace(FPSTR(T_v), WiFi_SSID()); //move T_v from placeholder to value pitem.replace("{pwd}", WiFi_psk()); //add value='{pwd}' to template ``` ``` placeholder='' value='{v}'> type='password' placeholder='' value='{pwd}' ``` Now you can run Captive Portal for custom parameters changes without refilling SSID & pwd. I can make pull request if this way ok. I don't know why it wasn't done before.
Author
Owner

@tablatronix commented on GitHub (Nov 27, 2019):

Is that not how it already works? What are you trying to solve?

<!-- gh-comment-id:559286304 --> @tablatronix commented on GitHub (Nov 27, 2019): Is that not how it already works? What are you trying to solve?
Author
Owner

@dontsovcmc commented on GitHub (Nov 28, 2019):

NO!
Now you should write down ssid & password every time you start ConfigPortal.
ESP won't connect: *WM: No ssid, skipping wifi

"Design is terrible". I don't know hidden ESP logic...
If SSID and password saved in ESP, we should show this fact to the user. Not in placeholder.

<!-- gh-comment-id:559296819 --> @dontsovcmc commented on GitHub (Nov 28, 2019): NO! Now you should write down ssid & password every time you start ConfigPortal. ESP won't connect: `*WM: No ssid, skipping wifi ` "Design is terrible". I don't know hidden ESP logic... If SSID and password saved in ESP, we should show this fact to the user. Not in placeholder.
Author
Owner

@tablatronix commented on GitHub (Nov 28, 2019):

What do you mean start configportal?
If they are empty it skips saving, also sending the password back to the web is a security risk

<!-- gh-comment-id:559311664 --> @tablatronix commented on GitHub (Nov 28, 2019): What do you mean start configportal? If they are empty it skips saving, also sending the password back to the web is a security risk
Author
Owner

@tablatronix commented on GitHub (Nov 28, 2019):

There is an issue for this I think already

<!-- gh-comment-id:559311741 --> @tablatronix commented on GitHub (Nov 28, 2019): There is an issue for this I think already
Author
Owner

@tablatronix commented on GitHub (Nov 28, 2019):

users are expected to know how esp works already and how it stores credentials.

<!-- gh-comment-id:559311949 --> @tablatronix commented on GitHub (Nov 28, 2019): users are expected to know how esp works already and how it stores credentials.
Author
Owner

@dontsovcmc commented on GitHub (Nov 28, 2019):

Hm.. about security I haven't think. Okey, we can send dots to interface value attribute. After Saved we call smth like this:

  1. if (strlen(pwd) == strlen(WiFi_psk()) && pwd.replace('.','').empty()) {
    pwd = WiFi_psk();
    }

  2. or: type='password' placeholder='password hidden' - so user see, that password already saved in ESP.
    After click: if (pwd.empty()) { pwd = WiFi_psk(); }

<!-- gh-comment-id:559460945 --> @dontsovcmc commented on GitHub (Nov 28, 2019): Hm.. about security I haven't think. Okey, we can send dots to interface value attribute. After Saved we call smth like this: 1. if (strlen(pwd) == strlen(WiFi_psk()) && pwd.replace('.','').empty()) { pwd = WiFi_psk(); } 2. or: type='password' placeholder='password hidden' - so user see, that password already saved in ESP. After click: if (pwd.empty()) { pwd = WiFi_psk(); }
Author
Owner

@tablatronix commented on GitHub (Nov 28, 2019):

I suggest stop using the wifi page to set parameters, and use the setup page now.

<!-- gh-comment-id:559567772 --> @tablatronix commented on GitHub (Nov 28, 2019): I suggest stop using the wifi page to set parameters, and use the setup page now.
Author
Owner

@dontsovcmc commented on GitHub (Nov 28, 2019):

I think it's overcode and avoiding the problem. We have a small UX task and you want to increase complexity of library...

<!-- gh-comment-id:559576411 --> @dontsovcmc commented on GitHub (Nov 28, 2019): I think it's overcode and avoiding the problem. We have a small UX task and you want to increase complexity of library...
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

#974

Are you talking to me? It already exists, just change the menu to show setup and it will automatically STOP using the WIFI page for params... This will probably be the default at some point, adding empty ssid checking was complex..

<!-- gh-comment-id:559899484 --> @tablatronix commented on GitHub (Nov 30, 2019): #974 Are you talking to me? It already exists, just change the menu to show setup and it will automatically STOP using the WIFI page for params... This will probably be the default at some point, adding empty ssid checking was complex..
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

@tablatronix hm..

  1. To show dots on the page is good.
  2. I said, that previously saved password doesnt' work. In #974 you fill placeholder, not value. POST request parameter will be empty and ESP won't connect.
<!-- gh-comment-id:559900256 --> @dontsovcmc commented on GitHub (Nov 30, 2019): @tablatronix hm.. 1. To show dots on the page is good. 2. I said, that previously saved password doesnt' work. In #974 you fill placeholder, not value. POST request parameter will be empty and ESP won't connect.
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

Connect to what?

<!-- gh-comment-id:559900588 --> @tablatronix commented on GitHub (Nov 30, 2019): Connect to what?
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

To previously configurated Wi-Fi.

NO!
Now you should write down ssid & password every time you start ConfigPortal.
ESP won't connect: *WM: No ssid, skipping wifi

ConfigPortal = /wifi?

<!-- gh-comment-id:559900839 --> @dontsovcmc commented on GitHub (Nov 30, 2019): To previously configurated Wi-Fi. > NO! > Now you should write down ssid & password every time you start ConfigPortal. > ESP won't connect: *WM: No ssid, skipping wifi ConfigPortal = /wifi?
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

When saving params?

<!-- gh-comment-id:559900931 --> @tablatronix commented on GitHub (Nov 30, 2019): When saving params?
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

Ok, step by step.

  1. First run startConfigPortal

  2. Fill SSID, Password, click Save

  3. Connect OK. Turn off device.

  4. Second time run startConfigPortal

  5. I see SSID in placeholder, nothing in Password. Click Save.

  6. Connect FAILED. I see *WM: No ssid, skipping wifi

<!-- gh-comment-id:559901154 --> @dontsovcmc commented on GitHub (Nov 30, 2019): Ok, step by step. 1. First run startConfigPortal 2. Fill SSID, Password, click Save 3. Connect OK. Turn off device. 4. Second time run startConfigPortal 5. I see SSID in placeholder, nothing in Password. Click Save. 6. Connect FAILED. I see `*WM: No ssid, skipping wifi`
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

Mine says its still connected, It never disconnects.

What settings are you using ?

<!-- gh-comment-id:559901256 --> @tablatronix commented on GitHub (Nov 30, 2019): Mine says its still connected, It never disconnects. What settings are you using ?
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

My device is autonomous, so I turn off power after startConfigPortal.
So, If I want to call startConfigPortal second time (after reboot) I should fill password.

p.s. Device connect to wi-fi successfully after reboot, here is no problem.

<!-- gh-comment-id:559901444 --> @dontsovcmc commented on GitHub (Nov 30, 2019): My device is autonomous, so I turn off power after startConfigPortal. So, If I want to call startConfigPortal second time (after reboot) I should fill password. p.s. Device connect to wi-fi successfully after reboot, here is no problem.
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

ok I see the problem

Saving Credentials
Trying to connect ESP to network.
If it fails reconnect to AP to try again

If // wm.setBreakAfterConfig(false); (default) and no wifi to save, the portal stays open.
The message above is wrong.

Ill make it a little better to understand.

If you want the portal to always close after save, use

wm.setBreakAfterConfig(true);

<!-- gh-comment-id:559901806 --> @tablatronix commented on GitHub (Nov 30, 2019): ok I see the problem > Saving Credentials > Trying to connect ESP to network. > If it fails reconnect to AP to try again If `// wm.setBreakAfterConfig(false); (default) `and no wifi to save, the portal stays open. The message above is wrong. Ill make it a little better to understand. If you want the portal to always close after save, use `wm.setBreakAfterConfig(true);`
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

I know, that if connect failed (wrong password) it's also stays open - it's okey.

See this example:
https://github.com/tzapu/WiFiManager/blob/development/examples/ParamsChildClass/ParamsChildClass.ino it's close to my sketch, but I turn off power in the loop.

So, If you run startConfigPortal second time, you should refill password.

<!-- gh-comment-id:559902361 --> @dontsovcmc commented on GitHub (Nov 30, 2019): I know, that if connect failed (wrong password) it's also stays open - it's okey. See this example: https://github.com/tzapu/WiFiManager/blob/development/examples/ParamsChildClass/ParamsChildClass.ino it's close to my sketch, but I turn off power in the loop. So, If you run startConfigPortal second time, you should refill password.
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

Yeah I need to fix this, setBreakAfterConfig used to do something different than what it said. So its confusing now. Commiting in a few minutes.

<!-- gh-comment-id:559902558 --> @tablatronix commented on GitHub (Nov 30, 2019): Yeah I need to fix this, setBreakAfterConfig used to do something different than what it said. So its confusing now. Commiting in a few minutes.
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

Great. For my opinion setShowPassword() is't needed.

<!-- gh-comment-id:559902671 --> @dontsovcmc commented on GitHub (Nov 30, 2019): Great. For my opinion setShowPassword() is't needed.
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

Using param saved page now, We will have to tweak that a bit, maybe auto redirect back to home, or add some more text or back and exit buttons etc

<!-- gh-comment-id:559902806 --> @tablatronix commented on GitHub (Nov 30, 2019): Using param saved page now, We will have to tweak that a bit, maybe auto redirect back to home, or add some more text or back and exit buttons etc
Author
Owner

@dontsovcmc commented on GitHub (Nov 30, 2019):

<!-- gh-comment-id:559903003 --> @dontsovcmc commented on GitHub (Nov 30, 2019): <deleted>
Author
Owner

@tablatronix commented on GitHub (Nov 30, 2019):

Closing this because its not really a bug,
Connect FAILED. I see *WM: No ssid, skipping wifi means skipping wifi connect, has nothing to do with wifi failing. wifi reconnects when you close the configportal

<!-- gh-comment-id:559905001 --> @tablatronix commented on GitHub (Nov 30, 2019): Closing this because its not really a bug, `Connect FAILED. I see *WM: No ssid, skipping wifi` means skipping wifi connect, has nothing to do with wifi failing. wifi reconnects when you close the configportal
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#618
No description provided.