Last Updated on : 2024-06-25 03:44:51download
TuyaOS development framework supports the following types of data transfers: report, read, and write attributes, send and receive commands, and send data points (DPs) of raw type.
The status information and configuration of Zigbee devices are stored as attributes in each cluster. Each Zigbee device keeps an attribute table that supports the following attribute operations:
Standard attributes supported by Zigbee devices are defined by Connectivity Standards Alliance (CSA). For more information, see Zigbee Cluster Library Specification published by CSA. For TuyaOS-based devices, you can additionally define private attributes.
ColorTempPhysicalMinMireds (0x400b)
to define the minimum value and ColorTempPhysicalMaxMireds (0x400c)
to define the maximum value.TuyaOS provides the APIs for reporting attributes and callback functions to invoke when attributes are read or written. You can configure attribute tables and save them to non-volatile memory. This prevents the loss of attribute values in case of a power outage.
Note that certain attributes cannot be written. For more information, see Zigbee Cluster Library Specification.
To reduce network congestion, we recommend that you avoid frequent attribute reporting. Instead, report attributes only when needed.
A device can send a command to control another device. For example, a lighting remote control can send on and off commands to a lighting device to control the on/off status of the peer. Similarly, gateways send commands to control Zigbee sub-devices.
The Zigbee Cluster Library Specification defines the commands specific to each cluster. A command can be sent to a device, to a group, or throughout the network.
TuyaOS provides the APIs for sending commands and callback functions to invoke when commands are received. Unicast, multicast, and broadcast apply to both command receiving and sending
After a command is sent, the application layer provides TuyaOS with function parameters that specify whether the command reception status is required. If it is required, TuyaOS invokes a callback function to notify the application layer whether the command is received.
A DP is a collection of functions that are supported by a product created on the Tuya Developer Platform. Each DP is identified by a DPID. This is how Tuya’s things data model works.
A Zigbee gateway communicates with the cloud in the format of DPs. The gateway acts as a translator between Tuya’s DPs and the Zigbee protocol. The following section describes this communication process:
The cloud sends Tuya’s DP commands to the Zigbee gateway. Then, the gateway translates the commands into Zigbee-compatible commands and sends them to the associated Zigbee sub-devices.
After Zigbee sub-devices report status using Zigbee-compatible commands, the gateway converts the reported content into Tuya’s DPs and forwards them to the cloud.
The following diagram shows how this process works.
Typically, if a DP is covered by the Zigbee Cluster Library Specification, the Zigbee gateway communicates with its sub-devices based on the commands specified in this specification. On the Tuya Developer Platform, each product is assigned standard DPs. You can additionally define custom DPs for a product. For more information, see Product Functions.
If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback