Improve typing of deCONZ alarm control panel (#69680)

* Improve typing of deCONZ alarm control panel

* Fix review comments
This commit is contained in:
Robert Svensson 2022-04-11 16:19:54 +02:00 committed by GitHub
parent 6bc74ca745
commit 81a55703bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 9 deletions

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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",