mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 03:19:34 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user