-
Notifications
You must be signed in to change notification settings - Fork 7.6k
BLE provisioning turns off after failed WiFi authentication #4139
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
Comments
This is currently a limitation of the underlying Wi-Fi provisioning component and the ESP IDF team is looking into how to handle it. Once the support is added there, it will be pulled into arduino |
Hello, |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
@zenius06 You are most likely not using the latest development version of arduino-esp32. Do not use the provided packages by espressif, rather simply use this repository's contents from its master branch. |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
It seems that the IDF may have some options for 'graceful handling' of bad credentials. See below:
I opted for option 2, by deleting credentials and restarting the device immediately if the credentials fail:
This solution works for handling incorrect credentials but I don't think it's viable for handling situation where router credentials are changed. Option 3 would be my preferred method. |
Hardware
Description:
Hello!
I am trying to provision my ESP32 device with the new unified provisioning API by using BLE and the dedicated Android application. To do so I am basing my code on the Arduino sketch WiFiProv.ino found in the arduino-esp32 repository.
After selecting the network on the Android application and setting the credentials, in the case the connection attempt fails (eg. when given credentials are wrong) the device cannot be detected anymore from the application home screen. It seems that after the failed attempt the device won't be reachable via BLE anymore, and I can't find a way through the given API to change this behaviour.
Digging a little bit under the hood, I found the function
wifi_prov_mgr_disable_auto_stop()
and I've built a customWiFiProvClass :: beginBLEProvision(wifi_prov_event_handler_t scheme_event_handler, wifi_prov_security_t security, const char * pop, const char *service_name, const char *service_key, uint8_t * uuid)
method which integrates it (and also which should allow to re-provision the device even when already provisioned, which is another thing I need). You can find the method here below:While with this it is possible to start the BLE provisioning operation even with WiFi credentials already present in NVS, it still doesn't solve the fact the device disappears from the Android application after a failed credentials attempt.
In a hacky attempt to solve the problem I event tried to deinit and reinit the WiFi provisioner after WIFI_PROV_CRED_FAIL events in
WiFiProv.cpp :: prov_event_handler()
, yet the firmware crashes and the backtrace fails to be decoded by EspExceptionDecoder.Maybe the arduino-esp32 devs have an idea on how this could be accomplished? Is it an inherent limitation of the provisioning manager?
Sketch:
WiFiProv.ino
WiFiProv.cpp (with added beginBLEProvision() method)
Debug Messages:
The text was updated successfully, but these errors were encountered: