2019-11-25 23:42:53 +00:00
|
|
|
"""Provides the constants needed for component."""
|
2024-03-08 13:51:32 +00:00
|
|
|
|
2023-07-23 21:19:24 +00:00
|
|
|
from enum import IntFlag, StrEnum
|
2023-12-20 17:41:17 +00:00
|
|
|
from functools import partial
|
2021-05-23 15:51:40 +00:00
|
|
|
from typing import Final
|
2020-03-16 23:08:06 +00:00
|
|
|
|
2023-12-20 17:41:17 +00:00
|
|
|
from homeassistant.helpers.deprecation import (
|
|
|
|
DeprecatedConstantEnum,
|
2024-01-05 10:46:45 +00:00
|
|
|
all_with_deprecated_constants,
|
2023-12-20 17:41:17 +00:00
|
|
|
check_if_deprecated_constant,
|
|
|
|
dir_with_deprecated_constants,
|
|
|
|
)
|
|
|
|
|
2022-04-04 04:59:56 +00:00
|
|
|
DOMAIN: Final = "alarm_control_panel"
|
|
|
|
|
|
|
|
ATTR_CHANGED_BY: Final = "changed_by"
|
|
|
|
ATTR_CODE_ARM_REQUIRED: Final = "code_arm_required"
|
|
|
|
|
2022-04-18 17:37:32 +00:00
|
|
|
|
|
|
|
class CodeFormat(StrEnum):
|
|
|
|
"""Code formats for the Alarm Control Panel."""
|
|
|
|
|
|
|
|
TEXT = "text"
|
|
|
|
NUMBER = "number"
|
|
|
|
|
|
|
|
|
2023-12-20 17:41:17 +00:00
|
|
|
# These constants are deprecated as of Home Assistant 2022.5, can be removed in 2025.1
|
2022-04-18 17:37:32 +00:00
|
|
|
# Please use the CodeFormat enum instead.
|
2023-12-20 17:41:17 +00:00
|
|
|
_DEPRECATED_FORMAT_TEXT: Final = DeprecatedConstantEnum(CodeFormat.TEXT, "2025.1")
|
|
|
|
_DEPRECATED_FORMAT_NUMBER: Final = DeprecatedConstantEnum(CodeFormat.NUMBER, "2025.1")
|
2022-04-04 04:59:56 +00:00
|
|
|
|
2022-04-01 11:54:03 +00:00
|
|
|
|
2022-11-16 11:43:17 +00:00
|
|
|
class AlarmControlPanelEntityFeature(IntFlag):
|
2022-04-01 11:54:03 +00:00
|
|
|
"""Supported features of the alarm control panel entity."""
|
|
|
|
|
|
|
|
ARM_HOME = 1
|
|
|
|
ARM_AWAY = 2
|
|
|
|
ARM_NIGHT = 4
|
|
|
|
TRIGGER = 8
|
|
|
|
ARM_CUSTOM_BYPASS = 16
|
|
|
|
ARM_VACATION = 32
|
|
|
|
|
|
|
|
|
|
|
|
# These constants are deprecated as of Home Assistant 2022.5
|
2022-04-04 04:59:56 +00:00
|
|
|
# Please use the AlarmControlPanelEntityFeature enum instead.
|
2023-12-20 17:41:17 +00:00
|
|
|
_DEPRECATED_SUPPORT_ALARM_ARM_HOME: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.ARM_HOME, "2025.1"
|
|
|
|
)
|
|
|
|
_DEPRECATED_SUPPORT_ALARM_ARM_AWAY: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.ARM_AWAY, "2025.1"
|
|
|
|
)
|
|
|
|
_DEPRECATED_SUPPORT_ALARM_ARM_NIGHT: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.ARM_NIGHT, "2025.1"
|
|
|
|
)
|
|
|
|
_DEPRECATED_SUPPORT_ALARM_TRIGGER: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.TRIGGER, "2025.1"
|
|
|
|
)
|
|
|
|
_DEPRECATED_SUPPORT_ALARM_ARM_CUSTOM_BYPASS: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.ARM_CUSTOM_BYPASS, "2025.1"
|
|
|
|
)
|
|
|
|
_DEPRECATED_SUPPORT_ALARM_ARM_VACATION: Final = DeprecatedConstantEnum(
|
|
|
|
AlarmControlPanelEntityFeature.ARM_VACATION, "2025.1"
|
|
|
|
)
|
|
|
|
|
2021-05-23 15:51:40 +00:00
|
|
|
CONDITION_TRIGGERED: Final = "is_triggered"
|
|
|
|
CONDITION_DISARMED: Final = "is_disarmed"
|
|
|
|
CONDITION_ARMED_HOME: Final = "is_armed_home"
|
|
|
|
CONDITION_ARMED_AWAY: Final = "is_armed_away"
|
|
|
|
CONDITION_ARMED_NIGHT: Final = "is_armed_night"
|
2021-07-01 15:26:32 +00:00
|
|
|
CONDITION_ARMED_VACATION: Final = "is_armed_vacation"
|
2021-05-23 15:51:40 +00:00
|
|
|
CONDITION_ARMED_CUSTOM_BYPASS: Final = "is_armed_custom_bypass"
|
2024-01-05 10:46:45 +00:00
|
|
|
|
|
|
|
# These can be removed if no deprecated constant are in this module anymore
|
|
|
|
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
|
|
|
|
__dir__ = partial(
|
|
|
|
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
|
|
|
|
)
|
|
|
|
__all__ = all_with_deprecated_constants(globals())
|