Entity attributes + typing fix in deCONZ alarm control panel (#51241)

This commit is contained in:
Franck Nijhof 2021-05-31 14:54:42 +02:00 committed by GitHub
parent 5377e5ed38
commit edcae74330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,35 +102,20 @@ class DeconzAlarmControlPanel(DeconzDevice, AlarmControlPanelEntity):
TYPE = DOMAIN
_attr_code_arm_required = False
_attr_supported_features = (
SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_NIGHT
)
def __init__(self, device, gateway) -> None:
"""Set up alarm control panel device."""
super().__init__(device, gateway)
self._features = SUPPORT_ALARM_ARM_AWAY
self._features |= SUPPORT_ALARM_ARM_HOME
self._features |= SUPPORT_ALARM_ARM_NIGHT
self._service_to_device_panel_command = {
PANEL_ENTRY_DELAY: self._device.entry_delay,
PANEL_EXIT_DELAY: self._device.exit_delay,
PANEL_NOT_READY_TO_ARM: self._device.not_ready_to_arm,
}
@property
def supported_features(self) -> int:
"""Return the list of supported features."""
return self._features
@property
def code_arm_required(self) -> bool:
"""Code is not required for arm actions."""
return False
@property
def code_format(self) -> None:
"""Code is not supported."""
return None
@callback
def async_update_callback(self, force_update: bool = False) -> None:
"""Update the control panels state."""
@ -142,7 +127,7 @@ class DeconzAlarmControlPanel(DeconzDevice, AlarmControlPanelEntity):
super().async_update_callback(force_update=force_update)
@property
def state(self) -> str:
def state(self) -> str | None:
"""Return the state of the control panel."""
return DECONZ_TO_ALARM_STATE.get(self._device.state)