Device Pairing

Last Updated on : 2024-05-28 03:18:47download

This topic describes the device pairing feature that connects a smart device to a router or gateway. Taking the Wi-Fi EZ mode as an example, the SDK requests the pairing token from the cloud and then broadcasts the pairing information (Wi-Fi network’s SSID and password and the pairing token) through the app. Once the smart device receives the advertising packet, it will connect to the app and cloud for activation.

Pairing modes

The following pairing modes are available:

  • Wi-Fi device pairing

    • Wi-Fi Easy Connect mode (a.k.a. EZ mode)
    • Wi-Fi access point mode (a.k.a. AP mode)
  • Wired device pairing

  • Sub-device pairing

  • Scan the QR code on the device

  • Scan the QR code on the app

    Scanning the QR code on the app indicates smart cameras scan the QR code on the app for pairing. See Scan QR Code on App for details.

  • Bluetooth device pairing

    For more information about Bluetooth pairing, see Bluetooth Devices.

Terms

This section describes some terms related to device pairing. For more information, see Glossary.

Term Description
Wi-Fi device A smart device that uses a Tuya Wi-Fi module to connect to a router and interact with apps and the cloud.
Wi-Fi Easy Connect Also known as the EZ mode. How it works:
  1. The app encapsulates the pairing data into the specified section of an IEEE 802.11 packet and sends the packet to the network.
  2. The Wi-Fi module of a smart device runs in promiscuous mode and listens for and captures all packets over the network.
  3. The Wi-Fi module parses the captured packet to extract pairing information.
AP pairing Also known as the AP mode. A mobile phone acts as a station (STA) and connects to the AP of a smart device. Then, both devices establish a socket connection to exchange data through a designated port.
Scan QR code on app A camera device scans the QR code on the app to get the pairing data.
Wired device A device that connects to a router through an Ethernet cable, for example, a wired Zigbee gateway and a wired camera.
Sub-device A device that interacts with the app and the cloud through a gateway, for example, a Zigbee sub-device.
Zigbee Zigbee is a short-range, simple, low-power, low-data-rate, cost-efficient, and two-way wireless communication technology.
It applies to short-range, low-power, and low-rate data transfer between various electronic devices, periodic data transfer, intermittent data transfer, and data transfer at a longer interval.
Zigbee gateway The device that integrates the Zigbee coordinator and Wi-Fi features. It is used for Zigbee networking and data storage.
Zigbee sub-device A router or an end device on a Zigbee network. Each Zigbee sub-device forwards data, or responds to control commands.

Version compatibility

iOS 14

Starting from iOS 14, when users perform device pairing or control over a local area network (LAN), the local network privacy setting dialog box is triggered.

  • The app can send data to the LAN only after users tap Allow.
  • Otherwise, if users tap Don’t Allow, the app cannot access the LAN.

Currently, Apple does not provide APIs to process this privacy setting. We recommend that you guide users to allow the app to access LAN data when features that require a LAN connection cannot work. Specifically, go to Settings, choose Privacy > Local Network, and then allow the app to access the LAN.

iOS 13

Starting from iOS 13, if users do not allow the app to access location data, when the Wi-Fi feature is enabled, [ThingSmartActivator currentWifiSSID] cannot get a valid Wi-Fi service set identifier (SSID) or basic service set identifier (BSSID). In this case, iOS returns the following default values:

  • SSID: WLAN or Wi-Fi. WLAN is returned for users in mainland China.
  • BSSID: 00:00:00:00:00:00.

If the Wi-Fi feature cannot be used as expected, the following troubleshooting methods are recommended:

  1. Check whether the app can access location data.
  2. If the returned BSSID is 00:00:00:00:00:00, it is the default system value. Then, you can guide users to manually enter the Wi-Fi name.