Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Provides the constants needed for component."""
2 
3 from enum import IntFlag, StrEnum
4 from functools import partial
5 
7  DeprecatedConstant,
8  DeprecatedConstantEnum,
9  all_with_deprecated_constants,
10  check_if_deprecated_constant,
11  dir_with_deprecated_constants,
12 )
13 
14 MODE_NORMAL = "normal"
15 MODE_ECO = "eco"
16 MODE_AWAY = "away"
17 MODE_BOOST = "boost"
18 MODE_COMFORT = "comfort"
19 MODE_HOME = "home"
20 MODE_SLEEP = "sleep"
21 MODE_AUTO = "auto"
22 MODE_BABY = "baby"
23 
24 
25 class HumidifierAction(StrEnum):
26  """Actions for humidifier devices."""
27 
28  HUMIDIFYING = "humidifying"
29  DRYING = "drying"
30  IDLE = "idle"
31  OFF = "off"
32 
33 
34 ATTR_ACTION = "action"
35 ATTR_AVAILABLE_MODES = "available_modes"
36 ATTR_CURRENT_HUMIDITY = "current_humidity"
37 ATTR_HUMIDITY = "humidity"
38 ATTR_MAX_HUMIDITY = "max_humidity"
39 ATTR_MIN_HUMIDITY = "min_humidity"
40 
41 DEFAULT_MIN_HUMIDITY = 0
42 DEFAULT_MAX_HUMIDITY = 100
43 
44 DOMAIN = "humidifier"
45 
46 # DEVICE_CLASS_* below are deprecated as of 2021.12
47 # use the HumidifierDeviceClass enum instead.
48 _DEPRECATED_DEVICE_CLASS_HUMIDIFIER = DeprecatedConstant(
49  "humidifier", "HumidifierDeviceClass.HUMIDIFIER", "2025.1"
50 )
51 _DEPRECATED_DEVICE_CLASS_DEHUMIDIFIER = DeprecatedConstant(
52  "dehumidifier", "HumidifierDeviceClass.DEHUMIDIFIER", "2025.1"
53 )
54 
55 SERVICE_SET_MODE = "set_mode"
56 SERVICE_SET_HUMIDITY = "set_humidity"
57 
58 
59 class HumidifierEntityFeature(IntFlag):
60  """Supported features of the humidifier entity."""
61 
62  MODES = 1
63 
64 
65 # The SUPPORT_MODES constant is deprecated as of Home Assistant 2022.5.
66 # Please use the HumidifierEntityFeature enum instead.
67 _DEPRECATED_SUPPORT_MODES = DeprecatedConstantEnum(
68  HumidifierEntityFeature.MODES, "2025.1"
69 )
70 
71 # These can be removed if no deprecated constant are in this module anymore
72 __getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
73 __dir__ = partial(
74  dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
75 )
76 __all__ = all_with_deprecated_constants(globals())
list[str] all_with_deprecated_constants(dict[str, Any] module_globals)
Definition: deprecation.py:356