Skip to content

Commit 359450e

Browse files
committed
Fix IasZone binary sensor not implementing recompute_capabilities
1 parent b172549 commit 359450e

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

zha/application/platforms/binary_sensor/__init__.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,10 @@ class IASZone(BinarySensor):
247247

248248
# TODO: split this sensor off into individual sensor classes per IASZone type
249249

250-
def __init__(
251-
self,
252-
cluster_handlers: list[ClusterHandler],
253-
endpoint: Endpoint,
254-
device: Device,
255-
**kwargs,
256-
) -> None:
257-
"""Initialize the ZHA binary sensor."""
258-
cluster_handler = cluster_handlers[0]
259-
zone_type = cluster_handler.cluster.get("zone_type")
250+
def recompute_capabilities(self) -> None:
251+
"""Recompute capabilities."""
252+
super().recompute_capabilities()
253+
zone_type = self._cluster_handler.cluster.get("zone_type")
260254

261255
if zone_type is None:
262256
self._attr_translation_key = "ias_zone"
@@ -268,8 +262,6 @@ def __init__(
268262
)
269263
self._attr_device_class = IAS_ZONE_CLASS_MAPPING.get(zone_type)
270264

271-
super().__init__(cluster_handlers, endpoint, device, **kwargs)
272-
273265
@staticmethod
274266
def parse(value: bool | int) -> bool:
275267
"""Parse the raw attribute into a bool state."""

0 commit comments

Comments
 (0)