From c047f47595e5326318e85c793225b131fcf5e95e Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Fri, 17 Nov 2023 18:26:46 +0100 Subject: [PATCH] Fix ZHA covering mode for Aqara E1 curtain driver not initialized (#102749) --- .../zha/core/cluster_handlers/closures.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/core/cluster_handlers/closures.py b/homeassistant/components/zha/core/cluster_handlers/closures.py index 980a6f88a75..16c7aef89ad 100644 --- a/homeassistant/components/zha/core/cluster_handlers/closures.py +++ b/homeassistant/components/zha/core/cluster_handlers/closures.py @@ -1,6 +1,9 @@ """Closures cluster handlers module for Zigbee Home Automation.""" -from typing import Any +from __future__ import annotations +from typing import TYPE_CHECKING, Any + +import zigpy.zcl from zigpy.zcl.clusters import closures from homeassistant.core import callback @@ -9,6 +12,9 @@ from .. import registries from ..const import REPORT_CONFIG_IMMEDIATE, SIGNAL_ATTR_UPDATED from . import AttrReportConfig, ClientClusterHandler, ClusterHandler +if TYPE_CHECKING: + from ..endpoint import Endpoint + @registries.ZIGBEE_CLUSTER_HANDLER_REGISTRY.register(closures.DoorLock.cluster_id) class DoorLockClusterHandler(ClusterHandler): @@ -139,6 +145,14 @@ class WindowCovering(ClusterHandler): ), ) + def __init__(self, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> None: + """Initialize WindowCovering cluster handler.""" + super().__init__(cluster, endpoint) + + if self.cluster.endpoint.model == "lumi.curtain.agl001": + self.ZCL_INIT_ATTRS = self.ZCL_INIT_ATTRS.copy() + self.ZCL_INIT_ATTRS["window_covering_mode"] = True + async def async_update(self): """Retrieve latest state.""" result = await self.get_attribute_value(