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.
ZHA has correctly identified lumi.curtain.acn04.
I can only use the curtain position to control it opening and closing.
Using the button provides an error message:
日志: homeassistant.components.websocket_api.http.connection
来源: components/websocket_api/commands.py:239
集成: Home Assistant WebSocket API (文档, 问题)
首次发生: 16:48:43 (1 全部发生)
上次记录: 16:48:43
[140211060919104] Failed to close cover: <Status.FAILURE: 1>
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 2543, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, 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: <Status.FAILURE: 1>
Solution description
The status information is now correct.
I want to use the buttons to control this device correctly.
Problem description
Here's my previous request: #2739
ZHA has correctly identified lumi.curtain.acn04. I can only use the curtain position to control it opening and closing.
Using the button provides an error message:
Solution description
The status information is now correct.
I want to use the buttons to control this device correctly.
Screenshots/Video
Screenshots/Video
[Paste/upload your media here]Device signature
Device signature
```json { "node_descriptor": "NodeDescriptor(logical_type=Diagnostic information
Diagnostic information
```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.4.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "Asia/Shanghai", "os_name": "Linux", "os_version": "6.6.25-haos", "supervisor": "2024.04.0", "host_os": "Home Assistant OS 12.2", "docker_version": "25.0.5", "chassis": "vm", "run_as_root": true }, "custom_components": { "ikuai": { "version": "1.3", "requirements": [] }, "webrtc": { "version": "v3.5.2", "requirements": [] }, "adaptive_lighting": { "version": "1.21.1", "requirements": [ "ulid-transform" ] }, "frigate": { "version": "5.1.0", "requirements": [ "pytz" ] }, "ipmi": { "version": "1.6.0", "requirements": [ "python-ipmi" ] }, "ha_file_explorer": { "version": "2023.4.20", "requirements": [] }, "browser_mod": { "version": "2.3.0", "requirements": [] }, "nodered": { "version": "3.1.5", "requirements": [] }, "bemfa": { "version": "1.4.0", "requirements": [ "paho-mqtt==1.6.1" ] }, "qweather": { "version": "2024.1.4", "requirements": [ "requests", "beautifulsoup4" ] }, "ha_cloud_music": { "version": "2024.1.17", "requirements": [ "beautifulsoup4>=4.11.1", "lxml>=4.9.1" ] }, "dahua": { "version": "0.5.0", "requirements": [] }, "openwrt": { "version": "1.3", "requirements": [] }, "ui_lovelace_minimalist": { "version": "v1.3.9", "requirements": [ "aiofiles==0.8.0", "aiogithubapi>=22.2.4" ] }, "xiaomi_miot": { "version": "0.7.17", "requirements": [ "construct>=2.10.68", "python-miio>=0.5.12", "micloud>=0.5" ] }, "xiaomi_gateway3": { "version": "4.0.4", "requirements": [ "zigpy>=0.52.3" ] }, "hacs": { "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "ble_monitor": { "version": "12.10.4", "requirements": [ "pycryptodomex>=3.18.0", "janus>=1.0.0", "aioblescan>=0.2.14", "btsocket>=0.2.0", "pyric>=0.1.6.3" ] }, "zha_toolkit": { "version": "v1.1.10", "requirements": [ "pytz" ] } }, "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.1", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.114", "zigpy-deconz==0.23.1", "zigpy==0.63.5", "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": 39656, "manufacturer": "Aqara", "model": "lumi.curtain.acn04", "name": "Aqara lumi.curtain.acn04", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "quirk_id": null, "manufacturer_code": 4447, "power_source": "Mains", "lqi": 36, "rssi": null, "last_seen": "2024-04-28T16:49:28", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=Logs
Logs
```python 2024-04-28 13:48:42.738 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=64704, SrcAddr=0x159D, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=Custom quirk
Custom quirk
```python from zigpy.quirks import CustomCluster from zigpy.profiles import zha from zigpy.zcl.clusters.general import ( Basic, PowerConfiguration, Identify, Ota ) from zigpy.zcl.clusters.closures import WindowCovering from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster from zigpy.types import uint8_t, uint32_t from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.xiaomi import LUMI, XiaomiCustomDevice # 自定义窗帘控制集群 class WindowCoveringC3(CustomCluster, WindowCovering): """自定义窗帘控制集群,处理状态反转等需求""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def set_full_open(self): self._write_attributes({'target_position': 0}) def set_full_close(self): self._write_attributes({'target_position': 100}) # 定义LumiCurtainACN04设备类 class DriverC3(XiaomiCustomDevice): signature = { MODELS_INFO: [(LUMI, "lumi.curtain.acn04")], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE, # 修改为窗帘设备类型 INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, Identify.cluster_id, WindowCoveringC3, # 使用自定义窗帘控制集群 ManufacturerSpecificCluster.cluster_id, ], OUTPUT_CLUSTERS: [ Identify.cluster_id, Ota.cluster_id, ], } }, } replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, Identify.cluster_id, WindowCoveringC3, # 确保替换为自定义集群 ], OUTPUT_CLUSTERS: [ Identify.cluster_id, Ota.cluster_id, ], } }, } ```Additional information
The ZHA quirks file is written using AI. The log reports that quirks are loaded correctly.
The device is not loading quirks properly.