Wi-Fi Prov API: Use Wi-Fi in custom endpoint possible?

TobiasUhmann
Posts: 9
Joined: Mon Nov 27, 2023 8:11 am

Wi-Fi Prov API: Use Wi-Fi in custom endpoint possible?

Postby TobiasUhmann » Thu Apr 04, 2024 11:54 am

I am using the Wi-Fi provisioning API, including a custom endpoint, to provision Wi-Fi credentials and the address of a cloud service my device shall connect to. I would like to verify that the device can connect to the cloud service before the provision service finishes and store the whole config (Wi-Fi credentials and cloud service address) only if the connection to the cloud service succeeds. Is this possible with the Wi-Fi provisioning API?

When using the Python provisioning client, it seems that the Wi-Fi provisioning API calls my custom endpoint before connecting to the provisioned access point:

1. Python client sends custom data
2. Custom endpoint runs on ESP (no Wi-Fi connection, yet)
3. Python client sends Wi-Fi credentials
4. ESP connects to Wi-Fi
5. Prov service ends and stores credentials if Wi-Fi connection succeeds

Can I achieve something like the following?

1. Prov client sends Wi-Fi credentials
2. ESP connects to Wi-Fi
3. Prov client sends custom data
4. Custom endpoint runs on ESP (Wi-Fi connection available). Test cloud connectivity.
5. Prov service ends and stores credentials if Wi-Fi connection and custom endpoint succeed

Thanks in advance!

TobiasUhmann
Posts: 9
Joined: Mon Nov 27, 2023 8:11 am

Re: Wi-Fi Prov API: Use Wi-Fi in custom endpoint possible?

Postby TobiasUhmann » Thu Apr 11, 2024 8:36 am

I think I finally found the solution. wifi_prov_mgr_disable_auto_stop() seems to support what I'm looking for:
Disable auto stopping of provisioning service upon completion.

By default, once provisioning is complete, the provisioning service is automatically stopped, and all endpoints (along with those registered by main application) are deactivated.

This API is useful in the case when main application wishes to close provisioning service only after it receives some protocomm command from the client side app. For example, after connecting to Wi-Fi, the device may want to connect to the cloud, and only once that is successfully, the device is said to be fully configured. But, then it is upto the main application to explicitly call wifi_prov_mgr_stop_provisioning() later when the device is fully configured and the provisioning service is no longer required.

Who is online

Users browsing this forum: Google [Bot] and 121 guests