tuya-LOGO

tuya 20240517 Smart App SDK

tuya-20240517-Smart-App-SDK-PROCUVT-

This topic describes the Wi-Fi Easy Connect (EZ) or SmartConfig mode to pair devices. After a user connects a mobile phone to a router, the router broadcasts is used to communicate and pair the mobile phone with the device. It is easy-to-use, but has compatibility requirements for mobile phones and routers. The success rate is lower than that of hotspot or access point (AP) mode.

Pairing process

  1. Before pairing
    • Guide the user to reset the device to Wi-Fi EZ mode, typically identified by a fast-blinking Wi-Fi indicator.
    • Guide the user to connect their phone to a Wi-Fi network, usually a 2.4 GHz Wi-Fi network.
  2. Get pairing token and Wi-Fi network credentials
    • The app gets the pairing token by calling the method in the SDK.
    • The app gets the Wi-Fi network credentials (SSID and password) input by the user. The SSID can also be obtained through an API call.
  3. Start pairing
    The app calls the pairing method in the SDK to set the Wi-Fi network credentials (SSID and password) and the pairing token.
  4. Finish pairing
    The app receives a callback from the SDK and finishes the pairing process.

info
For iOS 14.5 and later, we recommend that you use the AP mode instead of the Wi-Fi EZ mode. The former trumps the latter when it comes to the following aspects:

  • Compared with the Wi-Fi EZ mode, the AP mode results in a higher success rate, optimal reliability, and fewer compatibility requirements for mobile phones and routers.
  • The app built with Xcode 12.5 cannot send the EZ pairing data packets from iPhone that runs iOS 14.5 or later. In this case, the permission com.apple. developer.networking.multicast must be enabled for the app. This permission must be approved by Apple before it can be enabled. As a temporary solution, you can use an earlier Xcode version, but the AP mode is still recommended.

Get a token

Before the Wi-Fi EZ pairing process, the SDK must get a pairing token from the cloud in the networked state. The token is valid for 10 minutes and expires immediately after the device is paired. A new token must be generated if the device needs to be paired again.

API description

tuya-20240517-Smart-App-SDK  (2)

Parameterstuya-20240517-Smart-App-SDK  (3)

Example

Objective-C: tuya-20240517-Smart-App-SDK  (4)Swifttuya-20240517-Smart-App-SDK  (5)

Callback of pairing delegate

For pairing in the Wi-Fi EZ mode, you only need to implement this delegate call-back method and handle the devices and errors in this method. When pairing is successful or fails (in case of pairing timeout or error), callbacks are made on this delegate.
API description tuya-20240517-Smart-App-SDK  (6)Parameters tuya-20240517-Smart-App-SDK  (7)

Start pairing

API description tuya-20240517-Smart-App-SDK  (8)

Parameters tuya-20240517-Smart-App-SDK  (9)

Example

Objective-C:tuya-20240517-Smart-App-SDK  (10)

Swift: tuya-20240517-Smart-App-SDK  (11)

 

Stop pairing

After the pairing process is started, the app continuously broadcasts the pairing data until a device is paired or the process times out. To allow users to cancel or com-plete pairing during the process, you must call the API method [ThingSmartActivator
stopConfigWiFi] to stop pairing.

API description
tuya-20240517-Smart-App-SDK  (12)Example
Objective-C: tuya-20240517-Smart-App-SDK  (13)Swift

tuya-20240517-Smart-App-SDK  (1)

 

FAQ

  • What is Wi-Fi EZ Mode?
    Wi-Fi EZ Mode is a method to pair devices using Wi-Fi Easy Connect or SmartConfig. It involves using a router to broadcast and pair a mobile phone with a device.
  • What is the validity period of a pairing token?
    The pairing token is valid for 10 minutes and expires immediately after the device is paired.
  • Can I use Wi-Fi EZ Mode on iOS 14.5 and later
    It is recommended to use AP mode instead of Wi-Fi EZ mode for iOS 14.5 and later due to better compatibility and success rate.

Documents / Resources

tuya 20240517 Smart App SDK [pdf] User Guide
20240517 Smart App SDK, 20240517, Smart App SDK, App SDK

References

Leave a comment

Your email address will not be published. Required fields are marked *