Zigbee basics
Category |
Device ID |
Profile ID |
1-gang socket |
0x010A |
0x0104 |
Endpoint
Endpoint |
Description |
1 |
1-gang socket |
Supported clusters
Input clusters (server) |
Output clusters (client) |
Basic (0x0000) |
OTA Upgrade (0x0019) |
Identify (0x0003) |
/ |
Groups (0x0004) |
/ |
Scenes (0x0005) |
/ |
On/Off (0x0006) |
/ |
Simple Metering (0x0702) |
/ |
Electrical Measurement (0x0B04) |
/ |
TUYA_COMMON_PRIVATE_CLUSTER (0xE000) |
/ |
TUYA_ELECTRICIAN_PRIVATE_CLUSTER (0xE001) |
/ |
Supported attributes and commands
Attributes contain the basic information about a Zigbee device. A gateway can get this information through the Read Attributes and Write Attributes defined by Zigbee Cluster Library Specification.
Basic cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0x0000 |
ZCLVersion |
uint8 (0x20) |
0x00 to 0xff |
0x03 , used for connection to Tuya-enabled Zigbee gateways. |
0x0001 |
ApplicationVersion |
uint8 (0x20) |
0x00 to 0xff |
For example, 0b 01 00 0001 indicates 1.0.1 , that is, 0x41 represents version 1.0.1. This attribute is used for OTA updates. When an OTA update is initiated, the gateway reads the version number of the update and pushes it to the Zigbee device. After the Zigbee device is restarted after the update, the gateway reads the current version to check for the update result. The firmware can only be updated to a higher version. This attribute is used for connection to Tuya-enabled Zigbee gateways. |
0x0002 |
StackVersion |
uint8 (0x20) |
0x00 to 0xff |
0x02 |
0x0003 |
HWVersion |
uint8 (0x20) |
0x00 to 0xff |
0x01 |
0x0004 |
ManufacturerName |
string (0x42) |
0 to 32 bytes |
Format: XXX…XXX . The value of this attribute is 16 bytes in length, consisting of 8-byte prefix and 8-byte PID. 0 to 7 bytes: _TZ3000_ . 8 to 16 bytes: The PID, the unique identifier of the Zigbee product you create on the Tuya IoT Development Platform. This field determines the UI and feature display on the mobile app. You can use the default PID if you do not require a custom one. This attribute is used for connection to Tuya-enabled Zigbee gateways. |
0x0005 |
ModelIdentifier |
string (0x42) |
0 to 32 bytes |
TS011F , This attribute is used for connection to Tuya-enabled Zigbee gateways. |
0x0007 |
PowerSource |
enum8 (0x30) |
0x00 to 0xff |
0x01 . Used for connection to Tuya-enabled Zigbee gateways and representing mains-powered devices. |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
Commands
ID |
Name |
Direction |
0x00 |
Reset to Factory Defaults |
Client to Server |
On/Off cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0x0000 |
OnOff |
bool (0x10) |
0x00: Off 0x01: On |
0x00 |
0x4001 |
OnTime |
uint16 (0x21) |
0x0000 to 0xffff |
0x0000 |
0x4002 |
OffWaitTime |
uint16 (0x21) |
0x0000 to 0xffff |
0x0000 |
0x8001 |
Light mode (Tuya-specific attribute) |
enum8 (0x30) |
/ |
0x02 |
0x8002 |
Relay status (Tuya-specific attribute) |
enum8 (0x30) |
/ |
0x00 |
0x8000 |
Child lock (Tuya-specific attribute) |
bool (0x10) |
0/1 |
0x00 |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
Commands
ID |
Name |
Direction |
0x00 |
Off |
Client to Server |
0x01 |
On |
Client to Server |
0x02 |
Toggle |
Client to Server |
0x42 |
On With Timed Off |
Client to Server |
Simple Metering cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0x0000 |
CurrentSummationDelivered |
uint48 (0x25) |
0x000000000000 to 0xffffffffffff |
/ |
0x0200 |
Status |
map8 (0x18) |
/ |
0x00 |
0x0300 |
UintOfMeasure |
enum8 (0x30) |
/ |
0x00 |
0x0303 |
SummationFormatting |
map8 (0x18) |
/ |
0x00 |
0x0306 |
MeteringDeviceType |
map8 (0x18) |
/ |
0x00 |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
Electrical Measurement cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0x0505 |
RMSVoltage |
uint16 (0x21) |
0x0000 to 0xFFFF |
0xFFFF |
0x0508 |
RMSCurrent |
uint16 (0x21) |
0x0000 to 0xFFFF |
0xFFFF |
0x050B |
ActivePower |
uint16 (0x21) |
-32768 to 32767 |
0xFFFF |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
TUYA_COMMON_PRIVATE
cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0xD001 |
Cycle timing (Tuya-specific attribute) |
array |
/ |
/ |
0xD002 |
Random timing (Tuya-specific attribute) |
array |
/ |
/ |
0xD003 |
Inching switch (Tuya-specific attribute) |
array (0x48) |
/ |
/ |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
Commands
ID |
name |
Direction |
Description |
0xF8 |
Cycle timing (Tuya-specific command) |
Client to Server |
For more information about the data format, see the following section of DP42 Cycle timing. |
0xF7 |
Random timing (Tuya-specific command) |
Client to Server |
For more information about the data format, see the following section of DP43 Random timing. |
0xFB |
Inching switch (Tuya-specific attribute) |
Client to Server |
For more information about the data format, see the following section of DP44 Inching switch. |
TUYA_ELECTRICIAN_PRIVATE
cluster
Attributes
ID |
Name |
Data type (ID) |
Range |
Default |
0xD000 |
Calibration result (Tuya-specific attribute) |
uint8 (0x20) |
/ |
0x00 |
0xD001 |
Fault (Tuya-specific attribute) |
map32 (0x1B) |
/ |
0x00000000 |
0xD002 |
Electricity coefficient (Tuya-specific attribute) |
uint32 (0x23) |
/ |
0x00000000 |
0xD003 |
Voltage coefficient (Tuya-specific attribute) |
uint32 (0x23) |
/ |
0x00000000 |
0xD004 |
Electric coefficient (Tuya-specific attribute) |
uint32 (0x23) |
/ |
0x00000000 |
0xD005 |
Power coefficient (Tuya-specific attribute) |
uint32 (0x23) |
/ |
0x00000000 |
0xFFFD |
ClusterRevision |
uint16 (0x21) |
0x0000 to 0xffff |
0x0001 |
Commands
ID |
Name |
Direction |
Description |
0xE1 |
Total electricity (Tuya-specific command) |
Server to Client |
For more information about the data format, see the following section of DP17 Total electricity. |
Mapping between DPs and clusters
DPs 1 to 3 Switch
The gateway sends the on/off command to the Zigbee device to turn on or off the device. The Zigbee device reports on/off status using the ZCL on/off attribute.
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0x0006: On/Off |
- 0x00: Off
- 0x01: On
- 0x02: Toggle
|
/ |
Server to client |
0x0006: On/Off |
0x0000: On/Off |
|
DPs 9 to 10 Timer
Direction |
Cluster ID |
Command/Attribute ID |
|
Client to server |
0x0006: On/Off |
0x42: On With Timed Off |
Payload |
Server to client |
0x0006: On/Off |
- 0x4001: OnTime
- 0x4002: OffWaitTime
|
0 to 43200 |
Format of payload: On/off Control: 0x00
. On time
and Off Wait Time
must be set to the same value. Example: To send a command of a local countdown for 60s, the payload contains the following settings:
- On/off Control: 0x00
- On Time: 0x003c
- Off Wait Time: 0x003c
DP17 Total electricity
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xE1: Tuya-specific command |
uint8u total : The number of records of electricity usage.uint32u utc_time : The local time.uint32u h_elec[total] : The total electricity usage.
|
Server to client |
0x0702: Simple Metering |
0x0000: CurrentSummationDelivered |
/ |
DP18 Current
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0x0B04: Electrical Measurement |
0x0508: RMSCurrent |
DP19 Power
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0x0B04: Electrical Measurement |
0x050B: ActivePower |
DP20 Voltage
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0x0B04: Electrical Measurement |
0x0505: RMSVoltage |
DP21 Test result
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD000: Tuya-specific attribute |
DP22 Voltage coefficient
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD002: Tuya-specific attribute |
DP23 Electric coefficient
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD003: Tuya-specific attribute |
DP24 Power coefficient
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD004: Tuya-specific attribute |
DP25 Electricity coefficient
Direction |
Cluster ID |
Command/Attribute ID |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD005: Tuya-specific attribute |
DP26 Fault
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Server to client |
0xE001: TUYA_ELECTRICIAN_PRIVATE |
0xD001: Tuya-specific attribute |
Bit 0 : Over-current.Bit 1 : Over-voltage.Bit 2 : Under-voltage.
|
DP38 Relay status
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0x0006: On/Off |
0x8002: Tuya-specific attribute |
- 0: Off.
- 1: On
- 2: Last on/off state
|
Server to client |
0x0006: On/Off |
0x8002: Tuya-specific attribute |
- 0: Off
- 1: On
- 2: Last on/off state
|
DP40 Indicator mode
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0x0006: On/Off |
0x8001: Tuya-specific attribute |
- 0: Off.
- 1: Indicates status. The indicator comes on when the switch is turned on.
- 2: Indicates position. The indicator comes on when the switch is turned off.
|
Server to client |
0x0006: On/Off |
0x8001: Tuya-specific attribute |
- 0: Off
- 1: Indicates status. The indicator comes on when the switch is turned on.
- 2: Indicates position. The indicator comes on when the switch is turned off.
|
DP41 Child lock
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0x0006: On/Off |
0x8000: Tuya-specific attribute |
|
Server to client |
0x0006: On/Off |
0x8000: Tuya-specific attribute |
|
DP42 Cycle timing
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0xE000: TUYA_COMMON_PRIVATE |
0xF8: Tuya-specific command |
Payload |
Server to client |
0xE000: TUYA_COMMON_PRIVATE |
0xD002: Tuya-specific attribute |
Payload |
Payload format
Payload format: 2 + 10 × n
(n ≤ 6) Fields from the On/Off are specified for a single time node.
Feature |
Length |
Description |
Version number |
1 byte |
0x00 |
Node length |
1 byte |
0x0A |
Switch |
1 byte |
- Bit 0: used to turn on or off the node.
0: Off. 1: On. - Bit 1 to bit 7: indicates the channel ID.
|
Day(s) of the week |
1 byte |
0x00: One-time task. Other values: Schedule the task to run on specific days of the week. For more information, see the following table for Weekly schedule. |
The start time |
2 bytes |
The value is in minutes. The maximum value is 1439. |
The end time |
2 bytes |
The value is in minutes. The maximum value is 1439. |
The ON state duration |
2 bytes |
The value is in minutes. The maximum value is 1439. |
The OFF state duration |
2 bytes |
The value is in minutes. The maximum value is 1439. |
Weekly schedule
|
Sunday |
Monday |
Tuesday |
Wednesday |
Thursday |
Friday |
Saturday |
The data. |
Bit 0 |
Bit 1 |
Bit 2 |
Bit 3 |
Bit 4 |
Bit 5 |
Bit 6 |
DP43 Random timing
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0xE000: TUYA_COMMON_PRIVATE |
0xF7: Tuya-specific command |
Payload |
Server to client |
0xE000: TUYA_COMMON_PRIVATE |
0xD001: Tuya-specific attribute |
Payload |
Payload format
Payload format: 2 + 10 × n
(n ≤ 6) Fields from the On/Off are specified for a single time node.
Feature |
Length |
Description |
Version number |
1 byte |
0x00 |
Node length |
1 byte |
2 + 10 × n (n ≤ 6) |
Switch |
1 byte |
- Bit 0: used to turn on or off the node.
0: Off. 1: On. - Bit 1 to bit 7: indicates the channel ID.
|
Day(s) of the week |
1 byte |
Schedule the task to run on specific days of the week. For more information, see the following section of DP42 Cycle timing. |
The start time |
2 bytes |
The value is in minutes. The maximum value is 1439. |
The end time |
2 bytes |
The value is in minutes. The maximum value is 1439. |
DP44 Inching switch
Direction |
Cluster ID |
Command/Attribute ID |
Value |
Client to server |
0xE000: TUYA_COMMON_PRIVATE |
0xFD: Tuya-specific command |
Payload |
Server to client |
0xE000: TUYA_COMMON_PRIVATE |
0xD003: Tuya-specific attribute |
Payload |
Payload format
Payload format: 3 × n
(n ≤ 6) Fields from the On/Off are specified for a single time node.
Feature |
Length |
Description |
The channel number. |
1 byte |
/ |
White gradient duration. |
2 bytes |
Unit: second (s) |
Feature |
Length |
Description |
Channel ID + bit for enablement |
1 byte |
- Bit 0:
- 0: Enable.
- 1: Disable.
- Bit 7 to bit 1: indicates the channel ID.
|
Inching duration |
2 bytes |
00 3C is 0x003c in hex, representing 60 seconds. |
Example:
- 1-gang socket:
01 00 3C
indicates the first gang is enabled, with an inching duration of 60 seconds.
- Multi-gang socket:
00 00 3C 03 00 3C
indicates the first gang is disabled, with an inching duration of 60 seconds, and the second gang is enabled, with an inching duration of 60 seconds.