Skip to content

Commit

Permalink
Use AlarmControlPanelState instead of the STATE_ALARM_* constants
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsverkoyen committed Dec 6, 2024
1 parent 318a115 commit a53f84d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity, AlarmControlPanelEntityFeature
from homeassistant.const import STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMING
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity, AlarmControlPanelEntityFeature, \
AlarmControlPanelState

from ..nhccoco.devices.alarms_action import CocoAlarmsAction
from .nhc_entity import NHCBaseEntity
Expand All @@ -21,11 +21,11 @@ def __init__(self, device_instance: CocoAlarmsAction, hub, gateway):
@property
def state(self) -> str:
if self._device.is_basic_state_off:
return STATE_ALARM_DISARMED
return AlarmControlPanelState.DISARMED
if self._device.is_basic_state_on:
return STATE_ALARM_ARMED_AWAY
return AlarmControlPanelState.ARMED_AWAY
if self._device.is_basic_state_intermediate:
return STATE_ALARM_ARMING
return AlarmControlPanelState.ARMING

async def async_alarm_arm_away(self, code=None) -> None:
self._device.arm(self._gateway)
Expand Down

0 comments on commit a53f84d

Please sign in to comment.