Mains-Powered Scene Switch

Last Updated on : 2023-09-07 10:23:07download

Zigbee basics

Device ID Profile ID
0x0004 0x0104

Endpoint

Endpoint Description
1 1st-gang scene switch or ordinary switch
2 2nd-gang scene switch or ordinary switch
3 3rd-gang scene switch or ordinary switch
4 4th-gang scene switch or ordinary switch
5 5th-gang scene switch
6 6th-gang scene switch

Upper limit: 4-gang ordinary switch or 2-gang scene switch. EP5 and EP6 support scene switches only.

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 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: _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
0x4001 OnTime uint16 (0x21) 0 to 43200 0x0000
0x4002 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 Endpoint
1 Scene 1 (Required) No (The panel-specific DP, independent of connected devices) 1
2 Scene 2 (Required) No (The panel-specific DP, independent of connected devices) 2
3 Scene 3 (Required) No (The panel-specific DP, independent of connected devices) 3
4 Scene 4 (Required) No (The panel-specific DP, independent of connected devices) 4
5 Scene 5 (Required) No (The panel-specific DP, independent of connected devices) 5
6 Scene 6 (Required) No (The panel-specific DP, independent of connected devices) 6
17 Scene ID/Group ID (Required) No 1
18 Mode 1 No 1
19 Mode 2 No 2
20 Mode 3 No 3
21 Mode 4 No 4
24 Switch 1 Yes 1
25 Switch 2 Yes 2
26 Switch 3 Yes 3
27 Switch 4 Yes 4
30 Countdown of switch 1 Yes 1
31 Countdown of switch 2 Yes 2
32 Countdown of switch 3 Yes 3
33 Countdown of switch 4 Yes 4
38 Restart status (main control) No 1
37 Indicator state No 1
36 Backlight on/off No 1
39 Relay status 1 No 1
40 Relay status 2 No 2
41 Relay status 3 No 3
42 Relay status 4 No 4

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 Payload
Server to client 0x0006: On/Off
  • 0x4001: On Time
  • 0x4002: Off Wait Time
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

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