English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Mains-Powered Scene Switch

Last Updated on : 2022-06-06 14:47:00download

Zigbee basics

Device ID Profile ID
0x0004 0x0104

Supported clusters

Input clusters (server) Output clusters (client)
Basic (0x0000) OTA Upgrade (0x0019)
Identify (0x0003) /
Groups (0x0004) /
Scenes (0x0005) /
On/Off (0x0006) /
Tuya private cluster 0 (0xE000) /
Tuya private cluster 1 (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 The value of this attribute is 16 bytes in length, consisting of 8-byte prefix and 8-byte PID. 0 to 7 bytes: _TZ3002_.
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
  • SM002x: Indicates scene switch.
  • TS0726: Indicates mix scene switch.
x represents the number of channels. For example, SM0023 represents a 3-gang scene switch. 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) Value range:
  • 0: Off
  • 1: On
0x00
0x0041 OnTime uint16 (0x21) 0 to 43200 0x0000
0x0042 OffWaitTime uint16 (0x21) 0 to 43200 0x0000
0x8002 Restart status (main control) (Tuya-specific attribute) enum8 (0x30) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state
0x00
0x8001 Indicator status (Tuya-specific attribute) enum8 (0x30) Value range:
  • 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.
0x00
0x5000 Backlight switch (Tuya-specific attribute) enum8 (0x30) Value range:
  • 0: Off
  • 1: On
0x00

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

Tuya private cluster 0

Attributes:

ID Name Data type (ID)
0xD004 Group ID (Tuya-specific attribute) uint16 (0x21)
0xD005 Scene ID (Tuya-specific attribute) uint16 (0x21)

Tuya private cluster 1

Attributes:

ID Name Data type (ID) Range Default
0xD010 Restart status (individual control) enum8 (0x30) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state
0x00
0xD020 Mode enum8 (0x30) Value range:
  • 0: Switch
  • 1: Scene switch
0x01

Mapping between DPs and clusters

DPID DP description Standard command
1 Scene 1 (Required) No (The panel-specific DP, independent of connected devices)
2 Scene 2 (Required) No (The panel-specific DP, independent of connected devices)
3 Scene 3 (Required) No (The panel-specific DP, independent of connected devices)
4 Scene 4 (Required) No (The panel-specific DP, independent of connected devices)
5 Scene 5 (Required) No (The panel-specific DP, independent of connected devices)
6 Scene 6 (Required) No (The panel-specific DP, independent of connected devices)
17 Scene ID/Group ID (Required) No
18 Mode 1 No
19 Mode 2 No
20 Mode 3 No
21 Mode 4 No
24 Switch 1 Yes
25 Switch 2 Yes
26 Switch 3 Yes
27 Switch 4 Yes
30 Countdown 1 Yes
31 Countdown 2 Yes
32 Countdown 3 Yes
33 Countdown 4 Yes
38 Restart status (main control) No
37 Indicator status No
36 Backlight switch No
39 Relay status 1 No
40 Relay status 2 No
41 Relay status 3 No
42 Relay status 4 No

DP17 Scene ID/Group ID

Direction Cluster ID Command/Attribute ID Value
Client to server 0xE000 (Tuya private cluster 0) 0xD004 and 0xD005 (Tuya-specific attribute) Payload
Server to client 0xE000 (Tuya private cluster 0) 0xD004 and 0xD005 (Tuya-specific attribute) Payload

Payload:

The gateway sends the group ID and scene ID to the target endpoint by writing values to attributes 0xD004 and 0xD0005.
After receiving the scene ID and group ID, Zigbee devices report status through the attribute to confirm receipt of data from the gateway.

DPs 18 to 21 Mode 1 to 4

Direction Cluster ID Command/Attribute ID Value
Client to server 0xE000 (Tuya private cluster 0) 0xD020 (Tuya-specific attribute)
  • 0: Switch.
  • 1: Scene switch.
Server to client 0xE000 (Tuya private cluster 0) 0xD020 (Tuya-specific attribute)
  • 0: Switch.
  • 1: Scene switch.

DPs 24 to 27 Switch 1 to 4

The gateway sends the On, Off, or Toggle command to the Zigbee 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
  • 0: Off
  • 1: On

DPs 30 to 33 Countdown 1 to 4

Direction Cluster ID Command/Attribute ID Value
Client to server 0x0006: On/Off 0x42: On With Timed Off -
Server to client 0x0006: On/Off
  • 0x0041: On Time
  • 0x0042: Off Wait Time
0 to 43200

DP38 Restart status (main control)

Direction Cluster ID Command/Attribute ID Value
Client to server 0x0006: On/Off 0x8002 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state
Server to client 0x0006: On/Off 0x8002 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state

DP37 Indicator status

Direction Cluster ID Command/Attribute ID Value
Client to server 0x0006: On/Off 0x8001 (Tuya-specific attribute) Value range:
  • 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) Value range:
  • 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.

DP36 Backlight switch

Direction Cluster ID Command/Attribute ID Value
Client to server 0x0006: On/Off 0x5000 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On
Server to client 0x0006: On/Off 0x5000 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On

DPs 39 to 42 Restart status 1 to 4

Direction Cluster ID Command/Attribute ID Value
Client to server 0xE001 (Tuya private cluster 1) 0xD010 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state
Server to client 0xE001 (Tuya private cluster 1) 0xD010 (Tuya-specific attribute) Value range:
  • 0: Off
  • 1: On
  • 2: Last on/off state