EXPERIMENTAL: Access Portal reporting back successful and unsuccessful connections#27
Open
Jeroen88 wants to merge 18 commits intor-downing:masterfrom
Open
EXPERIMENTAL: Access Portal reporting back successful and unsuccessful connections#27Jeroen88 wants to merge 18 commits intor-downing:masterfrom
Jeroen88 wants to merge 18 commits intor-downing:masterfrom
Conversation
added 18 commits
January 30, 2019 17:25
…s, e.g. for testing
Contributor
Author
|
Now the behavior of the client is as follows:
Some other changes:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EXPERIMENTAL features to report back the status of the connection. If e.g. a false password is entered, this is reported back to the portal page, so the user can correct his failure without having to reconnect. Also a successful connection is reported back.
Attention: not tested on an ESP8266 yet, only on a ESP32 (although I do not expect too many issues)
To try this you should:
This will take you to the modfied AP portal.
If this works, comment this line in setup():
persWM.resetSettings();Beause calling resetSettings() will clear any previously entered WiFi credentials. If you do not call this, the WiFi credentials are saved in non volatile memory. If the library can connect to a previously configured WiFi network it will not show the portal at all!
After a successful connection to a WiFi network is made, the ESP32 / ESP8266 will remain in dual mode (STA and AP). You can close the AP by calling PersWiFiManager::closeAp(), or, from the browser, do a GET at wifi/closeap.
Reporting the status of the WiFi connection back to the browser client is done with a json at wifi/report. This JSON has more data than only the connection status:
{ connection: true or false, SSID: the SSID of the WiFi network the ESP32 / ESP8266 is connected to (if connection == true), APSSID: the SSID of the ESP32 / ESP8266 itself, if in AP mode, IP: the IP address assigned to the ESP32 / ESP8266, if connected to a WiFi network }Attention: connection: is always present, the other fields may be undefined
I am still somewhat unsatisfied with leaving the AP mode activated after connecting to a WiFi network, but:
So for now I leave it up to you when to close the AP, maybe after some 5 minutes?