-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXPERIMENTAL: Access Portal reporting back successful and unsuccessful connections #27
Open
Jeroen88
wants to merge
18
commits into
r-downing:master
Choose a base branch
from
Jeroen88:feature/report
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…s, e.g. for testing
Now the behavior of the client is as follows:
Some other changes:
|
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?