@marcog1 Thats the quirk I’m currently using:
"""Tuya 4 Button Remote TS004F."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import (
Basic,
Groups,
Identify,
LevelControl,
OnOff,
Ota,
PowerConfiguration,
Scenes,
Time,
)
from zigpy.zcl.clusters.lighting import Color
from zigpy.zcl.clusters.lightlink import LightLink
from zhaquirks.const import (
ARGS,
BUTTON,
CLUSTER_ID,
COMMAND,
COMMAND_MOVE,
COMMAND_OFF,
COMMAND_ON,
COMMAND_STEP,
COMMAND_STOP,
COMMAND_TOGGLE,
DEVICE_TYPE,
DIM_DOWN,
DIM_UP,
ENDPOINT_ID,
ENDPOINTS,
INPUT_CLUSTERS,
LONG_PRESS,
LONG_RELEASE,
MODEL,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
SHORT_PRESS,
TURN_OFF,
TURN_ON,
)
from zhaquirks.tuya import TuyaZBOnOffAttributeCluster, TuyaSmartRemoteOnOffCluster
class TuyaSmartRemote004F2A(CustomDevice):
"""Tuya Smart (rotating) Knob device."""
signature = {
# "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0, *allocate_address=True, *complex_descriptor_available=False, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False, *is_valid=True, *logical_type=<LogicalType.EndDevice: 2>, *user_descriptor_available=False)",
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 6, 4096], output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096])
MODELS_INFO: [("_TZ3000_4fjiwweb", "TS004F")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
OnOff.cluster_id,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
LightLink.cluster_id,
],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaZBOnOffAttributeCluster, # for light commands.
# TuyaSmartRemoteOnOffCluster, # for scen commands.
LevelControl.cluster_id,
Color.cluster_id,
LightLink.cluster_id,
],
},
},
}
device_automation_triggers = {
(SHORT_PRESS, BUTTON): {COMMAND: COMMAND_TOGGLE, CLUSTER_ID: 6, ENDPOINT_ID: 1},
(LONG_PRESS, BUTTON): {COMMAND: "stop_move_step", CLUSTER_ID: 768, ENDPOINT_ID: 1},
}
class TuyaSmartRemote004F1A(CustomDevice):
"""Tuya 4-button MW test version remote device."""
signature = {
# "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0, *allocate_address=True, *complex_descriptor_available=False, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False, *is_valid=True, *logical_type=<LogicalType.EndDevice: 2>, *user_descriptor_available=False)",
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 6, 4096], output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096])
MODELS_INFO: [("_TZ3000_xabckq1v", "TS004F")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
OnOff.cluster_id,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
LightLink.cluster_id,
],
},
# 2: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
# INPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# OUTPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# },
# 3: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
# INPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# OUTPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# },
# 4: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
# INPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# OUTPUT_CLUSTERS: [
# OnOff.cluster_id,
# ],
# },
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaSmartRemoteOnOffCluster,
# TuyaZBOnOffAttributeCluster,
LevelControl.cluster_id,
Color.cluster_id,
LightLink.cluster_id,
],
},
# 2: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
# INPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# OUTPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# },
# 3: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
# INPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# OUTPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# },
# 4: {
# PROFILE_ID: zha.PROFILE_ID,
# DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
# INPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# OUTPUT_CLUSTERS: [
# TuyaSmartRemoteOnOffCluster,
# ],
# },
},
}
device_automation_triggers = {
(SHORT_PRESS, TURN_ON): {COMMAND: COMMAND_ON, CLUSTER_ID: 6, ENDPOINT_ID: 1},
(SHORT_PRESS, TURN_OFF): {COMMAND: COMMAND_OFF, CLUSTER_ID: 6, ENDPOINT_ID: 1},
(SHORT_PRESS, DIM_UP): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 51, 10],
},
(LONG_PRESS, DIM_UP): {
COMMAND: COMMAND_MOVE,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 51],
},
(SHORT_PRESS, DIM_DOWN): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 51, 10],
},
(LONG_PRESS, DIM_DOWN): {
COMMAND: COMMAND_MOVE,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 51],
},
(LONG_RELEASE, DIM_DOWN): {
COMMAND: COMMAND_STOP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
},
}
class TuyaSmartRemote004F(CustomDevice):
"""Tuya 4-button New version remote device."""
signature = {
# "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0, *allocate_address=True, *complex_descriptor_available=False, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False, *is_valid=True, *logical_type=<LogicalType.EndDevice: 2>, *user_descriptor_available=False)",
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 6, 4096], output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096])
MODEL: "TS004F",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
OnOff.cluster_id,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
LightLink.cluster_id,
],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
Time.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaZBOnOffAttributeCluster,
LevelControl.cluster_id,
LightLink.cluster_id,
],
},
},
}
device_automation_triggers = {
(SHORT_PRESS, TURN_ON): {COMMAND: COMMAND_ON, CLUSTER_ID: 6, ENDPOINT_ID: 1},
(SHORT_PRESS, TURN_OFF): {COMMAND: COMMAND_OFF, CLUSTER_ID: 6, ENDPOINT_ID: 1},
(SHORT_PRESS, DIM_UP): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 51, 10],
},
(LONG_PRESS, DIM_UP): {
COMMAND: COMMAND_MOVE,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 51],
},
(SHORT_PRESS, DIM_DOWN): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 51, 10],
},
(LONG_PRESS, DIM_DOWN): {
COMMAND: COMMAND_MOVE,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 51],
},
(LONG_RELEASE, DIM_DOWN): {
COMMAND: COMMAND_STOP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
},
}
Did you check in developer tools → zha_event, if the events appear?