ESPCDFProvisioningDevice
ESPCDFProvisioningDevice is an ephemeral handle for a device being onboarded over BLE, SoftAP, or on-network LAN. Use it during provisioning wizards — not for everyday control of nodes already in NodeStore.
Obtain it from ESPCDFUser.createProvisioningDevice or discovery flows in your adaptor. This entity has no OperationEventEmitter; methods call operations directly.
Properties
| Property | Type | Description |
|---|---|---|
name | string | User-visible device name |
transport | string | e.g. ble, softap |
security | number | Security scheme |
connected | optional | Session state |
capabilities | optional | Device capability strings |
operations | ESPCDFProvisioningDeviceOperations | SDK delegates |
_raw | optional | Native SDK device reference |
Common Workflows
Connect and provision over Wi-Fi
import { initCDF } from "@espressif/rainmaker-base-cdf";
const espCDF = await initCDF({ sdkAdaptorRegistry });
const user = espCDF.userStore.user!;
const provDevice = await user.createProvisioningDevice("My light", "ble");
await provDevice.connect();
await provDevice.setProofOfPossession("abcd1234");
await provDevice.initializeSession();
const networks = await provDevice.scanWifiList();
await provDevice.provision(
"MySSID",
"password",
(progress) => {
console.log(progress);
},
homeId,
);
Challenge-response (on-network) flow
const supports = await provDevice.checkChallengeResponseSupport();
const onNetwork = await provDevice.checkOnNetworkProvisioning();
if (onNetwork) {
await provDevice.initiateUserNodeMapping();
await provDevice.verifyUserNodeMapping({
/* ESPCDFChallengeResponseVerificationRequest */
} as any);
await provDevice.setNetworkCredentials("MySSID", "password");
}
Disconnect when done
await provDevice.disconnect();
After success, use user.addDevice or user.addOnNetworkDevice to fetch the new ESPCDFNode into stores.
Error Handling
try {
await provDevice.provision(ssid, password);
} catch (e) {
showErrorBanner("Provisioning failed — check POP and Wi-Fi");
} finally {
await provDevice.disconnect();
}
BLE vs on-network
| Flow | Typical checks |
|---|---|
| BLE / SoftAP | connect → setProofOfPossession → provision |
| On-network (LAN) | checkOnNetworkProvisioning → mapping + credentials |
startAssistedClaiming and sendData are available when the adaptor implements them for claiming or custom endpoints.
Related Resource
- ESPCDFUser — discovery and
createProvisioningDevice - Getting started
- ESPCDFProvisioningDevice source
- API Reference: