Fix envisalink alarm (#119212)
This commit is contained in:
parent
93fa9e778b
commit
09ba9547ed
1 changed files with 6 additions and 33 deletions
|
@ -116,8 +116,9 @@ class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
|||
):
|
||||
"""Initialize the alarm panel."""
|
||||
self._partition_number = partition_number
|
||||
self._code = code
|
||||
self._panic_type = panic_type
|
||||
self._alarm_control_panel_option_default_code = code
|
||||
self._attr_code_format = CodeFormat.NUMBER
|
||||
|
||||
_LOGGER.debug("Setting up alarm: %s", alarm_name)
|
||||
super().__init__(alarm_name, info, controller)
|
||||
|
@ -141,13 +142,6 @@ class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
|||
if partition is None or int(partition) == self._partition_number:
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def code_format(self) -> CodeFormat | None:
|
||||
"""Regex for code format or None if no code is required."""
|
||||
if self._code:
|
||||
return None
|
||||
return CodeFormat.NUMBER
|
||||
|
||||
@property
|
||||
def state(self) -> str:
|
||||
"""Return the state of the device."""
|
||||
|
@ -169,34 +163,15 @@ class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
|||
|
||||
async def async_alarm_disarm(self, code: str | None = None) -> None:
|
||||
"""Send disarm command."""
|
||||
if code:
|
||||
self.hass.data[DATA_EVL].disarm_partition(str(code), self._partition_number)
|
||||
else:
|
||||
self.hass.data[DATA_EVL].disarm_partition(
|
||||
str(self._code), self._partition_number
|
||||
)
|
||||
self.hass.data[DATA_EVL].disarm_partition(code, self._partition_number)
|
||||
|
||||
async def async_alarm_arm_home(self, code: str | None = None) -> None:
|
||||
"""Send arm home command."""
|
||||
if code:
|
||||
self.hass.data[DATA_EVL].arm_stay_partition(
|
||||
str(code), self._partition_number
|
||||
)
|
||||
else:
|
||||
self.hass.data[DATA_EVL].arm_stay_partition(
|
||||
str(self._code), self._partition_number
|
||||
)
|
||||
self.hass.data[DATA_EVL].arm_stay_partition(code, self._partition_number)
|
||||
|
||||
async def async_alarm_arm_away(self, code: str | None = None) -> None:
|
||||
"""Send arm away command."""
|
||||
if code:
|
||||
self.hass.data[DATA_EVL].arm_away_partition(
|
||||
str(code), self._partition_number
|
||||
)
|
||||
else:
|
||||
self.hass.data[DATA_EVL].arm_away_partition(
|
||||
str(self._code), self._partition_number
|
||||
)
|
||||
self.hass.data[DATA_EVL].arm_away_partition(code, self._partition_number)
|
||||
|
||||
async def async_alarm_trigger(self, code: str | None = None) -> None:
|
||||
"""Alarm trigger command. Will be used to trigger a panic alarm."""
|
||||
|
@ -204,9 +179,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
|||
|
||||
async def async_alarm_arm_night(self, code: str | None = None) -> None:
|
||||
"""Send arm night command."""
|
||||
self.hass.data[DATA_EVL].arm_night_partition(
|
||||
str(code) if code else str(self._code), self._partition_number
|
||||
)
|
||||
self.hass.data[DATA_EVL].arm_night_partition(code, self._partition_number)
|
||||
|
||||
@callback
|
||||
def async_alarm_keypress(self, keypress=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue