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.
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.
• 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...
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.
@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...
"). 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...
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.
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.
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.
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 .
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 ");...
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...
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...
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...
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...
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...
@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...
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...
Need help?
Do you have a question about the mesh and is the answer not in the manual?
Questions and answers