mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #595] OnDemandWebPortal example missing information on what happens when NOT in config mode? #496
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#496
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 @schweini on GitHub (Apr 19, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/595
Maybe I'm being denser than usual, but neither the examples for the on-demand config portals or the documentation as such explain what happens if the user is NOT in config mode.
I need to try to connect to the last successful network. If this doesn't work, then I only want to start the config mode when certain criteria are met (e.g. button press).
How am I supposed to connect to the last known working wifi network, and only start the config mode on failure?
I would try using the standard WiFi / WiFiMulti methods, but how can I pass them the last known SSID and password, gathered by WifiManger?
@tablatronix commented on GitHub (Apr 20, 2018):
besides using the standard code wifi.status() == wl_connected loop ?
What do you mean when not in config mode ?
the esp automatically connects to the last network by itself, you dont need wm to do that, but you CAN call autoconnect() if you wanted to and with the configportal disabled, you can manually handle it however you want, or you can manually restart it whatever
How familiar are you with the actual esp library itself ?
you should know you can just call WiFi.begin() to reconnect
@schweini commented on GitHub (Apr 20, 2018):
Thanks for your quick reply!
Ideally, I'd like to use WifiMulti (seems to be the standard way of manually connecting nowadays?) to connect to some Wifi networks. Only if there is none of the predefined networks available, I'd like to use WifiManger to start the Config Portal, and configure the connection details using the web interface.
What I don't understand is how I can get the ESP32 to 'know' when it has been configured using WifiManager, and use this information instead of WifiMulti afterwards?
In pseudo-code, I guess what I'm looking for is how to do this:
@tablatronix commented on GitHub (Apr 20, 2018):
Wifi multi is for connecting to mutiple aps, and it only stores the last successful one to flash, so its not really the greatest thing,unless you are actually connecting to mutiple aps.
The connection status is the return value of autoconnect.
There is no way to differentiate what saved the ssid in memory though.
@schweini commented on GitHub (Apr 20, 2018):
But even I were not to use WifiMulti and just regular Wifi.begin(), how can I tell wifiManger to attempt to connect using its stored credentials, and if unsuccessful, return control to my program, so that I can decide when to call startConfigPortal()?
As far as I can see, I only have the option of calling autoConnect() (which attempts the connection, and starts the Config Portal if unsuccessful), or to not connect at all, and start the Config Portal manually.
Because of you mention of ....
Oooops. Just re-read your other comment, and the mention of Wifi.begin() without arguments. Will try that!
@tablatronix commented on GitHub (Apr 20, 2018):
Are you using development branch?
@tablatronix commented on GitHub (Apr 20, 2018):
If so
wm.setEnableConfigPortal(false)before calling autoconnect