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
757 stars 695 forks source link

[Device Support Request] TS0601 Cover. Tuya _TZE204_xu4a5rhj curtain motor #3181

Open QuadGhoST opened 5 months ago

QuadGhoST commented 5 months ago

Problem description

Request to add a quirk for the "DS82-Tuya" curtain motor (cover). This is a zigbee device that looks exactly as other tuya curtain motors.

Solution description

A custom quirk that works and allows to control the curtain motor.

Screenshots/Video

No response

Device signature ```json { "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": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0102", "0xef00" ], "output_clusters": [ "0x0019" ] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] } }, "manufacturer": "_TZE204_xu4a5rhj", "model": "TS0601", "class": "tuya.ts0601.TuyaCover0601_GP" } ```
Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.5.5", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "Asia/Irkutsk", "os_name": "Linux", "os_version": "6.6.29-haos", "supervisor": "2024.05.1", "host_os": "Home Assistant OS 12.3", "docker_version": "25.0.5", "chassis": "vm", "run_as_root": true }, "custom_components": { "hacs": { "documentation": "https://hacs.xyz/docs/configuration/start", "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "localtuya": { "documentation": "https://github.com/rospogrigio/localtuya/", "version": "5.2.1", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly", "@TheJulianJES" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.38.4", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.115", "zigpy-deconz==0.23.1", "zigpy==0.64.0", "zigpy-xbee==0.20.1", "zigpy-zigate==0.12.0", "zigpy-znp==0.12.1", "universal-silabs-flasher==0.0.18", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*slzb-07*", "known_devices": [ "smlight slzb-07" ] }, { "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": "0403", "pid": "6015", "description": "*conbee*", "known_devices": [ "Conbee III" ] }, { "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" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 7403, "manufacturer": "_TZE204_xu4a5rhj", "model": "TS0601", "name": "_TZE204_xu4a5rhj TS0601", "quirk_applied": true, "quirk_class": "tuya.ts0601.TuyaCover0601_GP", "quirk_id": null, "manufacturer_code": 4417, "power_source": "Mains", "lqi": 196, "rssi": -51, "last_seen": "2024-05-30T18:11: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": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0102", "0xef00" ], "output_clusters": [ "0x0019" ] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] } }, "manufacturer": "_TZE204_xu4a5rhj", "model": "TS0601" }, "active_coordinator": false, "entities": [ { "entity_id": "cover.tze204_xu4a5rhj_ts0601_cover", "name": "_TZE204_xu4a5rhj TS0601" }, { "entity_id": "update.tze204_xu4a5rhj_ts0601_firmware", "name": "_TZE204_xu4a5rhj TS0601" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "WINDOW_COVERING_DEVICE" }, { "name": "PROXY_BASIC" } ], "user_given_name": null, "device_reg_id": "97fb008041dfaa538963bec2ba2dcf95", "area_id": null, "cluster_details": { "1": { "device_type": { "name": "WINDOW_COVERING_DEVICE", "id": 514 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 74 }, "0x0004": { "attribute_name": "manufacturer", "value": "_TZE204_xu4a5rhj" }, "0x0005": { "attribute_name": "model", "value": "TS0601" } }, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0xef00": { "endpoint_attribute": "tuya_manufacturer", "attributes": {}, "unsupported_attributes": {} }, "0x0102": { "endpoint_attribute": "window_covering", "attributes": { "0x0008": { "attribute_name": "current_position_lift_percentage", "value": 50 }, "0x8001": { "attribute_name": "motor_direction", "value": 1 } }, "unsupported_attributes": { "0x0000": { "attribute_name": "window_covering_type" }, "0x0010": { "attribute_name": "installed_open_limit_lift" }, "0x0007": { "attribute_name": "config_status" }, "0x0013": { "attribute_name": "installed_closed_limit_tilt" }, "0x0009": { "attribute_name": "current_position_tilt_percentage" }, "0x0012": { "attribute_name": "installed_open_limit_tilt" }, "0x0011": { "attribute_name": "installed_closed_limit_lift" }, "0x0017": { "attribute_name": "window_covering_mode" } } } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": { "0x0002": { "attribute_name": "current_file_version", "value": 74 } }, "unsupported_attributes": {} } } }, "242": { "device_type": { "name": "PROXY_BASIC", "id": 97 }, "profile_id": 41440, "in_clusters": {}, "out_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Logs ```python 2024-05-30 18:16:55.897 DEBUG (MainThread) [bellows.ezsp.protocol] Send command sendUnicast: (, 0x1CEB, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=11), 135, b'\x05A\x11\x0b\x00\x00\x00\x01\x04\x00\x01\x00') 2024-05-30 18:16:55.898 DEBUG (MainThread) [bellows.uart] Sending: b'756c21a9602a155945904b25455493099d4e27a06ac262caeccd6389fc7f3ba7eacdc7917e' 2024-05-30 18:16:55.922 DEBUG (MainThread) [bellows.uart] Data frame: b'506ca1a9602a155f72f27e' 2024-05-30 18:16:55.922 DEBUG (MainThread) [bellows.uart] Sending: b'8610be7e' 2024-05-30 18:16:55.923 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received sendUnicast: [, 237] 2024-05-30 18:16:55.940 DEBUG (MainThread) [bellows.uart] Data frame: b'606cb1a96b2a155945904b25455493099d4e27466ace6738ca7e' 2024-05-30 18:16:55.940 DEBUG (MainThread) [bellows.uart] Sending: b'87009f7e' 2024-05-30 18:16:55.941 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received messageSentHandler: [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=237), 135, , b''] 2024-05-30 18:16:55.941 DEBUG (MainThread) [bellows.zigbee.application] Received messageSentHandler frame with [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=237), 135, , b''] 2024-05-30 18:16:55.942 DEBUG (MainThread) [bellows.uart] Data frame: b'706cb1a9112a15b65894a524ab5593499ca8e76706d29874f8de6882fcfda36f7e' 2024-05-30 18:16:55.942 DEBUG (MainThread) [bellows.uart] Sending: b'8070787e' 2024-05-30 18:16:55.942 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received incomingMessageHandler: [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=230), 192, -52, 0x1CEB, 255, 255, b'\x18\x0b\x0b\x00\x83'] 2024-05-30 18:16:55.943 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=230), 192, -52, 0x1CEB, 255, 255, b'\x18\x0b\x0b\x00\x83'] 2024-05-30 18:16:55.943 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 16, 55, 943430, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x1CEB), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=230, profile_id=260, cluster_id=61184, data=Serialized[b'\x18\x0b\x0b\x00\x83'], tx_options=, radius=0, non_member_radius=0, lqi=192, rssi=-52) 2024-05-30 18:16:55.944 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Received ZCL frame: b'\x18\x0b\x0b\x00\x83' 2024-05-30 18:16:55.944 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=, is_manufacturer_specific=0, direction=, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=11, command_id=11, *direction=) 2024-05-30 18:16:55.945 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame: TuyaManufacturerWindowCover:Default_Response(command_id=0, status=) 2024-05-30 18:16:55.947 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064215.94343, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) 2024-05-30 18:16:55.948 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064215.94343, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) completed 2024-05-30 18:16:55.945 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140514413188160] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/cover.py", line 275, in async_open_cover raise HomeAssistantError(f"Failed to open cover: {res[1]}") homeassistant.exceptions.HomeAssistantError: Failed to open cover: 2024-05-30 18:16:55.952 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:16:55.955 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:16:57.541 DEBUG (MainThread) [zigpy.util] Tries remaining: 3 2024-05-30 18:16:57.542 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Sending request header: ZCLHeader(frame_control=FrameControl<0x05>(frame_type=, is_manufacturer_specific=True, direction=, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), manufacturer=4417, tsn=12, command_id=0, *direction=) 2024-05-30 18:16:57.543 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Sending request: set_data(param=Command(status=0, tsn=0, command_id=1025, function=0, data=[1, 1])) 2024-05-30 18:16:57.544 DEBUG (MainThread) [bellows.zigbee.application] Sending packet ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 16, 57, 544280, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x0000), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x1CEB), dst_ep=1, source_route=None, extended_timeout=False, tsn=12, profile_id=260, cluster_id=61184, data=Serialized[b'\x05A\x11\x0c\x00\x00\x00\x01\x04\x00\x01\x01'], tx_options=, radius=0, non_member_radius=0, lqi=None, rssi=None) 2024-05-30 18:16:57.544 DEBUG (MainThread) [bellows.ezsp.protocol] Send command sendUnicast: (, 0x1CEB, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=12), 136, b'\x05A\x11\x0c\x00\x00\x00\x01\x04\x00\x01\x01') 2024-05-30 18:16:57.545 DEBUG (MainThread) [bellows.uart] Sending: b'006d21a9602a155945904b25455493099d4e27a765c262caecca6389fc7f3ba7eacc6c807e' 2024-05-30 18:16:57.561 DEBUG (MainThread) [bellows.uart] Data frame: b'016da1a9602a155c76477e' 2024-05-30 18:16:57.561 DEBUG (MainThread) [bellows.uart] Sending: b'8160597e' 2024-05-30 18:16:57.562 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received sendUnicast: [, 238] 2024-05-30 18:16:57.579 DEBUG (MainThread) [bellows.uart] Data frame: b'116db1a96b2a155945904b25455493099d4e274565ce6716b67e' 2024-05-30 18:16:57.580 DEBUG (MainThread) [bellows.uart] Sending: b'82503a7e' 2024-05-30 18:16:57.581 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received messageSentHandler: [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=238), 136, , b''] 2024-05-30 18:16:57.581 DEBUG (MainThread) [bellows.zigbee.application] Received messageSentHandler frame with [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=238), 136, , b''] 2024-05-30 18:16:57.582 DEBUG (MainThread) [bellows.uart] Data frame: b'216db1a9112a15b65894a524ab5593499ca9e76706d29874f8de6f82fcfdb8aa7e' 2024-05-30 18:16:57.583 DEBUG (MainThread) [bellows.uart] Sending: b'83401b7e' 2024-05-30 18:16:57.584 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received incomingMessageHandler: [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=231), 192, -52, 0x1CEB, 255, 255, b'\x18\x0c\x0b\x00\x83'] 2024-05-30 18:16:57.584 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=231), 192, -52, 0x1CEB, 255, 255, b'\x18\x0c\x0b\x00\x83'] 2024-05-30 18:16:57.584 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 16, 57, 584916, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x1CEB), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=231, profile_id=260, cluster_id=61184, data=Serialized[b'\x18\x0c\x0b\x00\x83'], tx_options=, radius=0, non_member_radius=0, lqi=192, rssi=-52) 2024-05-30 18:16:57.585 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Received ZCL frame: b'\x18\x0c\x0b\x00\x83' 2024-05-30 18:16:57.586 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=, is_manufacturer_specific=0, direction=, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=12, command_id=11, *direction=) 2024-05-30 18:16:57.586 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame: TuyaManufacturerWindowCover:Default_Response(command_id=0, status=) 2024-05-30 18:16:57.588 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064217.584916, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) 2024-05-30 18:16:57.587 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140514413188160] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/cover.py", line 339, in async_stop_cover raise HomeAssistantError(f"Failed to stop cover: {res[1]}") homeassistant.exceptions.HomeAssistantError: Failed to stop cover: 2024-05-30 18:16:57.592 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064217.584916, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) completed 2024-05-30 18:16:57.592 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:16:57.593 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:16:58.227 DEBUG (MainThread) [zigpy.application] Feeding watchdog 2024-05-30 18:16:58.227 DEBUG (MainThread) [bellows.ezsp.protocol] Send command readCounters: () 2024-05-30 18:16:58.228 DEBUG (MainThread) [bellows.uart] Sending: b'7d337221a9a52a86257e' 2024-05-30 18:16:58.255 DEBUG (MainThread) [bellows.uart] Data frame: b'3272a1a9a52afeb2d69413205f5593499c4e25abefcef38b7dc66f89fa7e36a7e9cdde6f8fffc7dbd5d2698c4623a9ec763ba5ea758241984c2613b1e070381c0e07bbe5ca658a459a4d9e4f9ff7c3d9d46a35a25190482459467e' 2024-05-30 18:16:58.255 DEBUG (MainThread) [bellows.uart] Sending: b'8430fc7e' 2024-05-30 18:16:58.256 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received readCounters: [[235, 143, 1369, 245, 1, 0, 2, 2, 148, 128, 12, 6, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] 2024-05-30 18:16:58.257 DEBUG (MainThread) [bellows.ezsp.protocol] Send command getValue: (,) 2024-05-30 18:16:58.257 DEBUG (MainThread) [bellows.uart] Sending: b'247321a9fe2a160def7e' 2024-05-30 18:16:58.275 DEBUG (MainThread) [bellows.uart] Data frame: b'4373a1a9fe2a15b3aa9e447e' 2024-05-30 18:16:58.275 DEBUG (MainThread) [bellows.uart] Sending: b'8520dd7e' 2024-05-30 18:16:58.276 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received getValue: [, b'\xf3'] 2024-05-30 18:16:58.276 DEBUG (MainThread) [bellows.zigbee.application] Free buffers status EzspStatus.SUCCESS, value: 243 2024-05-30 18:16:58.276 DEBUG (MainThread) [bellows.zigbee.application] ezsp_counters: [MAC_RX_BROADCAST = 235, MAC_TX_BROADCAST = 143, MAC_RX_UNICAST = 1369, MAC_TX_UNICAST_SUCCESS = 245, MAC_TX_UNICAST_RETRY = 1, MAC_TX_UNICAST_FAILED = 0, APS_DATA_RX_BROADCAST = 2, APS_DATA_TX_BROADCAST = 2, APS_DATA_RX_UNICAST = 148, APS_DATA_TX_UNICAST_SUCCESS = 128, APS_DATA_TX_UNICAST_RETRY = 12, APS_DATA_TX_UNICAST_FAILED = 6, ROUTE_DISCOVERY_INITIATED = 9, NEIGHBOR_ADDED = 2, NEIGHBOR_REMOVED = 0, NEIGHBOR_STALE = 0, JOIN_INDICATION = 0, CHILD_REMOVED = 0, ASH_OVERFLOW_ERROR = 0, ASH_FRAMING_ERROR = 0, ASH_OVERRUN_ERROR = 0, NWK_FRAME_COUNTER_FAILURE = 0, APS_FRAME_COUNTER_FAILURE = 0, UTILITY = 0, APS_LINK_KEY_NOT_AUTHORIZED = 0, NWK_DECRYPTION_FAILURE = 0, APS_DECRYPTION_FAILURE = 0, ALLOCATE_PACKET_BUFFER_FAILURE = 0, RELAYED_UNICAST = 0, PHY_TO_MAC_QUEUE_LIMIT_REACHED = 0, PACKET_VALIDATE_LIBRARY_DROPPED_COUNT = 0, TYPE_NWK_RETRY_OVERFLOW = 0, PHY_CCA_FAIL_COUNT = 0, BROADCAST_TABLE_FULL = 0, PTA_LO_PRI_REQUESTED = 0, PTA_HI_PRI_REQUESTED = 0, PTA_LO_PRI_DENIED = 0, PTA_HI_PRI_DENIED = 0, PTA_LO_PRI_TX_ABORTED = 0, PTA_HI_PRI_TX_ABORTED = 0, ADDRESS_CONFLICT_SENT = 0, EZSP_FREE_BUFFERS = 243] 2024-05-30 18:16:59.402 DEBUG (MainThread) [zigpy.util] Tries remaining: 3 2024-05-30 18:16:59.403 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Sending request header: ZCLHeader(frame_control=FrameControl<0x05>(frame_type=, is_manufacturer_specific=True, direction=, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), manufacturer=4417, tsn=13, command_id=0, *direction=) 2024-05-30 18:16:59.404 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Sending request: set_data(param=Command(status=0, tsn=0, command_id=1025, function=0, data=[1, 2])) 2024-05-30 18:16:59.404 DEBUG (MainThread) [bellows.zigbee.application] Sending packet ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 16, 59, 404773, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x0000), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x1CEB), dst_ep=1, source_route=None, extended_timeout=False, tsn=13, profile_id=260, cluster_id=61184, data=Serialized[b'\x05A\x11\r\x00\x00\x00\x01\x04\x00\x01\x02'], tx_options=, radius=0, non_member_radius=0, lqi=None, rssi=None) 2024-05-30 18:16:59.405 DEBUG (MainThread) [bellows.ezsp.protocol] Send command sendUnicast: (, 0x1CEB, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=13), 137, b'\x05A\x11\r\x00\x00\x00\x01\x04\x00\x01\x02') 2024-05-30 18:16:59.406 DEBUG (MainThread) [bellows.uart] Sending: b'357021a9602a155945904b25455493099d4e27a664c262caeccb6389fc7f3ba7eacfb3677e' 2024-05-30 18:16:59.425 DEBUG (MainThread) [bellows.uart] Data frame: b'5470a1a9602a155d38cd7e' 2024-05-30 18:16:59.425 DEBUG (MainThread) [bellows.uart] Sending: b'8610be7e' 2024-05-30 18:16:59.426 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received sendUnicast: [, 239] 2024-05-30 18:16:59.443 DEBUG (MainThread) [bellows.uart] Data frame: b'6470b1a96b2a155945904b25455493099d4e274464ce670e0a7e' 2024-05-30 18:16:59.443 DEBUG (MainThread) [bellows.uart] Sending: b'87009f7e' 2024-05-30 18:16:59.444 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received messageSentHandler: [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=239), 137, , b''] 2024-05-30 18:16:59.445 DEBUG (MainThread) [bellows.zigbee.application] Received messageSentHandler frame with [, 7403, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=239), 137, , b''] 2024-05-30 18:16:59.445 DEBUG (MainThread) [bellows.uart] Data frame: b'7470b1a9112a15b65894a524ab5593499ca6e76706d29874f8de6e82fcfddf187e' 2024-05-30 18:16:59.445 DEBUG (MainThread) [bellows.uart] Sending: b'8070787e' 2024-05-30 18:16:59.447 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received incomingMessageHandler: [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=232), 192, -52, 0x1CEB, 255, 255, b'\x18\r\x0b\x00\x83'] 2024-05-30 18:16:59.447 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=232), 192, -52, 0x1CEB, 255, 255, b'\x18\r\x0b\x00\x83'] 2024-05-30 18:16:59.447 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 16, 59, 447754, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x1CEB), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=232, profile_id=260, cluster_id=61184, data=Serialized[b'\x18\r\x0b\x00\x83'], tx_options=, radius=0, non_member_radius=0, lqi=192, rssi=-52) 2024-05-30 18:16:59.448 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Received ZCL frame: b'\x18\r\x0b\x00\x83' 2024-05-30 18:16:59.448 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=, is_manufacturer_specific=0, direction=, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=13, command_id=11, *direction=) 2024-05-30 18:16:59.449 DEBUG (MainThread) [zigpy.zcl] [0x1CEB:1:0xef00] Decoded ZCL frame: TuyaManufacturerWindowCover:Default_Response(command_id=0, status=) 2024-05-30 18:16:59.450 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140514413188160] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/cover.py", line 290, in async_close_cover raise HomeAssistantError(f"Failed to close cover: {res[1]}") homeassistant.exceptions.HomeAssistantError: Failed to close cover: 2024-05-30 18:16:59.452 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064219.447754, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) 2024-05-30 18:16:59.454 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064219.447754, 'ieee': a4:c1:38:41:23:9e:15:5c, 'min_update_delta': 30.0}) completed 2024-05-30 18:16:59.456 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:16:59.456 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:17:00.998 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x395E](TS0207): last_seen is 70370.94368481636 seconds ago and ping attempts have been exhausted, marking the device unavailable 2024-05-30 18:17:00.998 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x395E](TS0207): Update device availability - device available: False - new availability: False - changed: False 2024-05-30 18:17:01.079 DEBUG (MainThread) [homeassistant.components.zha.entity] sensor.unknown_power: polling for updated state 2024-05-30 18:17:01.079 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x3615:1:0x0b04]: async_update 2024-05-30 18:17:01.079 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x3615:1:0x0b04]: Reading attributes in chunks: ['active_power', 'rms_current', 'rms_voltage'] 2024-05-30 18:17:01.080 DEBUG (MainThread) [zigpy.zcl] [0x3615:1:0x0b04] Sending request header: ZCLHeader(frame_control=FrameControl<0x00>(frame_type=, is_manufacturer_specific=False, direction=, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=79, command_id=, *direction=) 2024-05-30 18:17:01.080 DEBUG (MainThread) [zigpy.zcl] [0x3615:1:0x0b04] Sending request: Read_Attributes(attribute_ids=[1291, 1288, 1285]) 2024-05-30 18:17:01.081 DEBUG (MainThread) [bellows.zigbee.application] Sending packet ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 17, 1, 81373, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x0000), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x3615), dst_ep=1, source_route=None, extended_timeout=False, tsn=79, profile_id=260, cluster_id=2820, data=Serialized[b'\x00O\x00\x0b\x05\x08\x05\x05\x05'], tx_options=, radius=0, non_member_radius=0, lqi=None, rssi=None) 2024-05-30 18:17:01.081 DEBUG (MainThread) [bellows.ezsp.protocol] Send command sendUnicast: (, 0x3615, EmberApsFrame(profileId=260, clusterId=2820, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=79), 138, b'\x00O\x00\x0b\x05\x08\x05\x05\x05') 2024-05-30 18:17:01.082 DEBUG (MainThread) [bellows.uart] Sending: b'407121a9602a15a76f904b21a15493099d4e27e467c767c4fdcd6681f97b3a43fc7e' 2024-05-30 18:17:01.107 DEBUG (MainThread) [bellows.uart] Data frame: b'0571a1a9602a1542efc57e' 2024-05-30 18:17:01.107 DEBUG (MainThread) [bellows.uart] Sending: b'8160597e' 2024-05-30 18:17:01.108 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received sendUnicast: [, 240] 2024-05-30 18:17:01.124 DEBUG (MainThread) [bellows.uart] Data frame: b'1571b1a96b2a15a76f904b21a15493099d4e275b67ce67fde57e' 2024-05-30 18:17:01.125 DEBUG (MainThread) [bellows.uart] Sending: b'82503a7e' 2024-05-30 18:17:01.126 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received messageSentHandler: [, 13845, EmberApsFrame(profileId=260, clusterId=2820, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=240), 138, , b''] 2024-05-30 18:17:01.126 DEBUG (MainThread) [bellows.zigbee.application] Received messageSentHandler frame with [, 13845, EmberApsFrame(profileId=260, clusterId=2820, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=240), 138, , b''] 2024-05-30 18:17:01.130 DEBUG (MainThread) [bellows.uart] Data frame: b'2571b1a9112a15b658904124ab1593499ce59362f8f89874e8de2c88f77b3f8eebcdd66a8fdec7dbd0d769adb5238c1b7e' 2024-05-30 18:17:01.130 DEBUG (MainThread) [bellows.uart] Sending: b'83401b7e' 2024-05-30 18:17:01.131 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received incomingMessageHandler: [, EmberApsFrame(profileId=260, clusterId=2820, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=171), 180, -55, 0x3615, 255, 255, b'\x18O\x01\x0b\x05\x00)\x00\x00\x08\x05\x00!\x00\x00\x05\x05\x00!\xf3\x00'] 2024-05-30 18:17:01.131 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [, EmberApsFrame(profileId=260, clusterId=2820, sourceEndpoint=1, destinationEndpoint=1, options=, groupId=0, sequence=171), 180, -55, 0x3615, 255, 255, b'\x18O\x01\x0b\x05\x00)\x00\x00\x08\x05\x00!\x00\x00\x05\x05\x00!\xf3\x00'] 2024-05-30 18:17:01.132 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 5, 30, 10, 17, 1, 132000, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=, address=0x3615), src_ep=1, dst=AddrModeAddress(addr_mode=, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=171, profile_id=260, cluster_id=2820, data=Serialized[b'\x18O\x01\x0b\x05\x00)\x00\x00\x08\x05\x00!\x00\x00\x05\x05\x00!\xf3\x00'], tx_options=, radius=0, non_member_radius=0, lqi=180, rssi=-55) 2024-05-30 18:17:01.132 DEBUG (MainThread) [zigpy.zcl] [0x3615:1:0x0b04] Received ZCL frame: b'\x18O\x01\x0b\x05\x00)\x00\x00\x08\x05\x00!\x00\x00\x05\x05\x00!\xf3\x00' 2024-05-30 18:17:01.133 DEBUG (MainThread) [zigpy.zcl] [0x3615:1:0x0b04] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=, is_manufacturer_specific=0, direction=, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=79, command_id=1, *direction=) 2024-05-30 18:17:01.134 DEBUG (MainThread) [zigpy.zcl] [0x3615:1:0x0b04] Decoded ZCL frame: TuyaZBElectricalMeasurement:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x050B, status=, value=TypeValue(type=int16s, value=0)), ReadAttributeRecord(attrid=0x0508, status=, value=TypeValue(type=uint16_t, value=0)), ReadAttributeRecord(attrid=0x0505, status=, value=TypeValue(type=uint16_t, value=243))]) 2024-05-30 18:17:01.135 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x3615:1:0x0b04]: cluster_handler[electrical_measurement] attribute_updated - cluster[Electrical Measurement] attr[active_power] value[0] 2024-05-30 18:17:01.135 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x3615:1:0x0b04]: cluster_handler[electrical_measurement] attribute_updated - cluster[Electrical Measurement] attr[rms_current] value[0] 2024-05-30 18:17:01.136 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x3615:1:0x0b04]: cluster_handler[electrical_measurement] attribute_updated - cluster[Electrical Measurement] attr[rms_voltage] value[243] 2024-05-30 18:17:01.137 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064221.132, 'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'min_update_delta': 30.0}) 2024-05-30 18:17:01.139 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, 'UPDATE devices_v13\n SET last_seen=:ts\n WHERE ieee=:ieee AND :ts - last_seen > :min_update_delta', {'ts': 1717064221.132, 'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'min_update_delta': 30.0}) completed 2024-05-30 18:17:01.141 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:17:01.141 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:17:01.142 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1291, 'value': 0, 'timestamp': 1717064221.13503, 'min_update_delta': 30.0}) 2024-05-30 18:17:01.142 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1291, 'value': 0, 'timestamp': 1717064221.13503, 'min_update_delta': 30.0}) completed 2024-05-30 18:17:01.144 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:17:01.145 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:17:01.145 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1288, 'value': 0, 'timestamp': 1717064221.135753, 'min_update_delta': 30.0}) 2024-05-30 18:17:01.146 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1288, 'value': 0, 'timestamp': 1717064221.135753, 'min_update_delta': 30.0}) completed 2024-05-30 18:17:01.147 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:17:01.147 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:17:01.148 DEBUG (Thread-5) [aiosqlite] executing functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1285, 'value': 243, 'timestamp': 1717064221.136205, 'min_update_delta': 30.0}) 2024-05-30 18:17:01.148 DEBUG (Thread-5) [aiosqlite] operation functools.partial(, '\n INSERT INTO attributes_cache_v13\n VALUES (:ieee, :endpoint_id, :cluster_type, :cluster_id, :attr_id, :value, :timestamp)\n ON CONFLICT (ieee, endpoint_id, cluster_type, cluster_id, attr_id) DO UPDATE\n SET value=excluded.value, last_updated=excluded.last_updated\n WHERE\n value != excluded.value\n OR :timestamp - last_updated > :min_update_delta\n ', {'ieee': a4:c1:38:f5:e1:e8:7a:d9, 'endpoint_id': 1, 'cluster_type': , 'cluster_id': 2820, 'attr_id': 1285, 'value': 243, 'timestamp': 1717064221.136205, 'min_update_delta': 30.0}) completed 2024-05-30 18:17:01.149 DEBUG (Thread-5) [aiosqlite] executing functools.partial() 2024-05-30 18:17:01.149 DEBUG (Thread-5) [aiosqlite] operation functools.partial() completed 2024-05-30 18:17:03.013 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x9EA2](TS0207): Device seen - marking the device available and resetting counter 2024-05-30 18:17:03.013 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x9EA2](TS0207): Update device availability - device available: True - new availability: True - changed: False 2024-05-30 18:17:03.019 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xF7D2](TS0202): Device seen - marking the device available and resetting counter 2024-05-30 18:17:03.019 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xF7D2](TS0202): Update device availability - device available: True - new availability: True - changed: False 2024-05-30 18:17:08.278 DEBUG (MainThread) [zigpy.application] Feeding watchdog 2024-05-30 18:17:08.278 DEBUG (MainThread) [bellows.ezsp.protocol] Send command readCounters: () 2024-05-30 18:17:08.278 DEBUG (MainThread) [bellows.uart] Sending: b'537621a9a52a65337e' 2024-05-30 18:17:08.303 DEBUG (MainThread) [bellows.uart] Data frame: b'3676a1a9a52af8b2c9942e20525593499c4e25abefcef18b7fc66f89fa7e36a7e9cdde6f8fffc7dbd5d2698c4623a9ec763ba5ea758241984c2613b1e070381c0e07bbe5ca658a459a4d9e4f9ff7c3d9d46a35a25190482490177e' 2024-05-30 18:17:08.303 DEBUG (MainThread) [bellows.uart] Sending: b'8430fc7e' 2024-05-30 18:17:08.304 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received readCounters: [[237, 144, 1380, 248, 1, 0, 2, 2, 150, 130, 12, 6, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] 2024-05-30 18:17:08.304 DEBUG (MainThread) [bellows.ezsp.protocol] Send command getValue: (,) 2024-05-30 18:17:08.305 DEBUG (MainThread) [bellows.uart] Sending: b'647721a9fe2a16d6a27e' 2024-05-30 18:17:08.320 DEBUG (MainThread) [bellows.uart] Data frame: b'4777a1a9fe2a15b3aa0dc67e' 2024-05-30 18:17:08.320 DEBUG (MainThread) [bellows.uart] Sending: b'8520dd7e' 2024-05-30 18:17:08.321 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame received getValue: [, b'\xf3'] 2024-05-30 18:17:08.321 DEBUG (MainThread) [bellows.zigbee.application] Free buffers status EzspStatus.SUCCESS, value: 243 2024-05-30 18:17:08.321 DEBUG (MainThread) [bellows.zigbee.application] ezsp_counters: [MAC_RX_BROADCAST = 237, MAC_TX_BROADCAST = 144, MAC_RX_UNICAST = 1380, MAC_TX_UNICAST_SUCCESS = 248, MAC_TX_UNICAST_RETRY = 1, MAC_TX_UNICAST_FAILED = 0, APS_DATA_RX_BROADCAST = 2, APS_DATA_TX_BROADCAST = 2, APS_DATA_RX_UNICAST = 150, APS_DATA_TX_UNICAST_SUCCESS = 130, APS_DATA_TX_UNICAST_RETRY = 12, APS_DATA_TX_UNICAST_FAILED = 6, ROUTE_DISCOVERY_INITIATED = 9, NEIGHBOR_ADDED = 2, NEIGHBOR_REMOVED = 0, NEIGHBOR_STALE = 0, JOIN_INDICATION = 0, CHILD_REMOVED = 0, ASH_OVERFLOW_ERROR = 0, ASH_FRAMING_ERROR = 0, ASH_OVERRUN_ERROR = 0, NWK_FRAME_COUNTER_FAILURE = 0, APS_FRAME_COUNTER_FAILURE = 0, UTILITY = 0, APS_LINK_KEY_NOT_AUTHORIZED = 0, NWK_DECRYPTION_FAILURE = 0, APS_DECRYPTION_FAILURE = 0, ALLOCATE_PACKET_BUFFER_FAILURE = 0, RELAYED_UNICAST = 0, PHY_TO_MAC_QUEUE_LIMIT_REACHED = 0, PACKET_VALIDATE_LIBRARY_DROPPED_COUNT = 0, TYPE_NWK_RETRY_OVERFLOW = 0, PHY_CCA_FAIL_COUNT = 0, BROADCAST_TABLE_FULL = 0, PTA_LO_PRI_REQUESTED = 0, PTA_HI_PRI_REQUESTED = 0, PTA_LO_PRI_DENIED = 0, PTA_HI_PRI_DENIED = 0, PTA_LO_PRI_TX_ABORTED = 0, PTA_HI_PRI_TX_ABORTED = 0, ADDRESS_CONFLICT_SENT = 0, EZSP_FREE_BUFFERS = 243] ```
Custom quirk ```python """Tuya based cover and blinds.""" from zigpy.profiles import zgp, zha from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time, OnOff from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.tuya import ( TuyaManufacturerWindowCover, TuyaManufCluster, TuyaWindowCover, TuyaWindowCoverControl, ) class TuyaCover0601_GP(TuyaWindowCover): """Tuya blind cover motor.""" signature = { MODELS_INFO: [ ("_TZE204_xu4a5rhj", "TS0601"), ], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.SMART_PLUG, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaManufCluster.cluster_id, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], }, 242: { PROFILE_ID: 41440, DEVICE_TYPE: 97, INPUT_CLUSTERS: [], OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id], }, }, } replacement = { ENDPOINTS: { 1: { DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaManufacturerWindowCover, TuyaWindowCoverControl, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, 242: { PROFILE_ID: 41440, DEVICE_TYPE: 97, INPUT_CLUSTERS: [], OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id], }, }, } ```

Additional information

custom quirk gives an error File "/usr/src/homeassistant/homeassistant/components/zha/cover.py", line 290, in async_close_cover raise HomeAssistantError(f"Failed to close cover: {res[1]}") homeassistant.exceptions.HomeAssistantError: Failed to close cover: <Status.UNSUP_MANUF_CLUSTER_COMMAND: 131>

rickd1994 commented 5 months ago

I have the exact same problem

HA-smart commented 5 months ago

I confirm, same problem

QuadGhoST commented 5 months ago

This custom quirk works for me

"""Tuya MCU based cover and blinds."""
from typing import Dict, Optional, Union
from zigpy.profiles import zha
import zigpy.types as t
from zigpy.zcl import foundation
from zigpy.zcl.clusters.closures import WindowCovering
from zigpy.zcl.clusters.general import (
    Basic,
    GreenPowerProxy,
    Groups,
    Ota,
    Scenes,
    Time,
)

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    NoManufacturerCluster,
    TUYA_MCU_COMMAND,
    TuyaLocalCluster,
    TuyaWindowCover,
    TuyaManufacturerWindowCover,
)
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    TuyaClusterData,
    TuyaMCUCluster,
)

# Maps OPEN/CLOSE/STOP cover commands from Tuya to Zigbee
# https://github.com/zigpy/zigpy/blob/master/zigpy/zcl/clusters/closures.py#L558
# https://developer.tuya.com/en/docs/iot-device-dev/zigbee-curtain-switch-access-standard?id=K9ik6zvra3twv#title-7-DP1%20and%20DP4%20Curtain%20switch%201%20and%202
class TuyaCC(t.enum8):
    """Tuya cover commands."""

    OPEN = 0x00
    STOP = 0x01
    CLOSE = 0x02

