Fix ZHA covering mode for Aqara E1 curtain driver not initialized (#102749)

This commit is contained in:
TheJulianJES 2023-11-17 18:26:46 +01:00 committed by GitHub
parent 8c99cf14d3
commit c047f47595
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(