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
743 stars 679 forks source link

[BUG] TS011F _TZ3000_cfnprab5 (XENON 4AC+2USB power strip) Sockets not individually controllable #1677

Closed c11umw closed 2 years ago

c11umw commented 2 years ago

Describe the bug 4 socket (+USB) Zigbee Power strip. https://zigbee.blakadder.com/Xenon_SM-SO306.html If you switch one socket on, they all go on (same for off)

To Reproduce Steps to reproduce the behaviour:

  1. Pair the power strip via HomeAssistant ZHA
  2. Once detected, locate the device in http://homeassistant.local:8123/config/devices/dashboard
  3. Enter the device page and each of the switches are present
  4. If you click one off, all will trigger off in 1-5 sequence a fraction of a second apart.
  5. If you click one on, they all turn back on in the same 1-5 sequence.

Expected behavior Each socket on the strip should be independently controllable separate to the others

Screenshots image

image

Device signature ```yaml { "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=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0xe000", "0xe001" ], "out_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "3": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "4": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "5": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "242": { "profile_id": 41440, "device_type": "0x0061", "in_clusters": [], "out_clusters": [ "0x0021" ] } }, "manufacturer": "_TZ3000_cfnprab5", "model": "TS011F", "class": "zigpy.device.Device" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.7.7", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.5", "docker": true, "arch": "aarch64", "timezone": "Europe/London", "os_name": "Linux", "os_version": "5.15.32-v8", "supervisor": "2022.07.0", "host_os": "Home Assistant OS 8.4", "docker_version": "20.10.14", "chassis": "embedded", "run_as_root": true }, "custom_components": { "media_player_template": { "version": "1.0.0", "requirements": [] }, "hacs": { "version": "1.26.2", "requirements": [ "aiogithubapi>=22.2.4" ] }, "govee": { "version": "0.2.2", "requirements": [ "govee-api-laggat==0.2.2", "dacite==1.6.0" ] }, "meross_lan": { "version": "2.6.1", "requirements": [] }, "miele": { "version": "v2021.10.12", "requirements": [ "requests_oauthlib>=1.3.0" ] }, "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "midea_ac_lan": { "version": "v0.2.2", "requirements": [] }, "sonoff": { "version": "3.1.0", "requirements": [ "pycryptodome>=3.6.6" ] }, "xiaomi_cloud_map_extractor": { "version": "v2.2.0", "requirements": [ "pillow", "pybase64", "python-miio", "requests", "pycryptodome" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.31.1", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.77", "zigpy-deconz==0.18.0", "zigpy==0.47.3", "zigpy-xbee==0.15.0", "zigpy-zigate==0.9.0", "zigpy-znp==0.8.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" } ], "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": 42297, "manufacturer": "_TZ3000_cfnprab5", "model": "TS011F", "name": "_TZ3000_cfnprab5 TS011F", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4417, "power_source": "Mains", "lqi": 255, "rssi": -42, "last_seen": "2022-08-03T14:26:55", "available": true, "device_type": "Router", "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=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0xe000", "0xe001" ], "out_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "3": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "4": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "5": { "profile_id": 260, "device_type": "0x010a", "in_clusters": [ "0x0004", "0x0005", "0x0006", "0xe001" ], "out_clusters": [] }, "242": { "profile_id": 41440, "device_type": "0x0061", "in_clusters": [], "out_clusters": [ "0x0021" ] } } }, "entities": [ { "entity_id": "button.power_strip_1_d8b98fd1_identify", "name": "_TZ3000_cfnprab5 TS011F" }, { "entity_id": "switch.power_strip_1_d8b98fd1_on_off", "name": "_TZ3000_cfnprab5 TS011F" }, { "entity_id": "switch.power_strip_1_d8b98fd1_on_off_2", "name": "_TZ3000_cfnprab5 TS011F" }, { "entity_id": "switch.power_strip_1_d8b98fd1_on_off_3", "name": "_TZ3000_cfnprab5 TS011F" }, { "entity_id": "switch.power_strip_1_d8b98fd1_on_off_4", "name": "_TZ3000_cfnprab5 TS011F" }, { "entity_id": "switch.power_strip_1_d8b98fd1_on_off_5", "name": "_TZ3000_cfnprab5 TS011F" } ], "neighbors": [], "endpoint_names": [ { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "unknown 97 device_type of 0xa1e0 profile id" } ], "user_given_name": "Power_Strip_1", "device_reg_id": "227288f5a19d9e3568fb4db545308446", "area_id": "bedroom", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "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_cfnprab5" }, "0x0005": { "attribute_name": "model", "value": "TS011F" } }, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "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" } } }, "0xe001": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": {} }, "3": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "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" } } }, "0xe001": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": {} }, "4": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "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" } } }, "0xe001": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": {} }, "5": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "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" } } }, "0xe001": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": {} }, "242": { "device_type": { "name": "unknown", "id": 97 }, "profile_id": 41440, "in_clusters": {}, "out_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs
c11umw commented 2 years ago

My specific model is SM-SO306-K (UK Specific?)

MattWestb commented 2 years ago

Your device is very likely needing "tuya magic spell" being casted on it then it joining the network. LIDL have one similar power strip that is working OK and they have made on new batch with updated firmware that is doing exactly the same as yous is doing. One dev was doing one quirk for it and is shall working OK https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/lidl/ts011f_plug.py.

If you like testing you can configure local quirks in HA and patching the device signature in the LIDL quirk so it matching your device and ZHA is loading the quirk and you can testing if its working or not.

c11umw commented 2 years ago

Thank @MattWestb I had a go. Not sure what I was doing, but I had a go.

I found how to add ZHA Quirks from this link. https://community.home-assistant.io/t/how-to-setup-local-zha-quirks/341226

I added to the /config/custom_zha_quirks/ folder and added the Lidl file, but it was giving me Zigbee errors on reboot. Possibly as it's a 3 socket+4USB device, not 4 socket+2 USB? However I did find another file which was accepted by HA: https://github.com/zigpy/zha-device-handlers/blob/57a68a2b57afabc0b5dfc49ef4231263594e310e/zhaquirks/tuya/ts011f_plug.py#L403

Delete device, reboot, re-add device, all still go on/off with an individual switch.

But it still didn't work after I changed the signature for class Plug_4AC_2USB(CustomDevice):

Not sure if I need to make other changes to the file, not just the "MODELS_INFO" part....?

MattWestb commented 2 years ago

Great then you have the local quirk working !!

The tuya TS011F is not having the "magic spell" (reading and writing attribute then the device is joining the network).

You must edging the signature of the LIDL quirk so the system is loading it (endpoints and cluster must matching). Then doing that you must deleting the fixed TS011F so the system is not loading that instead.

apgha commented 2 years ago

Hi, I have just received the Tuya TS011F and I am facing the sae issue. @c11umw, did you manage to make it work? Thanks.

javicalle commented 2 years ago

Duplicate of #1632