Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the Nina integration."""
2 
3 from __future__ import annotations
4 
5 from datetime import timedelta
6 from logging import Logger, getLogger
7 from typing import Final
8 
9 _LOGGER: Logger = getLogger(__package__)
10 
11 SCAN_INTERVAL: timedelta = timedelta(minutes=5)
12 
13 DOMAIN: str = "nina"
14 
15 NO_MATCH_REGEX: str = "/(?!)/"
16 ALL_MATCH_REGEX: str = ".*"
17 
18 CONF_REGIONS: str = "regions"
19 CONF_MESSAGE_SLOTS: str = "slots"
20 CONF_FILTER_CORONA: str = "corona_filter" # deprecated
21 CONF_HEADLINE_FILTER: str = "headline_filter"
22 CONF_AREA_FILTER: str = "area_filter"
23 
24 ATTR_HEADLINE: str = "headline"
25 ATTR_DESCRIPTION: str = "description"
26 ATTR_SENDER: str = "sender"
27 ATTR_SEVERITY: str = "severity"
28 ATTR_RECOMMENDED_ACTIONS: str = "recommended_actions"
29 ATTR_AFFECTED_AREAS: str = "affected_areas"
30 ATTR_WEB: str = "web"
31 ATTR_ID: str = "id"
32 ATTR_SENT: str = "sent"
33 ATTR_START: str = "start"
34 ATTR_EXPIRES: str = "expires"
35 
36 CONST_LIST_A_TO_D: list[str] = ["A", "Ä", "B", "C", "D"]
37 CONST_LIST_E_TO_H: list[str] = ["E", "F", "G", "H"]
38 CONST_LIST_I_TO_L: list[str] = ["I", "J", "K", "L"]
39 CONST_LIST_M_TO_Q: list[str] = ["M", "N", "O", "Ö", "P", "Q"]
40 CONST_LIST_R_TO_U: list[str] = ["R", "S", "T", "U", "Ü"]
41 CONST_LIST_V_TO_Z: list[str] = ["V", "W", "X", "Y", "Z"]
42 
43 CONST_REGION_A_TO_D: Final = "_a_to_d"
44 CONST_REGION_E_TO_H: Final = "_e_to_h"
45 CONST_REGION_I_TO_L: Final = "_i_to_l"
46 CONST_REGION_M_TO_Q: Final = "_m_to_q"
47 CONST_REGION_R_TO_U: Final = "_r_to_u"
48 CONST_REGION_V_TO_Z: Final = "_v_to_z"
49 CONST_REGIONS: Final = [
50  CONST_REGION_A_TO_D,
51  CONST_REGION_E_TO_H,
52  CONST_REGION_I_TO_L,
53  CONST_REGION_M_TO_Q,
54  CONST_REGION_R_TO_U,
55  CONST_REGION_V_TO_Z,
56 ]
57 
58 CONST_REGION_MAPPING: dict[str, list[str]] = {
59  CONST_REGION_A_TO_D: CONST_LIST_A_TO_D,
60  CONST_REGION_E_TO_H: CONST_LIST_E_TO_H,
61  CONST_REGION_I_TO_L: CONST_LIST_I_TO_L,
62  CONST_REGION_M_TO_Q: CONST_LIST_M_TO_Q,
63  CONST_REGION_R_TO_U: CONST_LIST_R_TO_U,
64  CONST_REGION_V_TO_Z: CONST_LIST_V_TO_Z,
65 }