Skip to content

Commit

Permalink
TS1001 update
Browse files Browse the repository at this point in the history
* Switch to generic matching against model name, instead of requiring
  an exact string
* Try implementing the new TuyaNewManufCluster

I'm currently blocked by zigpy/bellows#432
at a guess.
  • Loading branch information
challs committed Jan 16, 2022
1 parent 14a96a4 commit 247e750
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions zhaquirks/tuya/ts1001.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
ENDPOINTS,
INPUT_CLUSTERS,
LONG_PRESS,
MODELS_INFO,
MODEL,
OUTPUT_CLUSTERS,
PROFILE_ID,
SHORT_PRESS,
ZHA_SEND_EVENT,
)
from zhaquirks.tuya import TuyaManufClusterAttributes, TuyaOnOff, TuyaSmartRemoteOnOffCluster, TuyaSwitch
from zhaquirks.tuya import TuyaManufClusterAttributes, TuyaOnOff, TuyaSmartRemoteOnOffCluster, TuyaSwitch, TuyaNewManufCluster

class TuyaRemote1001OnOffCluster(TuyaSmartRemoteOnOffCluster):
name = "TS1001_cluster"
Expand Down Expand Up @@ -67,11 +67,13 @@ def handle_cluster_request(
ZHA_SEND_EVENT, "remote_button_short_press", []
)

class TuyaDimRemote1001(TuyaSwitch):
class TuyaDimRemote1001(CustomDevice):
"""Tuya 4-button remote device."""

signature = {
MODELS_INFO: [("_TZ3000_ztrfrcsu", "TS1001")],
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 4096],
# output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096]
MODEL: "TS1001",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
Expand Down Expand Up @@ -105,14 +107,15 @@ class TuyaDimRemote1001(TuyaSwitch):
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
TuyaNewManufCluster , # Groups.cluster_id,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
TuyaRemote1001OnOffCluster,
Groups.cluster_id, # TuyaRemote1001OnOffCluster,
Scenes.cluster_id,
TuyaSmartRemoteOnOffCluster,
#OnOff.cluster_id, # TuyaSmartRemoteOnOffCluster,
LevelControl.cluster_id,
Time.cluster_id,
Ota.cluster_id,
Expand Down Expand Up @@ -155,3 +158,17 @@ class TuyaDimRemote1001(TuyaSwitch):
# Dim down button
# [bellows.ezsp.protocol] Application frame 84 (customFrameHandler) received: b'1200100c00000800040101be01030201330a00'
# [bellows.zigbee.application] Received customFrameHandler frame with [b'\x00\x10\x0c\x00\x00\x08\x00\x04\x01\x01\xbe\x01\x03\x02\x013\n\x00']


# Dim up
# [bellows.zigbee.application] Received messageSentHandler frame with [<EmberOutgoingMessageType.OUTGOING_MULTICAST: 3>, 65533, EmberApsFrame(profileId=260, clusterId=8, sourceEndpoint=1, destinationEndpoint=255, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=63), 0, <EmberStatus.SUCCESS: 0>, b'']


# OFF button 16/01/22

# [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=1026, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=192), 172, -57, 0xaf97, 255, 255, b'\x18\xd5\n\x00\x00)\x8d\x08']
# [zigpy.zcl] [0xaf97:1:0x0402] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=213 command_id=Command.Report_Attributes>
# [zigpy.zcl] [0xaf97:1:0x0402] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=int16s, value=2189>)]]
# [zigpy.zcl] [0xaf97:1:0x0402] Attribute report received: measured_value=2189
# [bellows.zigbee.application] Received messageSentHandler frame with [<EmberOutgoingMessageType.OUTGOING_MULTICAST: 3>, 65533, EmberApsFrame(profileId=260, clusterId=6, sourceEndpoint=1, destinationEndpoint=255, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=130), 0, <EmberStatus.SUCCESS: 0>, b'']
# [bellows.zigbee.application] Unexpected message send notification tag: 0

0 comments on commit 247e750

Please sign in to comment.