mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1004] wifiManager.getWiFiPass() returns an empty string #854
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#854
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 @flavio-fernandes on GitHub (Feb 7, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1004
Using ESP32 version 1.0.4 on development branch.
After successful config, calling wifiManager.getWiFiPass(true) consistently returns
an empty string.
POST SERIAL OUTPUT !
Code:
Output:
if you have a stack dump decode it:
N/A
----------------------------- Remove above -----------------------------
Basic Infos
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
wifiManager.getWiFiPass(true); OR wifiManager.getWiFiPass(false);
are not returning the SSID password configured.
Settings in IDE
N/A
Additional libraries:
N/A
Sketch
See:
github.com/flavio-fernandes/persistWifiSetting@5ad667b862Debug Messages
N/A
@tablatronix commented on GitHub (Feb 7, 2020):
Are you calling this after wifi has been init? Or is connected?
@flavio-fernandes commented on GitHub (Feb 7, 2020):
Correct. I'm calling it after wifi manager portal was successful in configuring a
ssid with password.
Not sure if this is relevant here, but I'm NOT using
wifiManager.autoConnect();Instead I am using
wifiManager.startConfigPortal();only.@tablatronix commented on GitHub (Feb 7, 2020):
So you are checking this after saving or something?
Cause wifi does not start automatically on esp32
@flavio-fernandes commented on GitHub (Feb 7, 2020):
Yes. I invoke wifiManager.startConfigPortal() and procedd with configuring ssid and pass.
All goes well and the function returns as expected. Right after that, I attempt to get the
value of the ssid and the password configured. The ssid returns the right value, but the
password returns empty.
That is what I'm trying to show here:
github.com/flavio-fernandes/persistWifiSetting@5ad667b862 (diff-05a1eb158f)@gauix4 commented on GitHub (Feb 7, 2020):
@flavio-fernandes @tablatronix
add to wifimanager.ccp
here you have the return of ssid and password
@tablatronix commented on GitHub (Feb 7, 2020):
No clue it works for me
Ill probably need more info, like is it actually connecting?
@flavio-fernandes commented on GitHub (Feb 7, 2020):
Thanks for trying. Yes, it connects fine and it works as well for me. BUT....
If you call
wifiManager.getWiFiPass(false);I''m assuming that you wouldexpect to see
12345678but you may get an empty string. Can you confirm?@flavio-fernandes commented on GitHub (Feb 8, 2020):
Thank you @gauix4 , what you mentioned here worked for me!
I made these 2 changes to try out what you proposed:
github.com/flavio-fernandes/persistWifiSetting@2729af0d35github.com/flavio-fernandes/WiFiManager@497364330fAnd the function returned the password configured! Note I did not have any issues with
the ssid, just the password.
So I don't really know what to do from here, as it seems that the password I expected is just not what it is implemented.
What do you propose? Is this a legit bug? I am okay closing it if that is not important enough.
@tablatronix commented on GitHub (Feb 8, 2020):
I did not test with false, but false does nothing for esp32
@tablatronix commented on GitHub (Feb 8, 2020):
psk() is literally the same exact code in wm
@tablatronix commented on GitHub (Feb 8, 2020):
hmm
@tablatronix commented on GitHub (Feb 8, 2020):
wifimanager restores the wifi mode that it was at in your sketch, Your mode is WIFI_OFF
if you call autoconnect we change this automatically, you are not calling it. You will need to set a mode in your sketch in setup, as esp32 does not automatically do this like esp8266. Also as in wm v.0 as it was buggy and clobbered your settings. development now works properly with persistent and will let you go back to your previous "current" wifi settings(non persistent)
Now there might still be a bug, have you tried restarting and then starting wifi or just starting wifi after saving ? and see if it was stored, if its persistent it should then work, unless there is a bug causing saves to not be persistent, but there is not that I know of
@flavio-fernandes commented on GitHub (Feb 8, 2020):
No. Sorry for the confusion. In my case
_passis not "" so psk() is not used at all.What makes it work is the fact the value I was expecting was stored in _pass.
Make sense?
github.com/flavio-fernandes/WiFiManager@497364330f (diff-bfe0a2d15d)@tablatronix commented on GitHub (Feb 8, 2020):
That is just a variable, not the saved password
@gauix4 commented on GitHub (Feb 8, 2020):
@flavio-fernandes can you drop your code here i take a look and test
@gauix4 commented on GitHub (Feb 8, 2020):
arduino code:
Serial.print(_ssid);
Serial.print(_pass);
@gauix4 commented on GitHub (Feb 8, 2020):
add in .ccp
void WiFiManager::handleWifiSave() {
DEBUG_WM(F("WiFi save"));
//SAVE/connect here
_ssid = server->arg("s").c_str();
_pass = server->arg("p").c_str();
DEBUG_WM (_ssid);
DEBUG_WM (_pass);
@flavio-fernandes commented on GitHub (Feb 8, 2020):
hello @gauix4 . My code is here:
https://github.com/flavio-fernandes/persistWifiSetting
You can look at branch issueWifiPass for how I reproduce it.
I am good dealing with this issue now, thanks to your help and @tablatronix .
Much appreciated.
@hayderismael commented on GitHub (Feb 12, 2021):
I have added these lines into .h and .cpp but I got this error
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
I just need to get the SSID and Password after connecting to the access point, so I can get them from serial print. It will be so so helpful