User Guide for tuya models including: Device Pairing UI BizBundle, Pairing UI BizBundle, UI BizBundle, BizBundle
Device Pairing UI BizBundle-Smart App SDK-Tuya Developer
File Info : application/pdf, 11 Pages, 77.40KB
DocumentDocumentDevice Pairing UI BizBundle Version: 20250306 Online Version Contents Contents 1. Device types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Wi-Fi device pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. Zigbee device pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Bluetooth device pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.4. QR code pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.5. Matter device pairing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6. Pairing by auto discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Integrate with the UI BizBundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3. Configure features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1. Configure auto discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4. Make API requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.1. Open the pairing page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2. Open the QR code scanning page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 I 1Device types Device Pairing UI BizBundle is used to implement pairing guidance and smart device activation. It applies to multiple common types of smart devices, such as Wi-Fi devices, Zigbee devices, Bluetooth devices, and devices that support QR code scanning like GPRS & NB-smart devices. The UI BizBundle provides the service logic and UI encapsulation to guide pairing and activate smart devices over different protocols. 1 / 9 1. Device types 1Device types 1.1. Wi-Fi device pairing Wi-Fi smart devices can be paired and connected to cloud services in two modes: Wi-Fi Easy Connect (EZ) mode and access point (AP) or hotspot mode. IP cameras (IPCs) can be paired after QR code scanning. Term Wi-Fi EZ mode AP mode IPC pairing in QR code mode Description Also known as the EZ mode. This pairing mode is implemented through the following steps: · The app encapsulates the pairing data into the specified section of an IEEE 802.11 packet and sends the packet to the network. · The Wi-Fi module of a smart device runs in promiscuous mode and listens for and captures all packets over the network. · The Wi-Fi mode parses the packets that carry the pairing data from the app into the data format specified by the protocol. Also known as the hotspot mode. A mobile phone acts as a station (STA) and connects to the hotspot of a smart device. Then, both devices are paired to establish a socket connection between them and exchange data through the specified ports. An IPC scans the QR code on the app to get the pairing data. 2 / 9 1.2. Zigbee device pairing 2.2Integrate with the UI BizBundle Zigbee gateways and sub-devices can be paired. Term Zigbee gateway Zigbee sub-device Description The device that integrates the coordinator with Wi-Fi features on a Zigbee network. The gateway is responsible to formulate the Zigbee network and store data. A router or an end device on a Zigbee network. Each Zigbee sub-device is responsible to forward data, or respond to control commands. 1.3. Bluetooth device pairing Tuya provides the following Bluetooth solutions. Term Bluetooth Low Energy (LE) Bluetooth mesh Tuya mesh Combo devices Description A point-to-point connection is created between a Bluetooth or Bluetooth LE device and a mobile phone. Enable many-to-many (m:m) device communications over a mesh network released by Bluetooth Special Interest Group (SIG). This solution is also known as Bluetooth LE mesh. Tuya's proprietary technology that enables Bluetooth devices to communicate over a mesh network. The devices that support Bluetooth and Wi-Fi combo can be paired over either Bluetooth or Wi-Fi. 3 / 9 1.4. QR code pairing 2.4Integrate with the UI BizBundle A smart device that supports this pairing mode is connected to Tuya's cloud services immediately after power on. The app can be used to scan the QR code on the device to implement cloud-based device activation and binding. The QR code must comply with Tuya's QR code rules. For more information, contact Tuya's account manager. Term GPRS devices NB-smart devices Description Smart devices that apply GPRS technologies to connect to the network and access cloud services. Smart devices that apply NB-IoT technologies. 1.5. Matter device pairing If you want to use the Matter device pairing feature, see Prepare for Integration with Matter Device for initialization. 1.6. Pairing by auto discovery Tuya provides efficient pairing features on top of Tuya's generic pairing technologies for smart devices. 4 / 9 2.7Integrate with the UI BizBundle 2. Integrate with the UI BizBundle 1. Create a project. Integrate Smart Life App SDK for Android into your project with Android Studio and add the framework of the UI BizBundle to your project . 2. Configure the build.gradle file. 1 dependencies { api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:\ 2 ${ #link("https://developer.tuya.com/en/docs/app-development/integration?id=Ka8 qhzk13vkfq#title-6-Dependency%20sources")[biz_bom_version] }") 3 api "com.thingclips.smart:thingsmart-bizbundle-device_activator" \/\/ To implement the QR code scanning feature, depend on the BizBundle for 4 QR code scanning. 5 api "com.thingclips.smart:thingsmart-bizbundle-qrcode_mlkit" api "com.thingclips.smart:thingsmart:\${ #link("https://developer.tuya.com/ 6 en/docs/app-development/integration?id=Ka8qhzk13vkfq#title-6-Dependency%20 sources")[sdk_version] }}" 7} 3. Obfuscate the code. 1 #fastJson 2 -keep class com.alibaba.fastjson.**{*;} 3 -dontwarn com.alibaba.fastjson.** 4 5 #rx 6 -dontwarn rx.** 7 -keep class rx.** {*;} 8 -keep class io.reactivex.**{*;} 9 -dontwarn io.reactivex.** 10 -keep class rx.**{ *; } 11 -keep class rx.android.**{*;} 12 13 #fresco 14 -keep class com.facebook.drawee.backends.pipeline.Fresco 15 -keep @com.facebook.common.internal.DoNotStrip class * 16 -keepclassmembers class * { 17 @com.facebook.common.internal.DoNotStrip *; 18 } 19 20 #tuya 21 -keep class com.thingclips.**{*;} 22 -dontwarn com.thingclips.** 5 / 9 3. Configure features 3Configure features Configuration items Field name Description Hotspot name <string The prefix of a name="ap_mode_ssid">SmartLifdee</vice hotspot for settings string> pairing. Support for <bool Specifies whether name="is_need_ble_support">trBuelu<e/tooth devices Bluetooth devices bool> can be paired. Specifies whether Support for <bool Bluetooth mesh Bluetooth mnaemse=h"is_need_blemesh_support">true</ devices bool> devices can be paired. Specifies whether the app can be Support for QR <bool used to scan the name="is_scan_support">true</ code scanning bool> QR code on a device and start pairing. Specifies whether Whether the Wi-Fi smart devices that EZ mode is <bool support the EZ supportednabmye="is_config_activator_ez">false</ automatic bool> mode can be automatically discovery discovered. Default value SmartLife true true true false 3.1. Configure auto discovery Create a JSON file named activator_auto_search_capacity.json in the assets directory. Add the following code to this file. 1{ 2 //Specifies whether to support searching for sub-devices. 3 "searchTypeZigbee": false, 6 / 9 4.2Make API requests 4 //Specifies whether to support searching for Wi-Fi EZ devices. 5 "searchTypeEZ": true, 6 //Specifies whether to support searching for Pegasus devices. 7 "searchTypePegasus": false, 8 //Specifies whether to support searching for Bluetooth devices. 9 "searchTypeBle": false, 10 //Specifies whether to support searching for wired devices. 11 "searchTypeWired": false, 12 //Specifies whether to support searching for Matter devices. 13 "searchTypeMatter": false 14 } 7 / 9 4. Make API requests 4.1. Open the pairing page 4.2Make API requests 1 ThingDeviceActivatorManager.INSTANCE.startDeviceActiveAction(this); 2 ThingDeviceActivatorManager.INSTANCE.addListener(new 3 IThingDeviceActiveListener() { 4 5 @Override 6 public void onDevicesAdd(List<String> list) { 7 8 } 9 10 @Override 11 public void onRoomDataUpdate() { 12 13 } 14 15 @Override 16 public void onOpenDevicePanel(String s) { 17 18 } 19 20 }); Request parameters Parameter activity homeId Response parameters Parameter devIds updateRoomData onOpenDevicePanel onExitConfigBiz Description The pairing activity. The home ID. For more information, see Home Information Management . Description The success callback. A list of paired device IDs is returned. Indicates whether room device details are updated. Indicates whether a certain panel can be opened. You can implement this feature as needed. Indicates whether to exit the pairing service if pairing is not performed. You can implement this feature as needed. 8 / 9 4.2. Open the QR code scanning page 1 ScanManager.INSTANCE.openScan(this); 9 / 9