2021-09-18 19:25:05 +00:00
|
|
|
"""Constants for the switchbot integration."""
|
2022-08-10 19:02:08 +00:00
|
|
|
from switchbot import SwitchbotModel
|
|
|
|
|
|
|
|
from homeassistant.backports.enum import StrEnum
|
|
|
|
|
2021-09-18 19:25:05 +00:00
|
|
|
DOMAIN = "switchbot"
|
|
|
|
MANUFACTURER = "switchbot"
|
|
|
|
|
|
|
|
# Config Attributes
|
2022-08-10 19:02:08 +00:00
|
|
|
|
2021-09-18 19:25:05 +00:00
|
|
|
DEFAULT_NAME = "Switchbot"
|
2022-08-02 10:38:31 +00:00
|
|
|
|
2022-08-10 19:02:08 +00:00
|
|
|
|
|
|
|
class SupportedModels(StrEnum):
|
|
|
|
"""Supported Switchbot models."""
|
|
|
|
|
|
|
|
BOT = "bot"
|
|
|
|
BULB = "bulb"
|
2022-09-07 11:12:17 +00:00
|
|
|
CEILING_LIGHT = "ceiling_light"
|
2022-08-10 19:02:08 +00:00
|
|
|
CURTAIN = "curtain"
|
|
|
|
HYGROMETER = "hygrometer"
|
2022-08-29 14:30:09 +00:00
|
|
|
LIGHT_STRIP = "light_strip"
|
2022-08-10 19:02:08 +00:00
|
|
|
CONTACT = "contact"
|
|
|
|
PLUG = "plug"
|
|
|
|
MOTION = "motion"
|
2022-12-10 18:56:57 +00:00
|
|
|
HUMIDIFIER = "humidifier"
|
2022-12-28 04:16:00 +00:00
|
|
|
LOCK = "lock"
|
2023-02-17 03:06:02 +00:00
|
|
|
BLIND_TILT = "blind_tilt"
|
2022-08-10 19:02:08 +00:00
|
|
|
|
|
|
|
|
2022-08-22 18:02:26 +00:00
|
|
|
CONNECTABLE_SUPPORTED_MODEL_TYPES = {
|
2022-08-10 19:02:08 +00:00
|
|
|
SwitchbotModel.BOT: SupportedModels.BOT,
|
|
|
|
SwitchbotModel.CURTAIN: SupportedModels.CURTAIN,
|
2022-08-22 18:02:26 +00:00
|
|
|
SwitchbotModel.PLUG_MINI: SupportedModels.PLUG,
|
|
|
|
SwitchbotModel.COLOR_BULB: SupportedModels.BULB,
|
2022-08-29 14:30:09 +00:00
|
|
|
SwitchbotModel.LIGHT_STRIP: SupportedModels.LIGHT_STRIP,
|
2022-09-07 11:12:17 +00:00
|
|
|
SwitchbotModel.CEILING_LIGHT: SupportedModels.CEILING_LIGHT,
|
2022-12-10 18:56:57 +00:00
|
|
|
SwitchbotModel.HUMIDIFIER: SupportedModels.HUMIDIFIER,
|
2022-12-28 04:16:00 +00:00
|
|
|
SwitchbotModel.LOCK: SupportedModels.LOCK,
|
2023-02-17 03:06:02 +00:00
|
|
|
SwitchbotModel.BLIND_TILT: SupportedModels.BLIND_TILT,
|
2022-08-22 18:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NON_CONNECTABLE_SUPPORTED_MODEL_TYPES = {
|
2022-08-10 19:02:08 +00:00
|
|
|
SwitchbotModel.METER: SupportedModels.HYGROMETER,
|
|
|
|
SwitchbotModel.CONTACT_SENSOR: SupportedModels.CONTACT,
|
|
|
|
SwitchbotModel.MOTION_SENSOR: SupportedModels.MOTION,
|
2022-07-22 16:03:02 +00:00
|
|
|
}
|
2021-09-18 19:25:05 +00:00
|
|
|
|
2022-08-29 14:30:09 +00:00
|
|
|
SUPPORTED_MODEL_TYPES = (
|
|
|
|
CONNECTABLE_SUPPORTED_MODEL_TYPES | NON_CONNECTABLE_SUPPORTED_MODEL_TYPES
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
HASS_SENSOR_TYPE_TO_SWITCHBOT_MODEL = {
|
|
|
|
str(v): k for k, v in SUPPORTED_MODEL_TYPES.items()
|
2022-08-22 18:02:26 +00:00
|
|
|
}
|
2022-08-10 19:02:08 +00:00
|
|
|
|
2021-09-18 19:25:05 +00:00
|
|
|
# Config Defaults
|
|
|
|
DEFAULT_RETRY_COUNT = 3
|
|
|
|
|
|
|
|
# Config Options
|
|
|
|
CONF_RETRY_COUNT = "retry_count"
|
2022-12-28 04:16:00 +00:00
|
|
|
CONF_KEY_ID = "key_id"
|
|
|
|
CONF_ENCRYPTION_KEY = "encryption_key"
|
2021-09-18 19:25:05 +00:00
|
|
|
|
2022-07-24 16:38:45 +00:00
|
|
|
# Deprecated config Entry Options to be removed in 2023.4
|
|
|
|
CONF_TIME_BETWEEN_UPDATE_COMMAND = "update_time"
|
|
|
|
CONF_RETRY_TIMEOUT = "retry_timeout"
|
2022-07-24 21:38:07 +00:00
|
|
|
CONF_SCAN_TIMEOUT = "scan_timeout"
|