Implement new state property for alarm_control_panel which is using an enum (#126283)

* Alarm state from enum

* Fixes

* Set final

* Fix rebase

* Test const

* Fix breaking version

* Fix other for alarm_control_panel

* Fix integrations

* More

* More

* More

* More

* Fix zha

* Replace _attr_state

* Fix alarm_control_panel

* Fix tests

* Fixes

* Mods

* Change some

* More

* More

* More

* Tests

* Last tests

* Return enum

* Fix zha

* Remove not needed check

* Fix wording

* Fix homekit

* Mod prometheus

* Fix mypy

* Fix homekit

* Fix ifttt
This commit is contained in:
G Johansson
2024-10-21 22:54:27 +02:00
committed by GitHub
parent 59ad69b637
commit cdfec7ebb4
90 changed files with 2010 additions and 1810 deletions

View File

@@ -9,6 +9,7 @@ from typing import Any
from homeassistant import core as ha
from homeassistant.components import (
alarm_control_panel,
button,
camera,
climate,
@@ -51,7 +52,6 @@ from homeassistant.const import (
SERVICE_VOLUME_MUTE,
SERVICE_VOLUME_SET,
SERVICE_VOLUME_UP,
STATE_ALARM_DISARMED,
UnitOfTemperature,
)
from homeassistant.helpers import network
@@ -1083,7 +1083,7 @@ async def async_api_arm(
arm_state = directive.payload["armState"]
data: dict[str, Any] = {ATTR_ENTITY_ID: entity.entity_id}
if entity.state != STATE_ALARM_DISARMED:
if entity.state != alarm_control_panel.AlarmControlPanelState.DISARMED:
msg = "You must disarm the system before you can set the requested arm state."
raise AlexaSecurityPanelAuthorizationRequired(msg)
@@ -1133,7 +1133,7 @@ async def async_api_disarm(
# Per Alexa Documentation: If you receive a Disarm directive, and the
# system is already disarmed, respond with a success response,
# not an error response.
if entity.state == STATE_ALARM_DISARMED:
if entity.state == alarm_control_panel.AlarmControlPanelState.DISARMED:
return response
payload = directive.payload