Tuya TS0002 2 Gang Zigbee Switch Support

There are a couple older threads on this topic, so I know this Zigbee device would work if I transitioned my Zigbee setup to Zigbee2MQTT, but I’d rather not. I’d prefer to see the native Zigbee binding work for a device that appears to be using standard Zigbee protocols.

Openhab recognizes a Generic Zigbee device, and has both Switches as channels. However, commands to one command both endpoints. Manually using a hard switch to turn one on or off is reflected as proper state updates, so the two endpoints are correct at some layer.

Here is my fingerprint:

>| Node Descriptor
| |> Logical Type               ROUTER
| |> MAC Capabilities           [FULL_FUNCTION_DEVICE, MAINS_POWER, RECEIVER_ON_WHEN_IDLE]
| |> Stack Compliance           21
| |> Server Capabilities        []
| |> Buffer Size                66
| |> Incoming Transfer Size     66
| |> Outgoing Transfer Size     66
|
|>| Power Descriptor
| |> Available Power Sources    [MAINS]
| |> Current Power Source       MAINS
| |> Current Power Mode         RECEIVER_ON_IDLE
| |> Power Level                FULL
|
|>| ZDO
| |> ManagementBindRequest      SUCCESS
| |> IeeeAddressRequest         SUCCESS
| |> ManagementLqiRequest       SUCCESS
| |> ManagementRoutingRequest   TIMEOUT
|
|>| Basic Information
| |> Generic Device Class       
| |> Generic Device Type        
| |> Manufacturer Name          _TZ3000_mtnpt6ws
| |> Model Indentifier          TS0002
| |> Product Code               
| |> Product URL                
| |> Date Code                  
| |> Application Version        72
| |> Software Build ID          
| |> Hardware Version           1
| |> Zcl Version                3
| |> Stack Version              0
| |
| |>| Endpoint 1
| | |> Profile                  0104  ZIGBEE_HOME_AUTOMATION
| | |> Device Type              0100  ON_OFF_LIGHT
| | |> Device Version           1
| | |
| | |>| Input Clusters
| | | |
| | | |>| Cluster 0000 Basic
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  ZCL Version                               >> UNSIGNED_8_BIT_INTEGER          3
| | | | | |> 0001  Application Version                       >> UNSIGNED_8_BIT_INTEGER          72
| | | | | |> 0002  Stack Version                             >> UNSIGNED_8_BIT_INTEGER          0
| | | | | |> 0003  HW Version                                >> UNSIGNED_8_BIT_INTEGER          1
| | | | | |> 0004  Manufacturer Name                         >> CHARACTER_STRING                _TZ3000_mtnpt6ws
| | | | | |> 0005  Model Identifier                          >> CHARACTER_STRING                TS0002
| | | | | |> 0006  Date Code                                 >> CHARACTER_STRING                
| | | | | |> 0007  Power Source                              >> ENUMERATION_8_BIT               1
| | | | | |> FFDE                                            >> UNSIGNED_8_BIT_INTEGER          13
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         2
| | | | | |> FFFE  Attribute Reporting Status                >> ENUMERATION_16_BIT              0
| | | |
| | | |>| Cluster 0003 Identify
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster 0004 Groups
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster 0005 Scenes
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  Scene Count                               >> UNSIGNED_8_BIT_INTEGER          0
| | | | | |> 0001  Current Scene                             >> UNSIGNED_8_BIT_INTEGER          0
| | | | | |> 0002  Current Group                             >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> 0003  Scene Valid                               >> BOOLEAN                         false
| | | | | |> 0004  Name Support                              >> BITMAP_8_BIT                    0
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         2
| | | |
| | | |>| Cluster 0006 On/Off
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  On Off                                    >> BOOLEAN                         true
| | | | | |> 4001  On Time                                   >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> 4002  Off Wait Time                             >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> 5000                                            >> ENUMERATION_8_BIT               1
| | | | | |> 8001                                            >> ENUMERATION_8_BIT               1
| | | | | |> 8002                                            >> ENUMERATION_8_BIT               0
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         2
| | | |
| | | |>| Cluster 0702 Metering
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster 0B04 Electrical Measurement
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster E000 
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster E001 
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | |
| | |>| Output Clusters
| | | |
| | | |>| Cluster 000A Time
| | | | |> Type                 Client [Output]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster 0019 Ota Upgrade
| | | | |> Type                 Client [Output]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  Upgrade Server ID                         >> IEEE_ADDRESS                    FFFFFFFFFFFFFFFF
| | | | | |> 0001  File Offset                               >> UNSIGNED_32_BIT_INTEGER         -1
| | | | | |> 0002  Current File Version                      >> UNSIGNED_32_BIT_INTEGER         72
| | | | | |> 0003  Current ZigBee Stack Version              >> UNSIGNED_16_BIT_INTEGER         2
| | | | | |> 0004  Downloaded File Version                   >> UNSIGNED_32_BIT_INTEGER         -1
| | | | | |> 0005  Downloaded ZigBee Stack Version           >> UNSIGNED_16_BIT_INTEGER         65535
| | | | | |> 0006  Image Upgrade Status                      >> ENUMERATION_8_BIT               0
| | | | | |> 0007  Manufacturer ID                           >> UNSIGNED_16_BIT_INTEGER         4417
| | | | | |> 0008  Image Type ID                             >> UNSIGNED_16_BIT_INTEGER         65535
| | | | | |> 0009  Minimum Block Request Period              >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         3
| |
| |>| Endpoint 2
| | |> Profile                  0104  ZIGBEE_HOME_AUTOMATION
| | |> Device Type              0100  ON_OFF_LIGHT
| | |> Device Version           1
| | |
| | |>| Input Clusters
| | | |
| | | |>| Cluster 0004 Groups
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |> Unsupported locally
| | | |
| | | |>| Cluster 0005 Scenes
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  Scene Count                               >> UNSIGNED_8_BIT_INTEGER          0
| | | | | |> 0001  Current Scene                             >> UNSIGNED_8_BIT_INTEGER          0
| | | | | |> 0002  Current Group                             >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> 0003  Scene Valid                               >> BOOLEAN                         false
| | | | | |> 0004  Name Support                              >> BITMAP_8_BIT                    0
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         2
| | | |
| | | |>| Cluster 0006 On/Off
| | | | |> Type                 Server [Input]
| | | | |> Manufacturer Spec.   No
| | | | |
| | | | |>| Commands Generated
| | | | | |> FAILURE
| | | | |
| | | | |>| Commands Received
| | | | | |> FAILURE
| | | | |
| | | | |>| Attributes Supported
| | | | | |> 0000  On Off                                    >> BOOLEAN                         true
| | | | | |> 4001  On Time                                   >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> 4002  Off Wait Time                             >> UNSIGNED_16_BIT_INTEGER         0
| | | | | |> FFFD  Cluster Revision                          >> UNSIGNED_16_BIT_INTEGER         2
| | |
| | |>| Output Clusters
| |
| |>| Endpoint 242
| | |> Profile                  A1E0  ZIGBEE_GREEN_POWER
| | |> Device Type              0061
| | |> Device Version           0

Here is a log snippet of the switch state being correctly reported after a manual change:

03:16:17.437 [DEBUG] [.converter.ZigBeeConverterSwitchOnoff] - A4C1380B34F2BC7A: ZigBee attribute reports ZclAttribute [cluster=On/Off, id=0, name=On Off, dataType=BOOLEAN, lastValue=false, lastReportTime=Mon Jul 01 03:16:17 BST 2024, implemented=true]
03:16:17.439 [DEBUG] [.converter.ZigBeeBaseChannelConverter] - A4C1380B34F2BC7A: Channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_1_switch updated to OFF
03:18:26.931 [INFO ] [openhab.event.ItemCommandEvent       ] - Item '_TZ3000_mtnpt6ws_TS0002_Master_A4C1380B34F2BC7A_2_Switch' received command ON
03:18:26.939 [DEBUG] [ing.zigbee.handler.ZigBeeThingHandler] - A4C1380B34F2BC7A: Command for channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_2_switch --> ON [OnOffType]
03:18:26.943 [DEBUG] [.converter.ZigBeeBaseChannelConverter] - A4C1380B34F2BC7A: Channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_2_switch waiting for response to ON
03:18:27.052 [DEBUG] [.converter.ZigBeeBaseChannelConverter] - A4C1380B34F2BC7A: Channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_2_switch received SUCCESS in response to ON
03:18:27.054 [DEBUG] [.converter.ZigBeeBaseChannelConverter] - A4C1380B34F2BC7A: Channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_2_switch updated to ON
03:18:27.056 [DEBUG] [ing.zigbee.handler.ZigBeeThingHandler] - A4C1380B34F2BC7A: Updating ZigBee channel state zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_2_switch to ON
03:18:27.060 [DEBUG] [g.zigbee.handler.ZigBeeIsAliveTracker] - IsAlive Tracker reset for handler with thingUID=zigbee:device:6e447f8381:a4c1380b34f2bc7a
03:18:27.066 [DEBUG] [g.zigbee.handler.ZigBeeIsAliveTracker] - IsAlive Tracker cancelled task for thingUID=zigbee:device:6e447f8381:a4c1380b34f2bc7a
03:18:27.072 [DEBUG] [.converter.ZigBeeConverterSwitchOnoff] - A4C1380B34F2BC7A: ZigBee attribute reports ZclAttribute [cluster=On/Off, id=0, name=On Off, dataType=BOOLEAN, lastValue=true, lastReportTime=Mon Jul 01 03:18:27 BST 2024, implemented=true]
03:18:27.072 [DEBUG] [g.zigbee.handler.ZigBeeIsAliveTracker] - IsAlive Tracker scheduled task for thingUID=zigbee:device:6e447f8381:a4c1380b34f2bc7a in 1830 seconds
03:18:27.075 [DEBUG] [.converter.ZigBeeBaseChannelConverter] - A4C1380B34F2BC7A: Channel zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_1_switch updated to ON
03:18:27.081 [DEBUG] [ing.zigbee.handler.ZigBeeThingHandler] - A4C1380B34F2BC7A: Updating ZigBee channel state zigbee:device:6e447f8381:a4c1380b34f2bc7a:A4C1380B34F2BC7A_1_switch to ON
03:18:27.085 [DEBUG] [g.zigbee.handler.ZigBeeIsAliveTracker] - IsAlive Tracker reset for handler with thingUID=zigbee:device:6e447f8381:a4c1380b34f2bc7a
03:18:27.091 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item '_TZ3000_mtnpt6ws_TS0002_Master_A4C1380B34F2BC7A_1_Switch' changed from OFF to ON

Any thoughts on where this is broken? My next steps are to start digging through code, both OpenHAB and Zigbee2MQTT, but I’d appreciate any suggestions.

Not knowing the exact story of your switch the general situation is that most of those devices (ts0002 is tuya I guess) don’t implement proper zigbee standard. They are manually integrated with more or less effort into z2m.
Even if you find the implementation (probably in node_modules/zigbee-herdsman-converters/devices/tuya.js) in similar cases it was the decision that the approach of the standard binding is to not try to support devices with incomplete zigbee implementations. It would always be too limited and requests would explode. Even home assistant with a professional development team is not able to compete regarding supported devices. So maybe try z2m (which works nicely with openhab)?

Zigbee2mqtt is great.
I am using tuya 4 gang switch with it and it works well.