Sub-Device Pairing

Last Updated on : 2026-01-30 02:29:58download

This topic describes the mode of pairing a sub-device. This type of device is connected to the Tuya IoT Cloud through a gateway such as a Zigbee gateway or Bluetooth gateway. Therefore, the pairing mode depends on a specific gateway that processes device activation and notifications.

API example for sub-device pairing

For more information, see Device Pairing.

Implement methods in the pairing listener

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.
    },
};

Create a sub-device pairing instance

const activatorBuilder = TSmartActivator.buildSubDeviceActivatorBuilder('Gateway Device ID', 120000, this.activatorListener);
this.activator = TSmartActivator.createActivator(activatorBuilder);

Start pairing

this.activator.startActive()

Stop pairing

this.activator.stopActive()