zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
764 stars 702 forks source link

[BUG] TS0013 Girier 3-way switch #2200

Closed LordArrin closed 1 year ago

LordArrin commented 1 year ago

Describe the bug

I have successfully paired a GIRIER 3 gang Zigbee switch. However, it is impossible to turn ON or OFF 1 gang at a time. For example, if I try to turn ON the gang 1 (left) via ZHA all the gangs will turn ON and the same thing happens when turning it OFF. The same thing happens if i try with the gang 2 and 3.

Expected behavior A clear and concise description of what you expected to happen. Separated control fo the device's relays Screenshots If applicable, add screenshots to help explain your problem.

Device signature ```yaml IEEE: a4:c1:38:05:5b:0f:6f:cb Nwk: 0x3aed Device Type: EndDevice LQI: 176 RSSI: -56 Устройство было в сети: 2023-02-16T15:55:12 Источник питания: Battery or Unknown ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.2.5", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "Europe/Moscow", "os_name": "Linux", "os_version": "5.15.90", "supervisor": "2023.01.1", "host_os": "Home Assistant OS 9.5", "docker_version": "20.10.22", "chassis": "vm", "run_as_root": true }, "custom_components": { "ui_lovelace_minimalist": { "version": "v1.1.6-hotfix", "requirements": [ "aiofiles==0.8.0", "aiogithubapi>=22.2.4" ] }, "xiaomi_gateway3": { "version": "3.1.0", "requirements": [ "zigpy>=0.42.0" ] }, "ble_monitor": { "version": "11.6.2", "requirements": [ "pycryptodomex>=3.14.1", "janus>=1.0.0", "aioblescan>=0.2.14", "btsocket>=0.2.0", "pyric>=0.1.6.3" ] }, "hacs": { "version": "1.30.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "yandex_station": { "version": "3.11.0", "requirements": [] }, "localtuya": { "version": "5.0.0", "requirements": [] }, "yandex_weather": { "version": "2.0.1", "requirements": [] }, "yandex_smart_home": { "version": "0.6.2", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.7", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.92", "zigpy-deconz==0.19.2", "zigpy==0.53.0", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.2" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "*zigate*", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "*zigate*", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 15085, "manufacturer": "_TZ3000_ypgri8yz", "model": "TS0013", "name": "_TZ3000_ypgri8yz TS0013", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4417, "power_source": "Battery or Unknown", "lqi": 176, "rssi": -56, "last_seen": "2023-02-16T15:55:12", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=, *allocate_address=True, *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)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0100", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0xe000", "0xe001" ], "out_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": 260, "device_type": "0x0100", "in_clusters": [ "0x0004", "0x0005", "0x0006" ], "out_clusters": [] }, "3": { "profile_id": 260, "device_type": "0x0100", "in_clusters": [ "0x0004", "0x0005", "0x0006" ], "out_clusters": [] } } }, "active_coordinator": false, "entities": [ { "entity_id": "button.tz3000_ypgri8yz_ts0013_identify", "name": "_TZ3000_ypgri8yz TS0013" }, { "entity_id": "light.tz3000_ypgri8yz_ts0013_light", "name": "_TZ3000_ypgri8yz TS0013" }, { "entity_id": "light.tz3000_ypgri8yz_ts0013_light_2", "name": "_TZ3000_ypgri8yz TS0013" }, { "entity_id": "light.tz3000_ypgri8yz_ts0013_light_3", "name": "_TZ3000_ypgri8yz TS0013" }, { "entity_id": "sensor.tz3000_ypgri8yz_ts0013_rssi", "name": "_TZ3000_ypgri8yz TS0013" }, { "entity_id": "sensor.tz3000_ypgri8yz_ts0013_lqi", "name": "_TZ3000_ypgri8yz TS0013" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "ON_OFF_LIGHT" }, { "name": "ON_OFF_LIGHT" }, { "name": "ON_OFF_LIGHT" } ], "user_given_name": "\u0421\u0432\u0435\u0442 \u0432 \u0442\u0443\u0430\u043b\u0435\u0442\u0435", "device_reg_id": "da77b7b45b46ffb83284562f7ab91d72", "area_id": "tualet", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_LIGHT", "id": 256 }, "profile_id": 260, "in_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 0 }, "0x4001": { "attribute_name": "on_time", "value": 0 }, "0x4002": { "attribute_name": "off_wait_time", "value": 0 } }, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" } } }, "0xe000": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} }, "0xe001": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} }, "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "_TZ3000_ypgri8yz" }, "0x0005": { "attribute_name": "model", "value": "TS0013" }, "0x0006": { "attribute_name": "date_code", "value": "" } }, "unsupported_attributes": { "0x000c": { "attribute_name": "manufacturer_version_details" }, "0x000d": { "attribute_name": "serial_number" }, "0x0012": { "attribute_name": "device_enabled" } } } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "ON_OFF_LIGHT", "id": 256 }, "profile_id": 260, "in_clusters": { "0x0004": { "endpoint_attribute": "groups", "attributes": { "0x0000": { "attribute_name": "name_support", "value": 0 } }, "unsupported_attributes": { "0xfffe": { "attribute_name": "attr_reporting_status" } } }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 0 }, "0x4001": { "attribute_name": "on_time", "value": 0 }, "0x4002": { "attribute_name": "off_wait_time", "value": 0 } }, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" } } } }, "out_clusters": {} }, "3": { "device_type": { "name": "ON_OFF_LIGHT", "id": 256 }, "profile_id": 260, "in_clusters": { "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 0 }, "0x4001": { "attribute_name": "on_time", "value": 0 }, "0x4002": { "attribute_name": "off_wait_time", "value": 0 } }, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" } } } }, "out_clusters": {} } } } } ```
Additional logs ``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```

Additional context Add any other context about the problem here.

javicalle commented 1 year ago

I have a quirk porposal for your device.

You would need enable the local quirk folder in your installation. There is a good guide to configure it:

Once configured, copy in your custom_zha_quirks folder the current ts001x.py file:

Edit the file and add at the bottom this class:

TuyaTripleGang_var05 ```python class TuyaTripleGang_var05(EnchantedDevice, TuyaSwitch): """Tuya 3 gang light switch (variation 05).""" signature = { # "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, # user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, # mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, # maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, # descriptor_capability_field=, *allocate_address=True, *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)", MODEL: "TS0013", ENDPOINTS: { # "profile_id": 260, "device_type": "0x0100", # "in_clusters": ["0x0000","0x0003","0x0004","0x0005","0x0006","0xe000","0xe001"], # "out_clusters": ["0x000a","0x0019"] 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, Scenes.cluster_id, OnOff.cluster_id, TuyaZBE000Cluster.cluster_id, TuyaZBExternalSwitchTypeCluster.cluster_id, ], OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id], }, # "profile_id": 260, "device_type": "0x0100", # "in_clusters": ["0x0004","0x0005","0x0006"], # "out_clusters": [] 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Groups.cluster_id, Scenes.cluster_id, OnOff.cluster_id, ], OUTPUT_CLUSTERS: [], }, # "profile_id": 260, "device_type": "0x0100", # "in_clusters": ["0x0004","0x0005","0x0006"], # "out_clusters": [] 3: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Groups.cluster_id, Scenes.cluster_id, OnOff.cluster_id, ], OUTPUT_CLUSTERS: [], }, }, } replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaZBOnOffAttributeCluster, TuyaZBE000Cluster, TuyaZBExternalSwitchTypeCluster, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], }, 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Groups.cluster_id, Scenes.cluster_id, TuyaZBOnOffAttributeCluster, ], OUTPUT_CLUSTERS: [], }, 3: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Groups.cluster_id, Scenes.cluster_id, TuyaZBOnOffAttributeCluster, ], OUTPUT_CLUSTERS: [], }, }, } ```

Save changes, remove the device from HA, restart HA and pair the device again.

LordArrin commented 1 year ago

Yeah, it works! Thanks, man! But if it will works out-of-box, it will better)

javicalle commented 1 year ago

Let's keep open until the quirk is merged to mainstream. Once the quirk is published wirh a new version, I recommend you to remove the local quirk.