diff --git a/.strict-typing b/.strict-typing index e808b54c85e..8662e77108e 100644 --- a/.strict-typing +++ b/.strict-typing @@ -63,6 +63,7 @@ homeassistant.components.cover.* homeassistant.components.crownstone.* homeassistant.components.cpuspeed.* homeassistant.components.deconz +homeassistant.components.deconz.alarm_control_panel homeassistant.components.deconz.config_flow homeassistant.components.deconz.diagnostics homeassistant.components.deconz.gateway diff --git a/homeassistant/components/deconz/alarm_control_panel.py b/homeassistant/components/deconz/alarm_control_panel.py index c266cd5accd..4ae199c446f 100644 --- a/homeassistant/components/deconz/alarm_control_panel.py +++ b/homeassistant/components/deconz/alarm_control_panel.py @@ -150,20 +150,26 @@ class DeconzAlarmControlPanel(DeconzDevice, AlarmControlPanelEntity): @property def state(self) -> str | None: """Return the state of the control panel.""" - return DECONZ_TO_ALARM_STATE.get(self._device.panel) + if self._device.panel in DECONZ_TO_ALARM_STATE: + return DECONZ_TO_ALARM_STATE[self._device.panel] + return None async def async_alarm_arm_away(self, code: str | None = None) -> None: """Send arm away command.""" - await self.alarm_system.arm_away(code) + if code: + await self.alarm_system.arm_away(code) async def async_alarm_arm_home(self, code: str | None = None) -> None: """Send arm home command.""" - await self.alarm_system.arm_stay(code) + if code: + await self.alarm_system.arm_stay(code) async def async_alarm_arm_night(self, code: str | None = None) -> None: """Send arm night command.""" - await self.alarm_system.arm_night(code) + if code: + await self.alarm_system.arm_night(code) async def async_alarm_disarm(self, code: str | None = None) -> None: """Send disarm command.""" - await self.alarm_system.disarm(code) + if code: + await self.alarm_system.disarm(code) diff --git a/mypy.ini b/mypy.ini index b1fdbd6b7dc..66a7671ea35 100644 --- a/mypy.ini +++ b/mypy.ini @@ -495,6 +495,17 @@ no_implicit_optional = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.deconz.alarm_control_panel] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +no_implicit_optional = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.deconz.config_flow] check_untyped_defs = true disallow_incomplete_defs = true @@ -2587,9 +2598,6 @@ ignore_errors = true [mypy-homeassistant.components.conversation.default_agent] ignore_errors = true -[mypy-homeassistant.components.deconz.alarm_control_panel] -ignore_errors = true - [mypy-homeassistant.components.deconz.binary_sensor] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index b08272a616c..1c0fe6be6e5 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -23,7 +23,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.cloud.http_api", "homeassistant.components.conversation", "homeassistant.components.conversation.default_agent", - "homeassistant.components.deconz.alarm_control_panel", "homeassistant.components.deconz.binary_sensor", "homeassistant.components.deconz.climate", "homeassistant.components.deconz.cover",