Improve deCONZ binary sensor classes (#77419)

This commit is contained in:
Robert Svensson
2022-08-29 08:15:10 +02:00
committed by GitHub
parent 779e020dc4
commit 0154a1cecb
5 changed files with 232 additions and 202 deletions

View File

@@ -83,6 +83,7 @@ async def async_setup_entry(
class DeconzAlarmControlPanel(DeconzDevice[AncillaryControl], AlarmControlPanelEntity):
"""Representation of a deCONZ alarm control panel."""
_update_key = "panel"
TYPE = DOMAIN
_attr_code_format = CodeFormat.NUMBER
@@ -105,11 +106,7 @@ class DeconzAlarmControlPanel(DeconzDevice[AncillaryControl], AlarmControlPanelE
@callback
def async_update_callback(self) -> None:
"""Update the control panels state."""
keys = {"panel", "reachable"}
if (
self._device.changed_keys.intersection(keys)
and self._device.panel in DECONZ_TO_ALARM_STATE
):
if self._device.panel in DECONZ_TO_ALARM_STATE:
super().async_update_callback()
@property