hass-core/homeassistant/components/yale_smart_alarm/const.py
G Johansson cdfec7ebb4
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
2024-10-21 22:54:27 +02:00

54 lines
1.2 KiB
Python

"""Yale integration constants."""
import logging
from yalesmartalarmclient.client import (
YALE_STATE_ARM_FULL,
YALE_STATE_ARM_PARTIAL,
YALE_STATE_DISARM,
)
from yalesmartalarmclient.exceptions import AuthenticationError, UnknownError
from homeassistant.components.alarm_control_panel import AlarmControlPanelState
from homeassistant.const import Platform
CONF_AREA_ID = "area_id"
CONF_LOCK_CODE_DIGITS = "lock_code_digits"
DEFAULT_NAME = "Yale Smart Alarm"
DEFAULT_AREA_ID = "1"
DEFAULT_LOCK_CODE_DIGITS = 4
MANUFACTURER = "Yale"
MODEL = "main"
DOMAIN = "yale_smart_alarm"
DEFAULT_SCAN_INTERVAL = 15
LOGGER = logging.getLogger(__package__)
ATTR_ONLINE = "online"
ATTR_STATUS = "status"
PLATFORMS = [
Platform.ALARM_CONTROL_PANEL,
Platform.BINARY_SENSOR,
Platform.BUTTON,
Platform.LOCK,
Platform.SELECT,
Platform.SENSOR,
Platform.SWITCH,
]
STATE_MAP = {
YALE_STATE_DISARM: AlarmControlPanelState.DISARMED,
YALE_STATE_ARM_PARTIAL: AlarmControlPanelState.ARMED_HOME,
YALE_STATE_ARM_FULL: AlarmControlPanelState.ARMED_AWAY,
}
YALE_BASE_ERRORS = (
ConnectionError,
TimeoutError,
UnknownError,
)
YALE_ALL_ERRORS = (*YALE_BASE_ERRORS, AuthenticationError)