Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Const for TP-Link."""
2 
3 from __future__ import annotations
4 
5 from typing import Final
6 
7 from homeassistant.const import Platform, UnitOfTemperature
8 
9 DOMAIN = "tplink"
10 
11 DISCOVERY_TIMEOUT = 5 # Home Assistant will complain if startup takes > 10s
12 CONNECT_TIMEOUT = 5
13 
14 # Identifier used for primary control state.
15 PRIMARY_STATE_ID = "state"
16 
17 ATTR_CURRENT_A: Final = "current_a"
18 ATTR_CURRENT_POWER_W: Final = "current_power_w"
19 ATTR_TODAY_ENERGY_KWH: Final = "today_energy_kwh"
20 ATTR_TOTAL_ENERGY_KWH: Final = "total_energy_kwh"
21 
22 CONF_DEVICE_CONFIG: Final = "device_config"
23 CONF_CREDENTIALS_HASH: Final = "credentials_hash"
24 CONF_CONNECTION_PARAMETERS: Final = "connection_parameters"
25 CONF_USES_HTTP: Final = "uses_http"
26 CONF_AES_KEYS: Final = "aes_keys"
27 
28 CONF_CONFIG_ENTRY_MINOR_VERSION: Final = 5
29 
30 PLATFORMS: Final = [
31  Platform.BINARY_SENSOR,
32  Platform.BUTTON,
33  Platform.CLIMATE,
34  Platform.FAN,
35  Platform.LIGHT,
36  Platform.NUMBER,
37  Platform.SELECT,
38  Platform.SENSOR,
39  Platform.SIREN,
40  Platform.SWITCH,
41 ]
42 
43 UNIT_MAPPING = {
44  "celsius": UnitOfTemperature.CELSIUS,
45  "fahrenheit": UnitOfTemperature.FAHRENHEIT,
46 }