class ZclCC(t.enum8):
    """ZCL cover commands."""
    OPEN = 0x00
    CLOSE = 0x01
    STOP = 0x02

TUYA2ZB_COMMANDS = {
    ZclCC.OPEN: TuyaCC.OPEN,
    ZclCC.CLOSE: TuyaCC.CLOSE,
    ZclCC.STOP: TuyaCC.STOP,
}

class TuyaWindowCovering(NoManufacturerCluster, WindowCovering, TuyaLocalCluster):
    """Tuya MCU WindowCovering cluster."""

    """Add additional attributes for direction"""
    attributes = WindowCovering.attributes.copy()
    attributes.update(
        {
            0xF000: ("curtain_switch", t.enum8, True),  # 0: open, 1: stop, 2: close
            0xF001: ("accurate_calibration", t.enum8, True),  # 0: calibration started, 1: calibration finished
            0xF002: ("motor_steering", t.enum8, True),  # 0: default, 1: reverse
            0xF003: ("travel", t.uint16_t, True),  # 30 to 9000 (units of 0.1 seconds)
        }
    )

    async def command(
        self,
        command_id: Union[foundation.GeneralCommand, int, t.uint8_t],
        *args,
        manufacturer: Optional[Union[int, t.uint16_t]] = None,
        expect_reply: bool = True,
        tsn: Optional[Union[int, t.uint8_t]] = None,
    ):
        """Override the default Cluster command."""

        # if manufacturer is None:
        #     manufacturer = self.endpoint.device.manufacturer

        self.debug(
            "Sending Tuya Cluster Command. Cluster Command is %x, Arguments are %s",
            command_id,
            args,
        )

        # (upopen, downclose, stop)
        if command_id in (0x0002, 0x0000, 0x0001):  # ?0x0003: continue?
            cluster_data = TuyaClusterData(
                endpoint_id=self.endpoint.endpoint_id,
                cluster_name=self.ep_attribute,
                cluster_attr="curtain_switch",
                attr_value=TUYA2ZB_COMMANDS[command_id],  # convert tuya2zigbee command
                expect_reply=expect_reply,
                manufacturer=-1,
            )
            self.endpoint.device.command_bus.listener_event(
                TUYA_MCU_COMMAND,
                cluster_data,
            )
            return foundation.GENERAL_COMMANDS[
                foundation.GeneralCommand.Default_Response
            ].schema(command_id=command_id, status=foundation.Status.SUCCESS)

        # (go_to_lift_percentage)
        elif command_id == 0x0005:
            lift_value = args[0]

            cluster_data = TuyaClusterData(
                endpoint_id=self.endpoint.endpoint_id,
                cluster_name=self.ep_attribute,
                cluster_attr="current_position_lift_percentage",
                attr_value=lift_value,
                expect_reply=expect_reply,
                manufacturer=-1,
            )
            self.endpoint.device.command_bus.listener_event(
                TUYA_MCU_COMMAND,
                cluster_data,
            )
            return foundation.GENERAL_COMMANDS[
                foundation.GeneralCommand.Default_Response
            ].schema(command_id=command_id, status=foundation.Status.SUCCESS)

        self.warning("Unsupported command_id: %s", command_id)
        return foundation.GENERAL_COMMANDS[
            foundation.GeneralCommand.Default_Response
        ].schema(command_id=command_id, status=foundation.Status.UNSUP_CLUSTER_COMMAND)

