Last Updated on : 2026-01-28 02:20:46download
This topic describes pairing a device using the Wi-Fi EZ mode, also known as Wi-Fi Easy Connect or SmartConfig. In the pairing process, a mobile phone connects to the router and broadcasts the Wi-Fi credentials and pairing token to enable the smart device to get this information for connection and pairing. It is easy-to-use, but has compatibility requirements for mobile phones and routers. The success rate is lower than that of AP mode.
Before pairing.
Get the pairing token and Wi-Fi network credentials.
Start pairing.
The app calls the pairing method in the SDK to set the Wi-Fi network credentials (SSID and password) and the pairing token.
Finish pairing.
The app receives a callback from the SDK and finishes the pairing process.
For more information, see Device Pairing.
// Get a token
this.activatorToken = await TSmartActivatorRequester.getActivatorToken(this.homeId)
activatorListener: ITSmartActivatorListener = {
onActiveSetpAndError: (step: TSmartActivatorStep, error?: Error, device?: TSmartDeviceModel) => {
// Implement the relevant logic.
},
onActiveSuccess: (deviceModel: TSmartDeviceModel) => {
// Handle the logic for successful pairing, such as updating the UI and navigating to the next page.
},
};
const activatorBuilder = TSmartActivator.buildEzActivatorBuilder(
this.ssid,
this.password,
120 * 1000,
this.activatorListener,
this.homeId,
)
this.activator = TSmartActivator.createActivator(activatorBuilder);
this.activator.startActive()
this.activator.stopActive()
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback