Advertisement

Quick Links

Tuya mesh
Version: 20211129
Online Version

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the mesh and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for TUYA mesh

  • Page 1 Tuya mesh Version: 20211129 Online Version...
  • Page 2: Table Of Contents

    3.1 Product categories and types ....3.2 Mesh terms .......
  • Page 3 8.2 Control groups ......28 8.3 Listen for mesh device status ..... . 29...
  • Page 4 Contents Tuya supports the following three Bluetooth connectivity topology options: Blue- tooth Low Energy (Bluetooth LE), Tuya ’ s proprietary Bluetooth mesh connections (Tuya mesh), and Bluetooth mesh networking (Bluetooth mesh) provided by Blue- tooth Special Interest Group (Bluetooth SIG). This topic describes the development guidance on pairing, control, and management of devices that use Tuya mesh.
  • Page 5: Scenarios

    Before the development of Bluetooth mesh capabilities, get familiar with Smart Life App SDK. All Bluetooth mesh operations are implemented based on the initialized site data. A site can belong to multiple Bluetooth mesh networks, but one Bluetooth mesh network is recommended for each site.
  • Page 6: Preparation

    2 Preparation 2 Preparation • System requirements: Bluetooth connectivity requires Android 4.3 and later, and the Smart Life App SDK supports Android 4.4 and later. • Manifest permissions <uses permission android :name=" android . permission . ACCESS_COARSE_LOCA TION" /> <uses permission android :name="...
  • Page 7: Concepts

    • Sensors (04): contact sensors, passive infrared (PIR) sensors, and more • Actuators (10): devices used for actuation, such as motors and alarms • Adapters (08): gateways (adapters with Bluetooth mesh and other communi- cation nodes) • Product types of a category: •...
  • Page 8 Represents a mesh group in a 2-byte field. The field provides a unique LocalId identifier to distinguish each mesh group on a mesh network. To control a group device on the network, commands can be sent to the specified field value of the device. LocalId...
  • Page 9: Manage Mesh Networks

    4 Manage mesh networks 4 Manage mesh networks 4.1 Create a mesh network API description void createBlueMesh String meshName ITuyaResultCallback < BlueMeshBea n> callback Parameters Parameter Type Description meshName String The name of a mesh network, with up to 16 bytes.
  • Page 10: Query A List Of Mesh Networks In A Site

    @Override public void onError String errorCode String errorMsg @Override public void onSuccess () { 4.3 Query a list of mesh networks in a site API description List < BlueMeshBean > getMeshList Example ITuyaHome mTuyaHome TuyaHomeSdk newHomeInstance (" siteId "); mTuyaHome...
  • Page 11: Query A List Of Mesh Sub-Devices

    "). getMeshSubDevList 4.5 Query and destroy mesh instances We recommend that you destroy the current mesh instance and initialize the mesh instance for the target site when you switch between sites. API method // Initializes the mesh network .
  • Page 12 • Before a connection is started with , the API methods of startClient() startSearch are invalid. stopSearch() • After a mesh network is connected, the API methods of startSearch() are also invalid. ::: stopSearch() 9 / 31...
  • Page 13: Pair Devices

    5 Pair devices 5 Pair devices Mesh devices to be paired are classified into: • A common Bluetooth mesh device, also known as a mesh sub-device • A mesh gateway Common gateway sub-devices include smart lights, smart sockets, and low-power products.
  • Page 14: Scan For Sub-Devices Pending Pairing

    5 Pair devices 5.2 Scan for sub-devices pending pairing You must check Bluetooth and location permissions and then start scanning for mesh devices pending pairing. API description // Starts scanning . void startSearch // Stops scanning . void stopSearch Example...
  • Page 15 Wi-Fi network to which a paired device is connected. mMeshBean MeshBean MeshBean homeId Long The site to which the mesh network of the paired device belongs. version String The type of paired device. Valid values: to represent common mesh devices. to represent gateway devices.
  • Page 16: Pair A Mesh Gateway

    5 Pair devices // Pairs a common mesh device . TuyaBlueMeshActivatorBuilder tuyaBlueMeshActivatorBuilder new Tuya BlueMeshActivatorBuilder setSearchDeviceBeans foundDevices setVersion ("1.0") setBlueMeshBean mMeshBean setTimeOut timeOut setTuyaBlueMeshActivatorListener (new ITuyaBlueMeshActivatorListener () { @Override public void onSuccess DeviceBean deviceBean @Override public void onError String errorCode...
  • Page 17 Wi-Fi network to which a paired device is connected. mMeshBean MeshBean MeshBean homeId Long The site to which the mesh network of the paired device belongs. version String The type of paired device. Valid values: to represent common mesh devices. to represent gateway devices.
  • Page 18: Pairing Error Codes

    5 Pair devices // Pairs the gateway . TuyaBlueMeshActivatorBuilder tuyaBlueMeshActivatorBuilder new Tuya BlueMeshActivatorBuilder setWifiSsid (mSsid setWifiPassword mPassword setSearchDeviceBeans foundDevices setVersion ("2.2 ") setBlueMeshBean mMeshBean setHomeId (" siteId ") setTuyaBlueMeshActivatorListener (new ITuyaBlueMeshActivatorListener () { @Override public void onSuccess DeviceBean devBean // The callback that is used when a single device is paired .
  • Page 19 5 Pair devices Error code Description 13011 The pairing task timed out. 16 / 31...
  • Page 20: Manage Devices

    6.1 Check a mesh device type API method DeviceBean deviceBean TuyaHomeSdk getDataInstance getDeviceBean (mD evId); // Checks whether a Bluetooth mesh device is a gateway or a sub -devi deviceBean isBlueMesh ()){ L.d(TAG "This device is blue mesh device ");...
  • Page 21: Connect To A Mesh Network And A Gateway

    () { @Override public void onError String code String errorMsg @Override public void onSuccess () { 6.3 Connect to a mesh network and a gateway Example DeviceBean deviceBean TuyaHomeSdk getDataInstance getDeviceBean (mD evId); DeviceBean gwBean TuyaHomeSdk getDataInstance getDeviceBean device Bean. getParentId ());...
  • Page 22 6 Manage devices Parameters 19 / 31...
  • Page 23: Query Sub-Device Status

    6 Manage devices Parameter Type Description devId String The device ID. String The category and type of the device. callback IResultCallback The callback. Example mTuyaBlueMesh removeMeshSubDev devBean getDevId () , new IResultCallba @Override public void onError String code String errorMsg Toast makeText (mContext "...
  • Page 24 6 Manage devices Parameter Type Description String The category and type of the device. nodeId String The value of for the nodeId device. callback IResultCallback The callback. Example mTuyaBlueMeshDevice querySubDevStatusByLocal devBean getCategory () , devBean getNodeId () , new IResultCallback () { @Override public...
  • Page 25: Manage Groups

    L.d(TAG "This group is a Bluetooth mesh group "); 7.2 Create a group Each mesh network supports up to 28,672 groups. In the response to group creation, the group ID ranges from in hexadecimal and can be locally maintained. 8000...
  • Page 26: Add Sub-Devices To A Group

    7 Manage groups Parameter Description localId The value of for the group. Valid localId values: in hexadecimal. 8000 EFFF callback The callback. Example mITuyaBlueMesh addGroup (" Group name"," Category and type", "8001", w IAddGroupCallback () { @Override public void String String onError errorCode...
  • Page 27: Remove Sub-Devices From A Group

    7 Manage groups ITuyaGroup mGroup TuyaHomeSdk newBlueMeshGroupInstance groupId mGroup addDevice (" devId ", new IResultCallback () { @Override public void onError String code String errorMsg @Override public void onSuccess () { 7.4 Remove sub-devices from a group API description void removeDevice String devId...
  • Page 28: Delete A Group

    7 Manage groups 7.5 Delete a group API description void dismissGroup IResultCallback callback Parameters Parameter Type Description callback IResultCallback The callback. Example ITuyaGroup mGroup TuyaHomeSdk newBlueMeshGroupInstance groupId mGroup dismissGroup (new IResultCallback () { @Override public void onError String code String errorMsg @Override public...
  • Page 29 7 Manage groups Parameter Type Description groupName String The new name of the group. callback IResultCallback The callback. Example ITuyaGroup mGroup TuyaHomeSdk newBlueMeshGroupInstance groupId mGroup renameGroup (" Group name",new IResultCallback () { @Override public void String String onError code errorMsg @Override public void...
  • Page 30: Control Devices And Groups

    8 Control devices and groups 8 Control devices and groups class provides operations to manage mesh groups. ITuyaBlueMeshDevice 8.1 Control devices Send a control command in the following format: {"(dpId)":"( dpValue )"} API description void publishDps String nodeId String String...
  • Page 31: Control Groups

    8 Control devices and groups String = {"1": false ITuyaBlueMeshDevice mTuyaBlueMeshDevice TuyaHomeSdk newBlueMeshDevic eInstance (" meshId "); mTuyaBlueMeshDevice publishDps devBean getNodeId () , devBean getCateg new IResultCallback () , () { @Override public void onError String String s1) { @Override public void onSuccess...
  • Page 32: Listen For Mesh Device Status

    @Override public void onSuccess () { 8.3 Listen for mesh device status Device information on a mesh network, such as DP data, status changes, device name, and device removal, is synchronized to in real time. IMeshDevListener Example 29 / 31...
  • Page 33 The value of `nodeId ` for the device . * @param dps DP data. * @param isFromLocal The data source . Valid values : `true ` to indi cate the local Bluetooth mesh network , and `false ` to indicate the c loud. @Override public void...
  • Page 34: Update Firmware

    9 Update firmware 9 Update firmware Tuya mesh shares the same logic of device firmware updates as Bluetooth mesh. For more information, see Firmware updates. 31 / 31...

Table of Contents