class TuyaWindowCoverManufCluster(TuyaMCUCluster):
    """Tuya with WindowCover data points."""

    attributes = TuyaMCUCluster.attributes.copy()
    attributes.update(
        {
            0x5000: ("backlight_mode", t.enum8, True),  # 0: off, 1: on
            0x8001: ("indicator_status", t.enum8, True),  # 0: status, 1: position, 2: off (?backlight_mode?)
        }
    )

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        1: DPToAttributeMapping(
            TuyaWindowCovering.ep_attribute,
            "curtain_switch",
        ),
        2: DPToAttributeMapping(
            TuyaWindowCovering.ep_attribute,
            "current_position_lift_percentage",  # for Slider movement
            # dp_type=TuyaDPType.VALUE,
        ),
        3: DPToAttributeMapping(
            TuyaWindowCovering.ep_attribute,
            "current_position_lift_percentage",  # for Slider updates
        ),
    }

    data_point_handlers = {
        1: "_dp_2_attr_update",
        2: "_dp_2_attr_update",
        3: "_dp_2_attr_update",
    }

class TuyaCover0601_GP(TuyaWindowCover):
    """Tuya blind controller device."""
    signature = {
        # "NodeDescriptor(
        #     logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0,
        #     reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>,
        #     mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>,
        #     manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752,
        #     maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>,
        #     *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
        # )
        MODELS_INFO: [
            ("_TZE204_xu4a5rhj", "TS0601"),
        ],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaWindowCoverManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaWindowCoverManufCluster,
                    TuyaWindowCovering,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        }
    }