Sub-Device Pairing

Last Updated on : 2023-05-22 06:38:27

Sub-device pairing can be initiated only when a gateway is online in the cloud, and the sub-device stays in the pairing state. This topic describes the process to pair a sub-device that is connected through a Zigbee gateway.

Pairing process

Sub-Device Pairing

Initialize pairing parameters

API description

TuyaGwSubDevActivatorBuilder builder = new TuyaGwSubDevActivatorBuilder()
		.setDevId(mDevId)
		.setTimeOut(timeout)
		.setListener(new ITuyaSmartActivatorListener() {

				@Override
				public void onError(String errorCode, String errorMsg) {

				}

				@Override
				public void onActiveSuccess(DeviceBean devResp) {

				}

				@Override
				public void onStep(String step, Object data) {

				}
			}
		));

Parameters

Parameter Description
mDevId The gateway ID.
timeout The timeout value of a pairing task. Default value: 100. Unit: seconds.

Call the pairing method

ITuyaActivator mTuyaGWSubActivator = TuyaHomeSdk.getActivatorInstance().newGwSubDevActivator(builder);
// Starts pairing.
mTuyaGWSubActivator.start();
// Stops pairing.
mTuyaGWSubActivator.stop();
// Destroys the pairing task.
mTuyaGWSubActivator.onDestory();