Last Updated on : 2024-05-14 08:00:15download
To achieve remote control, the basic capability is bidirectional communication between devices and the cloud. This way, a device can report data to the cloud and the cloud can send commands to a device. The gateway acts as a bridge for this two-way data transmission.
Data point (DP)
A DP is a representation of a specific feature that you want a physical product to have. A complete product is built with a suite of DPs.
For more information, see Product Functions.
Data unit
The serial protocol specifies that a data unit is a single unit of packaged DP data transferred between network end systems.
For more information, see MCU Integration Protocol for Gateway.
The module receives commands from the cloud or the mobile app and sends them to the MCU through the serial command 0x0C
. Then, the MCU processes the received command. After executing the specified action, the MCU reports the current status to the module.
The module sends the following data.
55 AA 00 0C 00 0A 04 31 32 33 34 01 01 00 01 01 E7
Field | Description |
---|---|
Header | 55 AA |
Command | 00 0C |
Length | 00 0A |
Data |
|
Checksum | 0xE7 |
For a DP with the data transfer type of send and report (read-write), if the MCU fails to report the current status of this DP through the command 0x0D
after executing the action as instructed by the command 0x0C
, the module will send 0x0C
again.
The MCU can report status to the module in an asynchronous or a synchronous manner.
With asynchronous reporting, the module will send the cloud the received data from the MCU but will not return the reporting result to the MCU. This reporting manner applies to most usage scenarios.
If you want the module to return the reporting result, you can choose synchronous reporting. But this manner can reduce the processing speed.
The MCU reports the following data.
55 AA 00 0D 00 0A 04 31 32 33 34 01 01 00 01 01 E8
Field | Description |
---|---|
Header | 55 AA |
Command | 00 0D |
Length | 00 0A |
Data |
|
Checksum | 0xE8 |
The MCU reports the following data.
55 AA 00 2C 00 11 00 00 00 00 00 00 00 04 31 32 33 34 01 01 00 01 01 0E
Field | Description |
---|---|
Header | 55 AA |
Command | 00 2C |
Length | 00 11 |
Data |
|
Checksum | 0xE8 |
The module returns the following data.
55 AA 00 2C 00 01 00 2C
0x00
indicates that data is reported successfully.
0x0B
) or the status query of specific DPs (0x29
).0x0D
), if there is sequential identical data of the same DP, the module will only include it once to report. However, in some situations, such as tables, if you want such duplicate data to be reported, you have two solutions.
Data length: indicates the length of DP data, not the length of a complete frame of data. The data length depends on the DP data type and the number of DPs. If needed, values can be padded on the left with zeros to meet the length requirement. For more information, see MCU Integration Protocol for Gateway.
Enum data: Its value ranges from 0 to 255. No matter what particular values you specified as enum values, the data reported must start with zero.
For example, the DP of work_type
has enum values cold
, warm
, auto
, air
, dehumidify
, mapping to numeric 0
,1
,2
,3
,4
. To report data of dehumidify
, the value 4
will be reported.
For the DP of level
in percentage, it has enum values 0
,20
,40
,60
,80
,100
, mapping to 0
,1
,2
,3
,4
,5
. To report data of 60
, the value 3
will be reported.
If you edit the enum values specified for a DP, the numeric mapping must be updated. For example, the enum values of work_type
become cold
, warm
, air
, dehumidify
after auto
is deleted. when the device is paired again, the value 3
should be used to report data of dehumidify
.
Bitmap data: supports reporting multiple faults at the same time. Each bit represents an alert. 1
indicates a fault occurs and 0
indicates no fault occurs. The bitmap data can be one, two, or four bytes. Data greater than one byte is transmitted in big-endian format.
For example, if the MCU sends 55 AA 00 0D 00 0B 04 31 32 33 34 68 05 00 02 00 09 5D
, it indicates that the sub-device of 1234
reports faults of bit0
and bit3
.
If you want to configure alert messages, see Configure Push Notification.
String data: the denotation of the string data must match the specifications of the control panel on the mobile app. The string data must be converted into hexadecimal values to report.
For example, if the MCU sends 55 AA 00 0D 00 0D 04 31 32 33 34 69 03 00 04 74 65 73 74 17
, 74 65 73 74
denotes the character test
.
Raw data: usually used to implement complex features. The raw data is completely passed through between the device and the cloud without processing but with Base64 encoding and decoding. The cloud logs provided by the Tuya IoT Development Platform are Base64-encoded. You need to decode them first to get the actual data.
Grouped status reporting: indicates the module reports status data of multiple DPs to improve the efficiency of data transfer. For example, the MCU sends the module 55 AA 00 0D 00 12 04 31 32 33 34 66 02 00 04 00 00 00 16 01 01 00 01 00 71
to report the status of DP 102 and DP 1.
66 02 00 04 00 00 00 16
indicates the current value of the integer (0x02) DP 102 (0x66) is 22 (0x16).01 01 00 01 00
indicates the current value of the Boolean (0x01) DP 1 (0x01) is 0
(0x00).Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback