Update imports from alarm_control_panel (#117014)
This commit is contained in:
parent
1559562c26
commit
95a27796f2
9 changed files with 55 additions and 35 deletions
|
@ -9,10 +9,11 @@ from concord232 import client as concord232_client
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_CODE,
|
||||
|
@ -70,10 +71,10 @@ def setup_platform(
|
|||
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
|
||||
|
||||
|
||||
class Concord232Alarm(alarm.AlarmControlPanelEntity):
|
||||
class Concord232Alarm(AlarmControlPanelEntity):
|
||||
"""Representation of the Concord232-based alarm panel."""
|
||||
|
||||
_attr_code_format = alarm.CodeFormat.NUMBER
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_state: str | None
|
||||
_attr_supported_features = (
|
||||
AlarmControlPanelEntityFeature.ARM_HOME
|
||||
|
|
|
@ -6,8 +6,10 @@ import logging
|
|||
|
||||
import requests
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
|
@ -61,7 +63,7 @@ def setup_platform(
|
|||
add_entities([device], True)
|
||||
|
||||
|
||||
class EgardiaAlarm(alarm.AlarmControlPanelEntity):
|
||||
class EgardiaAlarm(AlarmControlPanelEntity):
|
||||
"""Representation of a Egardia alarm."""
|
||||
|
||||
_attr_state: str | None
|
||||
|
|
|
@ -8,8 +8,11 @@ from typing import Any
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_ARMING_TIME,
|
||||
CONF_CODE,
|
||||
|
@ -174,7 +177,7 @@ def setup_platform(
|
|||
)
|
||||
|
||||
|
||||
class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
||||
class ManualAlarm(AlarmControlPanelEntity, RestoreEntity):
|
||||
"""Representation of an alarm status.
|
||||
|
||||
When armed, will be arming for 'arming_time', after that armed.
|
||||
|
@ -276,13 +279,13 @@ class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
|||
return self._state_ts + self._pending_time(state) > dt_util.utcnow()
|
||||
|
||||
@property
|
||||
def code_format(self) -> alarm.CodeFormat | None:
|
||||
def code_format(self) -> CodeFormat | None:
|
||||
"""Return one or more digits/characters."""
|
||||
if self._code is None:
|
||||
return None
|
||||
if isinstance(self._code, str) and self._code.isdigit():
|
||||
return alarm.CodeFormat.NUMBER
|
||||
return alarm.CodeFormat.TEXT
|
||||
return CodeFormat.NUMBER
|
||||
return CodeFormat.TEXT
|
||||
|
||||
async def async_alarm_disarm(self, code: str | None = None) -> None:
|
||||
"""Send disarm command."""
|
||||
|
|
|
@ -9,8 +9,11 @@ from typing import Any
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import mqtt
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_CODE,
|
||||
CONF_DELAY_TIME,
|
||||
|
@ -224,7 +227,7 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
|
||||
class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
||||
class ManualMQTTAlarm(AlarmControlPanelEntity):
|
||||
"""Representation of an alarm status.
|
||||
|
||||
When armed, will be pending for 'pending_time', after that armed.
|
||||
|
@ -342,13 +345,13 @@ class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
|||
return self._state_ts + self._pending_time(state) > dt_util.utcnow()
|
||||
|
||||
@property
|
||||
def code_format(self) -> alarm.CodeFormat | None:
|
||||
def code_format(self) -> CodeFormat | None:
|
||||
"""Return one or more digits/characters."""
|
||||
if self._code is None:
|
||||
return None
|
||||
if isinstance(self._code, str) and self._code.isdigit():
|
||||
return alarm.CodeFormat.NUMBER
|
||||
return alarm.CodeFormat.TEXT
|
||||
return CodeFormat.NUMBER
|
||||
return CodeFormat.TEXT
|
||||
|
||||
async def async_alarm_disarm(self, code: str | None = None) -> None:
|
||||
"""Send disarm command."""
|
||||
|
|
|
@ -6,8 +6,11 @@ import logging
|
|||
|
||||
from nessclient import ArmingMode, ArmingState, Client
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
|
@ -51,10 +54,10 @@ async def async_setup_platform(
|
|||
async_add_entities([device])
|
||||
|
||||
|
||||
class NessAlarmPanel(alarm.AlarmControlPanelEntity):
|
||||
class NessAlarmPanel(AlarmControlPanelEntity):
|
||||
"""Representation of a Ness alarm panel."""
|
||||
|
||||
_attr_code_format = alarm.CodeFormat.NUMBER
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_should_poll = False
|
||||
_attr_supported_features = (
|
||||
AlarmControlPanelEntityFeature.ARM_HOME
|
||||
|
|
|
@ -9,10 +9,11 @@ from nx584 import client
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
|
@ -90,10 +91,10 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
|
||||
class NX584Alarm(alarm.AlarmControlPanelEntity):
|
||||
class NX584Alarm(AlarmControlPanelEntity):
|
||||
"""Representation of a NX584-based alarm panel."""
|
||||
|
||||
_attr_code_format = alarm.CodeFormat.NUMBER
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_state: str | None
|
||||
_attr_supported_features = (
|
||||
AlarmControlPanelEntityFeature.ARM_HOME
|
||||
|
|
|
@ -7,8 +7,10 @@ import logging
|
|||
from pyprosegur.auth import Auth
|
||||
from pyprosegur.installation import Installation, Status
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
|
@ -41,7 +43,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class ProsegurAlarm(alarm.AlarmControlPanelEntity):
|
||||
class ProsegurAlarm(AlarmControlPanelEntity):
|
||||
"""Representation of a Prosegur alarm status."""
|
||||
|
||||
_attr_supported_features = (
|
||||
|
|
|
@ -8,8 +8,11 @@ import logging
|
|||
|
||||
from satel_integra.satel_integra import AlarmState
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
|
@ -59,10 +62,10 @@ async def async_setup_platform(
|
|||
async_add_entities(devices)
|
||||
|
||||
|
||||
class SatelIntegraAlarmPanel(alarm.AlarmControlPanelEntity):
|
||||
class SatelIntegraAlarmPanel(AlarmControlPanelEntity):
|
||||
"""Representation of an AlarmDecoder-based alarm panel."""
|
||||
|
||||
_attr_code_format = alarm.CodeFormat.NUMBER
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_should_poll = False
|
||||
_attr_state: str | None
|
||||
_attr_supported_features = (
|
||||
|
|
|
@ -6,8 +6,10 @@ from pyspcwebgw import SpcWebGateway
|
|||
from pyspcwebgw.area import Area
|
||||
from pyspcwebgw.const import AreaMode
|
||||
|
||||
import homeassistant.components.alarm_control_panel as alarm
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
|
@ -51,7 +53,7 @@ async def async_setup_platform(
|
|||
async_add_entities([SpcAlarm(area=area, api=api) for area in api.areas.values()])
|
||||
|
||||
|
||||
class SpcAlarm(alarm.AlarmControlPanelEntity):
|
||||
class SpcAlarm(AlarmControlPanelEntity):
|
||||
"""Representation of the SPC alarm panel."""
|
||||
|
||||
_attr_should_poll = False
|
||||
|
|
Loading…
Add table
Reference in a new issue