Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Yale integration constants."""
2 
3 import logging
4 
5 from yalesmartalarmclient.client import (
6  YALE_STATE_ARM_FULL,
7  YALE_STATE_ARM_PARTIAL,
8  YALE_STATE_DISARM,
9 )
10 from yalesmartalarmclient.exceptions import AuthenticationError, UnknownError
11 
12 from homeassistant.components.alarm_control_panel import AlarmControlPanelState
13 from homeassistant.const import Platform
14 
15 CONF_AREA_ID = "area_id"
16 CONF_LOCK_CODE_DIGITS = "lock_code_digits"
17 DEFAULT_NAME = "Yale Smart Alarm"
18 DEFAULT_AREA_ID = "1"
19 DEFAULT_LOCK_CODE_DIGITS = 4
20 
21 MANUFACTURER = "Yale"
22 MODEL = "main"
23 
24 DOMAIN = "yale_smart_alarm"
25 
26 DEFAULT_SCAN_INTERVAL = 15
27 
28 LOGGER = logging.getLogger(__package__)
29 
30 ATTR_ONLINE = "online"
31 ATTR_STATUS = "status"
32 
33 PLATFORMS = [
34  Platform.ALARM_CONTROL_PANEL,
35  Platform.BINARY_SENSOR,
36  Platform.BUTTON,
37  Platform.LOCK,
38  Platform.SELECT,
39  Platform.SENSOR,
40  Platform.SWITCH,
41 ]
42 
43 STATE_MAP = {
44  YALE_STATE_DISARM: AlarmControlPanelState.DISARMED,
45  YALE_STATE_ARM_PARTIAL: AlarmControlPanelState.ARMED_HOME,
46  YALE_STATE_ARM_FULL: AlarmControlPanelState.ARMED_AWAY,
47 }
48 
49 YALE_BASE_ERRORS = (
50  ConnectionError,
51  TimeoutError,
52  UnknownError,
53 )
54 YALE_ALL_ERRORS = (*YALE_BASE_ERRORS, AuthenticationError)