Last Updated on : 2024-06-24 09:15:53download
Sub-device pairing can be initiated only when a gateway is online in the cloud, and the sub-device stays in pairing mode. This topic describes how to pair a sub-device, using the Zigbee sub-device as an example.
Example
ThingGwSubDevActivatorBuilder builder = new ThingGwSubDevActivatorBuilder()
.setDevId(mDevId)
.setTimeOut(timeout)
.setListener(new IThingSmartActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
}
@Override
public void onStep(String step, Object data) {
}
}
));
Parameter description
Parameter | Description |
---|---|
mDevId | The ID of the gateway. |
timeout | The pairing timeout, defaulting to 100 , in seconds. |
IThingActivator mTuyaGWSubActivator = ThingOSActivator.deviceActivator().newGwSubDevActivator(builder);
// Start pairing
mTuyaGWSubActivator.start();
// Stop pairing
mTuyaGWSubActivator.stop();
// Destroy
mTuyaGWSubActivator.onDestory();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback