Skip to content
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

Confirm successful WiFi provisioning via SoftAP #67

Open
benrudhart opened this issue May 9, 2023 · 5 comments
Open

Confirm successful WiFi provisioning via SoftAP #67

benrudhart opened this issue May 9, 2023 · 5 comments

Comments

@benrudhart
Copy link

Description

When using espDevice.provision(ssid: ssid, passPhrase: passphrase) { status in } as described in the Readme there is no callback I could find that would report a success.
Once my device uses the provided credentials it kills the SoftAP (I'm provisioning via WiFi). Hence I don't get any feedback.
Is this expected or do I miss something?

To Reproduce
Steps to reproduce the behavior:

  • create an ESPDevice and provision wifi credentials
  • wait until success is reported (which should be done via pulling of wifi status, which is the last step in espDevice.provision

Frequency
Every time

Expected behavior
There is a way to differentiate between success/ failure when doing WiFi provisioning

ESP Device Information:

  • ESP-IDF version: [e.g. 4.0]
  • Example referenced: [e.g. wifi_prov_mgr]
  • Board type: [e.g. ESP-32]

iOS information:

  • Device type: [e.g. iPhone/iPad]
    • iPhone
  • Device model: [e.g. iPhone 7]
    • iPhone 14
  • iOS version: [e.g. iOS8.1]
    • 16
  • App Version: [e.g. v.2.0.8]
    • used the SDK

Provisioning information:

  • ESPProvision iOS SDK version: [e.g. 2.0.8] (if applicable)
    • 2.1.0
  • Device type: [e.g. SoftAP/ BLE]
    • SoftAP
  • Security: [e.g. Secure/Unsecure]
    • Sec1
@benrudhart benrudhart changed the title How to confirm if WiFi provisioning was successful Confirm successful WiFi provisioning via SoftAP May 9, 2023
@vikas-chandra-mnnit
Copy link
Contributor

Hi @benrudhart, provision API sends information on success, failure, and when WI-FI configuration is applied successfully on the device.

For more detailed usage of this API, kindly refer to the ESPProvisionSample app within the repository:

espDevice.provision(ssid: ssid, passPhrase: passphrase) { status in
.

@benrudhart
Copy link
Author

Thanks, I tried this with the provided ESPProvisionSample.
Results: The app shows a failure in the Step "Confirming Wi-Fi connection." : "Unable to fetch Wi-Fi state. See screenshot:
IMG_5A063FFDA8B9-1

I debugged this and was able to observe the following:
The error is caught in line 85 in the file you provided. The App also logs this error to console:
finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."
To me it appears that the App is no longer connected to the SoftAP (since the device now connected to the WiFi which I asked it to provision). I guess this is kind of expected behavior of the device, though the App shows an error.
Therefore I get back to my initial question: Is it possible to confirm (via the SDK) that the device properly connected to the provided WiFi?

@vikas-chandra-mnnit
Copy link
Contributor

Hi @benrudhart this error is coming from the device. The device is giving an error when we are trying to fetch the status after applying the Wi-Fi configuration. Can you please send us the device detail logs using the debug mode?

Additionally, you can try placing the device near the router while provisioning or try with different Wi-Fi networks to ensure that it is not related to a poor network signal.

@shahpiyushv
Copy link
Collaborator

@benrudhart ESP chips have 2 interfaces, station and softAP, but a single antenna. So, when the device receives the Wi-Fi network credentials, and tries connecting to the target AP using the station interface, the softAP channel also switches to the target APs channel. While this channel switches, some phones have a tendency to immediately disconnect and reconnect to some other saved network. Since the connection has dropped, the phone cannot query the status and so the failure is seen. In our experience, this happens mostly with Android phones though, not with iOS. Moreover, this issue occurs only with SoftAP provisioning, not BLE.

I am not sure if this is indeed the issue here, but could be possible.

@benrudhart
Copy link
Author

For me it happened on iOS, and yes - I was using SoftAP. Unfortunately I'm unable to provide device detail logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants