@@ -75,6 +75,7 @@ def __init__(
7575 self ._cluster_handler = cluster_handlers [0 ]
7676 super ().__init__ (cluster_handlers , endpoint , device , ** kwargs )
7777 self ._state : bool = self .is_on
78+ self .recompute_capabilities ()
7879
7980 def on_add (self ) -> None :
8081 """Run when entity is added."""
@@ -247,16 +248,10 @@ class IASZone(BinarySensor):
247248
248249 # TODO: split this sensor off into individual sensor classes per IASZone type
249250
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" )
251+ def recompute_capabilities (self ) -> None :
252+ """Recompute capabilities."""
253+ super ().recompute_capabilities ()
254+ zone_type = self ._cluster_handler .cluster .get ("zone_type" )
260255
261256 if zone_type is None :
262257 self ._attr_translation_key = "ias_zone"
@@ -268,8 +263,6 @@ def __init__(
268263 )
269264 self ._attr_device_class = IAS_ZONE_CLASS_MAPPING .get (zone_type )
270265
271- super ().__init__ (cluster_handlers , endpoint , device , ** kwargs )
272-
273266 @staticmethod
274267 def parse (value : bool | int ) -> bool :
275268 """Parse the raw attribute into a bool state."""
0 commit comments