Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions zhaquirks/tuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,6 @@ class TuyaSmartRemoteOnOffCluster(OnOff, EventableCluster):
0x01: DOUBLE_PRESS,
0x02: LONG_PRESS,
}
name = "TS004X_cluster"
ep_attribute = "TS004X_cluster"

class AttributeDefs(OnOff.AttributeDefs):
"""Attribute definitions."""
Expand Down
14 changes: 14 additions & 0 deletions zhaquirks/tuya/ts004f.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,21 @@
TURN_OFF,
TURN_ON,
)
from zhaquirks.quirk_ids import TUYA_PLUG_ONOFF

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand the logic of this naming then the tuya scene commands is only being used of scene remotes and no plugs what i knowing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be needed anymore. I think i originally used it to match some cluster handler.

Forgot this was not i draft. Will remove that change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually.. Some way to mark the cluster having the "switch_mode" attribute is needed. The name of the quirk is bad thou.

The OnOff cluster have extensions. It's still a standard OnOff cluster on both client and server side.

Also I don't think we need to have TuyaSmartRemoteOnOffCluster and TuyaZBOnOffAttributeCluster. They are really only the server and the client side of same cluster. All other clusters are combined to describe both sides.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most tuya quirk is in the pipe for being converted to V2 but its great that you is digging it it so some is knowing how the device is working and can getting the code catching it.
Sadly tuya is doing there "zigbee" implantation that is mostly OK but have making very bad shortcuts like on this devices is not supporting binding in the normal way (binding cluster to devices and / or groups) instead adding ther as lights that is out of all standards.
And thanks for your work done !!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most logic is renaming the TUYA_PLUG_ONOFF if its being used for other device types then plugs (the first use of the old cluster was for the TS004F and then extended for the plugs and adding the back light and children lock).

from zhaquirks.tuya import (
EnchantedDevice,
TuyaNoBindPowerConfigurationCluster,
TuyaSmartRemoteOnOffCluster,
TuyaZBExternalSwitchTypeCluster,
TuyaZBOnOffAttributeCluster,
)


class TuyaSmartRemote004FROK(EnchantedDevice):
"""Tuya Smart (rotating) Knob device."""

quirk_id = TUYA_PLUG_ONOFF

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])
Expand Down Expand Up @@ -116,6 +120,7 @@ class TuyaSmartRemote004FROK(EnchantedDevice):
TuyaNoBindPowerConfigurationCluster,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
TuyaZBOnOffAttributeCluster,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Expand Down Expand Up @@ -189,6 +194,8 @@ class TuyaSmartRemote004FROK(EnchantedDevice):
class TuyaSmartRemote004FDMS(EnchantedDevice):
"""Tuya 4 btton dimmer switch / remote device."""

quirk_id = TUYA_PLUG_ONOFF

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])
Expand Down Expand Up @@ -233,6 +240,7 @@ class TuyaSmartRemote004FDMS(EnchantedDevice):
TuyaNoBindPowerConfigurationCluster,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
TuyaZBOnOffAttributeCluster,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Expand Down Expand Up @@ -324,6 +332,8 @@ class TuyaSmartRemote004FDMS(EnchantedDevice):
class TuyaSmartRemote004FSK(EnchantedDevice):
"""Tuya Smart (Single) Knob device."""

quirk_id = TUYA_PLUG_ONOFF

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, 57345], output_clusters=[25, 10, 3, 4, 6, 8, 4096])
Expand Down Expand Up @@ -367,6 +377,7 @@ class TuyaSmartRemote004FSK(EnchantedDevice):
TuyaNoBindPowerConfigurationCluster,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
TuyaZBOnOffAttributeCluster,
LightLink.cluster_id,
TuyaZBExternalSwitchTypeCluster,
],
Expand Down Expand Up @@ -443,6 +454,8 @@ class TuyaSmartRemote004FSK_v2(TuyaSmartRemote004FSK):
class TuyaSmartRemote004F(EnchantedDevice):
"""Tuya 4-button New version remote device."""

quirk_id = TUYA_PLUG_ONOFF

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])
Expand Down Expand Up @@ -483,6 +496,7 @@ class TuyaSmartRemote004F(EnchantedDevice):
TuyaNoBindPowerConfigurationCluster,
Identify.cluster_id,
Groups.cluster_id, # Is needed for adding group then binding is not working.
TuyaZBOnOffAttributeCluster,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Expand Down
Loading