Add volatile organic compounds to homekit_controller (#55093)

This commit is contained in:
Jc2k 2021-08-23 19:47:09 +01:00 committed by GitHub
parent 4ef376a971
commit 0065bbc56d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 4 deletions

View file

@ -50,8 +50,23 @@ CHARACTERISTIC_PLATFORMS = {
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: "sensor",
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: "sensor",
CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL: "number",
CharacteristicsTypes.get_uuid(CharacteristicsTypes.TEMPERATURE_CURRENT): "sensor",
CharacteristicsTypes.get_uuid(
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT
): "sensor",
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",
}
# 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