Improve typing of deCONZ alarm control panel (#69680)
* Improve typing of deCONZ alarm control panel * Fix review comments
This commit is contained in:
parent
6bc74ca745
commit
81a55703bf
4 changed files with 23 additions and 9 deletions
|
@ -63,6 +63,7 @@ homeassistant.components.cover.*
|
||||||
homeassistant.components.crownstone.*
|
homeassistant.components.crownstone.*
|
||||||
homeassistant.components.cpuspeed.*
|
homeassistant.components.cpuspeed.*
|
||||||
homeassistant.components.deconz
|
homeassistant.components.deconz
|
||||||
|
homeassistant.components.deconz.alarm_control_panel
|
||||||
homeassistant.components.deconz.config_flow
|
homeassistant.components.deconz.config_flow
|
||||||
homeassistant.components.deconz.diagnostics
|
homeassistant.components.deconz.diagnostics
|
||||||
homeassistant.components.deconz.gateway
|
homeassistant.components.deconz.gateway
|
||||||
|
|
|
@ -150,20 +150,26 @@ class DeconzAlarmControlPanel(DeconzDevice, AlarmControlPanelEntity):
|
||||||
@property
|
@property
|
||||||
def state(self) -> str | None:
|
def state(self) -> str | None:
|
||||||
"""Return the state of the control panel."""
|
"""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:
|
async def async_alarm_arm_away(self, code: str | None = None) -> None:
|
||||||
"""Send arm away command."""
|
"""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:
|
async def async_alarm_arm_home(self, code: str | None = None) -> None:
|
||||||
"""Send arm home command."""
|
"""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:
|
async def async_alarm_arm_night(self, code: str | None = None) -> None:
|
||||||
"""Send arm night command."""
|
"""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:
|
async def async_alarm_disarm(self, code: str | None = None) -> None:
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
await self.alarm_system.disarm(code)
|
if code:
|
||||||
|
await self.alarm_system.disarm(code)
|
||||||
|
|
14
mypy.ini
14
mypy.ini
|
@ -495,6 +495,17 @@ no_implicit_optional = true
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = 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]
|
[mypy-homeassistant.components.deconz.config_flow]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
@ -2587,9 +2598,6 @@ ignore_errors = true
|
||||||
[mypy-homeassistant.components.conversation.default_agent]
|
[mypy-homeassistant.components.conversation.default_agent]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.deconz.alarm_control_panel]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.deconz.binary_sensor]
|
[mypy-homeassistant.components.deconz.binary_sensor]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||||
"homeassistant.components.cloud.http_api",
|
"homeassistant.components.cloud.http_api",
|
||||||
"homeassistant.components.conversation",
|
"homeassistant.components.conversation",
|
||||||
"homeassistant.components.conversation.default_agent",
|
"homeassistant.components.conversation.default_agent",
|
||||||
"homeassistant.components.deconz.alarm_control_panel",
|
|
||||||
"homeassistant.components.deconz.binary_sensor",
|
"homeassistant.components.deconz.binary_sensor",
|
||||||
"homeassistant.components.deconz.climate",
|
"homeassistant.components.deconz.climate",
|
||||||
"homeassistant.components.deconz.cover",
|
"homeassistant.components.deconz.cover",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue