Wired Device Pairing

Last Updated on : 2026-01-30 01:42:25download

A wired device connects to a router over an Ethernet cable. During the pairing process, users do not need to enter the name and password of the router.

Pairing process

  1. Before pairing. Guide the user to reset the device to activate pairing mode.
  2. Get a pairing token. The app gets the pairing token by calling the method in the SDK.
  3. Get the device information. The app gets the device information by calling the method in the SDK.
  4. Start pairing. The app calls the pairing method in the SDK to set the required parameters.
  5. Finish pairing. The app receives a callback from the SDK and finishes the pairing process.

API example for wired device pairing

For more information, see Device Pairing.

Device scanning over LAN

The SDK provides the capability to discover a wired device pending pairing. The device must be connected to the same network as the mobile phone to enable pairing. Device information is then obtained by implementing the TSmartScannerListener scanning listener.

Implement the scan result listener

 scanListener: TSmartScannerListener = {
    onDeviceFound: (scanResult: TSmartScannerResult): void => {
      // Implement the relevant logic.
    }
  };

Construct the scanner instance

// Create a scanner instance using the scan listener.
this.scanner = new TSmartScannerBuilder(this.scanListener);
// Set scan timeout and scan mode.
this.scanner.setScanTimeout(120000).addScanMode(TSmartScanMode.SCAN_MODE_LAN);

Start scanning

this.scanner.startScan();

Stop scanning

this.scanner.stopScan();

Pairing

Get a pairing token

// Get a token.
this.activatorToken = await TSmartActivatorRequester.getActivatorToken(this.homeId)

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 wired pairing instance

const activatorBuilder = TSmartActivator.buildWiredActivatorBuilder(
          this.homeId,
          gwId,
          productId,
          120 * 1000,
          this.activatorListener,
  		  this.activatorToken
        )
this.activator = TSmartActivator.createActivator(activatorBuilder);

Start pairing

this.activator.startActive()

Stop pairing

this.activator.stopActive()