Skip to content

Commit

Permalink
fix alarm state
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilp committed Mar 18, 2024
1 parent 2342815 commit bb32df5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions custom_components/deltadore_tydom/ha_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ async def async_turn_off(self, **kwargs):
class HaAlarm(AlarmControlPanelEntity, HAEntity):
"""Representation of an Alarm."""

should_poll = True
should_poll = False
supported_features = 0
sensor_classes = {
"networkDefect": BinarySensorDeviceClass.PROBLEM,
Expand Down Expand Up @@ -949,15 +949,21 @@ def state(self) -> str | None:
if self._device.alarmMode == "MAINTENANCE":
return STATE_ALARM_DISARMED

match self._device.alarmState:
match self._device.alarmMode:
case "MAINTENANCE":
return STATE_ALARM_DISARMED
case "OFF":
return STATE_ALARM_DISARMED
case "ON":
match self._device.alarmMode:
case "ON":
return STATE_ALARM_ARMED_AWAY
case "ZONE" | "PART":
return STATE_ALARM_ARMED_HOME
if self._device.alarmState == "OFF":
return STATE_ALARM_ARMED_AWAY
else:
return STATE_ALARM_TRIGGERED
case "ZONE" | "PART":
if self._device.alarmState == "OFF":
return STATE_ALARM_ARMED_HOME
else:
return STATE_ALARM_TRIGGERED
case _:
return STATE_ALARM_TRIGGERED

Expand Down

0 comments on commit bb32df5

Please sign in to comment.