2019-03-07 03:44:52 +00:00
|
|
|
"""Constants for the homekit_controller component."""
|
2022-01-27 17:02:38 +00:00
|
|
|
from typing import Final
|
|
|
|
|
2021-01-26 19:45:01 +00:00
|
|
|
from aiohomekit.model.characteristics import CharacteristicsTypes
|
2022-01-30 22:59:01 +00:00
|
|
|
from aiohomekit.model.services import ServicesTypes
|
2021-01-26 19:45:01 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
DOMAIN = "homekit_controller"
|
2019-03-07 03:44:52 +00:00
|
|
|
|
2019-09-03 15:27:14 +00:00
|
|
|
KNOWN_DEVICES = f"{DOMAIN}-devices"
|
|
|
|
CONTROLLER = f"{DOMAIN}-controller"
|
|
|
|
ENTITY_MAP = f"{DOMAIN}-entity-map"
|
2020-09-11 18:34:07 +00:00
|
|
|
TRIGGERS = f"{DOMAIN}-triggers"
|
2019-03-07 03:44:52 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
HOMEKIT_DIR = ".homekit"
|
|
|
|
PAIRING_FILE = "pairing.json"
|
2019-03-28 03:01:10 +00:00
|
|
|
|
2022-01-23 23:00:05 +00:00
|
|
|
IDENTIFIER_SERIAL_NUMBER = "homekit_controller:serial-number"
|
|
|
|
IDENTIFIER_ACCESSORY_ID = "homekit_controller:accessory-id"
|
|
|
|
IDENTIFIER_LEGACY_SERIAL_NUMBER = "serial-number"
|
|
|
|
IDENTIFIER_LEGACY_ACCESSORY_ID = "accessory-id"
|
2021-10-27 11:24:57 +00:00
|
|
|
|
2019-03-07 03:44:52 +00:00
|
|
|
# Mapping from Homekit type to component.
|
|
|
|
HOMEKIT_ACCESSORY_DISPATCH = {
|
2022-01-30 22:59:01 +00:00
|
|
|
ServicesTypes.LIGHTBULB: "light",
|
|
|
|
ServicesTypes.OUTLET: "switch",
|
|
|
|
ServicesTypes.SWITCH: "switch",
|
|
|
|
ServicesTypes.THERMOSTAT: "climate",
|
|
|
|
ServicesTypes.HEATER_COOLER: "climate",
|
|
|
|
ServicesTypes.SECURITY_SYSTEM: "alarm_control_panel",
|
|
|
|
ServicesTypes.GARAGE_DOOR_OPENER: "cover",
|
|
|
|
ServicesTypes.WINDOW: "cover",
|
|
|
|
ServicesTypes.WINDOW_COVERING: "cover",
|
|
|
|
ServicesTypes.LOCK_MECHANISM: "lock",
|
|
|
|
ServicesTypes.CONTACT_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.MOTION_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.CARBON_DIOXIDE_SENSOR: "sensor",
|
|
|
|
ServicesTypes.HUMIDITY_SENSOR: "sensor",
|
|
|
|
ServicesTypes.HUMIDIFIER_DEHUMIDIFIER: "humidifier",
|
|
|
|
ServicesTypes.LIGHT_SENSOR: "sensor",
|
|
|
|
ServicesTypes.TEMPERATURE_SENSOR: "sensor",
|
|
|
|
ServicesTypes.BATTERY_SERVICE: "sensor",
|
|
|
|
ServicesTypes.SMOKE_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.CARBON_MONOXIDE_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.LEAK_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.FAN: "fan",
|
|
|
|
ServicesTypes.FAN_V2: "fan",
|
|
|
|
ServicesTypes.OCCUPANCY_SENSOR: "binary_sensor",
|
|
|
|
ServicesTypes.TELEVISION: "media_player",
|
|
|
|
ServicesTypes.VALVE: "switch",
|
|
|
|
ServicesTypes.CAMERA_RTP_STREAM_MANAGEMENT: "camera",
|
2019-03-07 03:44:52 +00:00
|
|
|
}
|
2021-01-26 19:45:01 +00:00
|
|
|
|
|
|
|
CHARACTERISTIC_PLATFORMS = {
|
2021-12-23 19:05:36 +00:00
|
|
|
CharacteristicsTypes.Vendor.CONNECTSENSE_ENERGY_WATT: "sensor",
|
|
|
|
CharacteristicsTypes.Vendor.CONNECTSENSE_ENERGY_AMPS: "sensor",
|
|
|
|
CharacteristicsTypes.Vendor.CONNECTSENSE_ENERGY_AMPS_20: "sensor",
|
|
|
|
CharacteristicsTypes.Vendor.CONNECTSENSE_ENERGY_KW_HOUR: "sensor",
|
2021-12-22 08:43:17 +00:00
|
|
|
CharacteristicsTypes.Vendor.AQARA_GATEWAY_VOLUME: "number",
|
2021-12-22 18:49:58 +00:00
|
|
|
CharacteristicsTypes.Vendor.AQARA_E1_GATEWAY_VOLUME: "number",
|
|
|
|
CharacteristicsTypes.Vendor.AQARA_PAIRING_MODE: "switch",
|
|
|
|
CharacteristicsTypes.Vendor.AQARA_E1_PAIRING_MODE: "switch",
|
2022-01-27 16:41:53 +00:00
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_HOME_TARGET_COOL: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_HOME_TARGET_HEAT: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_SLEEP_TARGET_COOL: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_SLEEP_TARGET_HEAT: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_AWAY_TARGET_COOL: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_AWAY_TARGET_HEAT: "number",
|
2022-01-27 17:02:38 +00:00
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_CURRENT_MODE: "select",
|
2021-06-28 21:48:29 +00:00
|
|
|
CharacteristicsTypes.Vendor.EVE_ENERGY_WATT: "sensor",
|
2021-08-03 12:30:50 +00:00
|
|
|
CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: "sensor",
|
|
|
|
CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION: "number",
|
2021-11-20 15:22:10 +00:00
|
|
|
CharacteristicsTypes.Vendor.HAA_SETUP: "button",
|
|
|
|
CharacteristicsTypes.Vendor.HAA_UPDATE: "button",
|
2021-01-26 19:45:01 +00:00
|
|
|
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: "sensor",
|
2021-07-23 17:37:18 +00:00
|
|
|
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: "sensor",
|
2021-07-26 15:46:36 +00:00
|
|
|
CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL: "number",
|
2022-01-21 20:20:32 +00:00
|
|
|
CharacteristicsTypes.Vendor.VOCOLINC_OUTLET_ENERGY: "sensor",
|
2022-01-30 21:02:47 +00:00
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_CLEAR_HOLD: "button",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_FAN_WRITE_SPEED: "number",
|
|
|
|
CharacteristicsTypes.Vendor.ECOBEE_SET_HOLD_SCHEDULE: "number",
|
2021-08-23 18:47:09 +00:00
|
|
|
CharacteristicsTypes.TEMPERATURE_CURRENT: "sensor",
|
|
|
|
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT: "sensor",
|
|
|
|
CharacteristicsTypes.AIR_QUALITY: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_PM25: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_PM10: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_OZONE: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_NO2: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_SO2: "sensor",
|
|
|
|
CharacteristicsTypes.DENSITY_VOC: "sensor",
|
2022-01-24 02:49:40 +00:00
|
|
|
CharacteristicsTypes.IDENTIFY: "button",
|
2021-01-26 19:45:01 +00:00
|
|
|
}
|
2021-08-23 18:47:09 +00:00
|
|
|
|
|
|
|
# For legacy reasons, "built-in" characteristic types are in their short form
|
|
|
|
# And vendor types don't have a short form
|
|
|
|
# This means long and short forms get mixed up in this dict, and comparisons
|
|
|
|
# don't work!
|
|
|
|
# We call get_uuid on *every* type to normalise them to the long form
|
|
|
|
# Eventually aiohomekit will use the long form exclusively amd this can be removed.
|
|
|
|
for k, v in list(CHARACTERISTIC_PLATFORMS.items()):
|
|
|
|
value = CHARACTERISTIC_PLATFORMS.pop(k)
|
|
|
|
CHARACTERISTIC_PLATFORMS[CharacteristicsTypes.get_uuid(k)] = value
|
2022-01-27 17:02:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Device classes
|
|
|
|
DEVICE_CLASS_ECOBEE_MODE: Final = "homekit_controller__ecobee_mode"
|