Use new enums in homekit-controller (#61689)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
3118bfdfab
commit
10f57cf1f5
5 changed files with 50 additions and 66 deletions
|
@ -3,12 +3,7 @@ from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_GAS,
|
BinarySensorDeviceClass,
|
||||||
DEVICE_CLASS_MOISTURE,
|
|
||||||
DEVICE_CLASS_MOTION,
|
|
||||||
DEVICE_CLASS_OCCUPANCY,
|
|
||||||
DEVICE_CLASS_OPENING,
|
|
||||||
DEVICE_CLASS_SMOKE,
|
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
@ -19,7 +14,7 @@ from . import KNOWN_DEVICES, HomeKitEntity
|
||||||
class HomeKitMotionSensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitMotionSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit motion sensor."""
|
"""Representation of a Homekit motion sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_MOTION
|
_attr_device_class = BinarySensorDeviceClass.MOTION
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
@ -34,7 +29,7 @@ class HomeKitMotionSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
class HomeKitContactSensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitContactSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit contact sensor."""
|
"""Representation of a Homekit contact sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_OPENING
|
_attr_device_class = BinarySensorDeviceClass.OPENING
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
@ -49,7 +44,7 @@ class HomeKitContactSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
class HomeKitSmokeSensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitSmokeSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit smoke sensor."""
|
"""Representation of a Homekit smoke sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_SMOKE
|
_attr_device_class = BinarySensorDeviceClass.SMOKE
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
@ -64,7 +59,7 @@ class HomeKitSmokeSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
class HomeKitCarbonMonoxideSensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitCarbonMonoxideSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit BO sensor."""
|
"""Representation of a Homekit BO sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_GAS
|
_attr_device_class = BinarySensorDeviceClass.GAS
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
@ -79,7 +74,7 @@ class HomeKitCarbonMonoxideSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
class HomeKitOccupancySensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitOccupancySensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit occupancy sensor."""
|
"""Representation of a Homekit occupancy sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_OCCUPANCY
|
_attr_device_class = BinarySensorDeviceClass.OCCUPANCY
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
@ -94,7 +89,7 @@ class HomeKitOccupancySensor(HomeKitEntity, BinarySensorEntity):
|
||||||
class HomeKitLeakSensor(HomeKitEntity, BinarySensorEntity):
|
class HomeKitLeakSensor(HomeKitEntity, BinarySensorEntity):
|
||||||
"""Representation of a Homekit leak sensor."""
|
"""Representation of a Homekit leak sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_MOISTURE
|
_attr_device_class = BinarySensorDeviceClass.MOISTURE
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity is tracking."""
|
"""Define the homekit characteristics the entity is tracking."""
|
||||||
|
|
|
@ -15,8 +15,8 @@ from homeassistant.components.button import (
|
||||||
ButtonEntity,
|
ButtonEntity,
|
||||||
ButtonEntityDescription,
|
ButtonEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ENTITY_CATEGORY_CONFIG
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
|
||||||
from . import KNOWN_DEVICES, CharacteristicEntity
|
from . import KNOWN_DEVICES, CharacteristicEntity
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ BUTTON_ENTITIES: dict[str, HomeKitButtonEntityDescription] = {
|
||||||
key=CharacteristicsTypes.Vendor.HAA_SETUP,
|
key=CharacteristicsTypes.Vendor.HAA_SETUP,
|
||||||
name="Setup",
|
name="Setup",
|
||||||
icon="mdi:cog",
|
icon="mdi:cog",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
write_value="#HAA@trcmd",
|
write_value="#HAA@trcmd",
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.Vendor.HAA_UPDATE: HomeKitButtonEntityDescription(
|
CharacteristicsTypes.Vendor.HAA_UPDATE: HomeKitButtonEntityDescription(
|
||||||
key=CharacteristicsTypes.Vendor.HAA_UPDATE,
|
key=CharacteristicsTypes.Vendor.HAA_UPDATE,
|
||||||
name="Update",
|
name="Update",
|
||||||
device_class=ButtonDeviceClass.UPDATE,
|
device_class=ButtonDeviceClass.UPDATE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
write_value="#HAA@trcmd",
|
write_value="#HAA@trcmd",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ from __future__ import annotations
|
||||||
from aiohomekit.model.characteristics import CharacteristicsTypes
|
from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
|
|
||||||
from homeassistant.components.humidifier import HumidifierEntity
|
from homeassistant.components.humidifier import HumidifierDeviceClass, HumidifierEntity
|
||||||
from homeassistant.components.humidifier.const import (
|
from homeassistant.components.humidifier.const import (
|
||||||
DEVICE_CLASS_DEHUMIDIFIER,
|
|
||||||
DEVICE_CLASS_HUMIDIFIER,
|
|
||||||
MODE_AUTO,
|
MODE_AUTO,
|
||||||
MODE_NORMAL,
|
MODE_NORMAL,
|
||||||
SUPPORT_MODES,
|
SUPPORT_MODES,
|
||||||
|
@ -35,7 +33,7 @@ HA_MODE_TO_HK = {
|
||||||
class HomeKitHumidifier(HomeKitEntity, HumidifierEntity):
|
class HomeKitHumidifier(HomeKitEntity, HumidifierEntity):
|
||||||
"""Representation of a HomeKit Controller Humidifier."""
|
"""Representation of a HomeKit Controller Humidifier."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_HUMIDIFIER
|
_attr_device_class = HumidifierDeviceClass.HUMIDIFIER
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity cares about."""
|
"""Define the homekit characteristics the entity cares about."""
|
||||||
|
@ -136,7 +134,7 @@ class HomeKitHumidifier(HomeKitEntity, HumidifierEntity):
|
||||||
class HomeKitDehumidifier(HomeKitEntity, HumidifierEntity):
|
class HomeKitDehumidifier(HomeKitEntity, HumidifierEntity):
|
||||||
"""Representation of a HomeKit Controller Humidifier."""
|
"""Representation of a HomeKit Controller Humidifier."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_DEHUMIDIFIER
|
_attr_device_class = HumidifierDeviceClass.DEHUMIDIFIER
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity cares about."""
|
"""Define the homekit characteristics the entity cares about."""
|
||||||
|
|
|
@ -10,7 +10,10 @@ from aiohomekit.model.characteristics import (
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
from aiohomekit.utils import clamp_enum_to_char
|
from aiohomekit.utils import clamp_enum_to_char
|
||||||
|
|
||||||
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerEntity
|
from homeassistant.components.media_player import (
|
||||||
|
MediaPlayerDeviceClass,
|
||||||
|
MediaPlayerEntity,
|
||||||
|
)
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
SUPPORT_PLAY,
|
SUPPORT_PLAY,
|
||||||
|
@ -57,7 +60,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
class HomeKitTelevision(HomeKitEntity, MediaPlayerEntity):
|
class HomeKitTelevision(HomeKitEntity, MediaPlayerEntity):
|
||||||
"""Representation of a HomeKit Controller Television."""
|
"""Representation of a HomeKit Controller Television."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_TV
|
_attr_device_class = MediaPlayerDeviceClass.TV
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
"""Define the homekit characteristics the entity cares about."""
|
"""Define the homekit characteristics the entity cares about."""
|
||||||
|
|
|
@ -8,26 +8,14 @@ from aiohomekit.model.characteristics import Characteristic, CharacteristicsType
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
STATE_CLASS_MEASUREMENT,
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEVICE_CLASS_AQI,
|
|
||||||
DEVICE_CLASS_BATTERY,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
|
||||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
|
||||||
DEVICE_CLASS_OZONE,
|
|
||||||
DEVICE_CLASS_PM10,
|
|
||||||
DEVICE_CLASS_PM25,
|
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
|
@ -52,36 +40,36 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
||||||
CharacteristicsTypes.Vendor.EVE_ENERGY_WATT: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.Vendor.EVE_ENERGY_WATT: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.Vendor.EVE_ENERGY_WATT,
|
key=CharacteristicsTypes.Vendor.EVE_ENERGY_WATT,
|
||||||
name="Real Time Energy",
|
name="Real Time Energy",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=POWER_WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY,
|
key=CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY,
|
||||||
name="Real Time Energy",
|
name="Real Time Energy",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=POWER_WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2,
|
key=CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2,
|
||||||
name="Real Time Energy",
|
name="Real Time Energy",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=POWER_WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE,
|
key=CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE,
|
||||||
name="Air Pressure",
|
name="Air Pressure",
|
||||||
device_class=DEVICE_CLASS_PRESSURE,
|
device_class=SensorDeviceClass.PRESSURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=PRESSURE_HPA,
|
native_unit_of_measurement=PRESSURE_HPA,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.TEMPERATURE_CURRENT: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.TEMPERATURE_CURRENT: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.TEMPERATURE_CURRENT,
|
key=CharacteristicsTypes.TEMPERATURE_CURRENT,
|
||||||
name="Current Temperature",
|
name="Current Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
# This sensor is only for temperature characteristics that are not part
|
# This sensor is only for temperature characteristics that are not part
|
||||||
# of a temperature sensor service.
|
# of a temperature sensor service.
|
||||||
|
@ -93,8 +81,8 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
||||||
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
|
key=CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
|
||||||
name="Current Humidity",
|
name="Current Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
# This sensor is only for humidity characteristics that are not part
|
# This sensor is only for humidity characteristics that are not part
|
||||||
# of a humidity sensor service.
|
# of a humidity sensor service.
|
||||||
|
@ -106,49 +94,49 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
||||||
CharacteristicsTypes.AIR_QUALITY: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.AIR_QUALITY: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.AIR_QUALITY,
|
key=CharacteristicsTypes.AIR_QUALITY,
|
||||||
name="Air Quality",
|
name="Air Quality",
|
||||||
device_class=DEVICE_CLASS_AQI,
|
device_class=SensorDeviceClass.AQI,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_PM25: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_PM25: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_PM25,
|
key=CharacteristicsTypes.DENSITY_PM25,
|
||||||
name="PM2.5 Density",
|
name="PM2.5 Density",
|
||||||
device_class=DEVICE_CLASS_PM25,
|
device_class=SensorDeviceClass.PM25,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_PM10: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_PM10: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_PM10,
|
key=CharacteristicsTypes.DENSITY_PM10,
|
||||||
name="PM10 Density",
|
name="PM10 Density",
|
||||||
device_class=DEVICE_CLASS_PM10,
|
device_class=SensorDeviceClass.PM10,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_OZONE: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_OZONE: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_OZONE,
|
key=CharacteristicsTypes.DENSITY_OZONE,
|
||||||
name="Ozone Density",
|
name="Ozone Density",
|
||||||
device_class=DEVICE_CLASS_OZONE,
|
device_class=SensorDeviceClass.OZONE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_NO2: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_NO2: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_NO2,
|
key=CharacteristicsTypes.DENSITY_NO2,
|
||||||
name="Nitrogen Dioxide Density",
|
name="Nitrogen Dioxide Density",
|
||||||
device_class=DEVICE_CLASS_NITROGEN_DIOXIDE,
|
device_class=SensorDeviceClass.NITROGEN_DIOXIDE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_SO2: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_SO2: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_SO2,
|
key=CharacteristicsTypes.DENSITY_SO2,
|
||||||
name="Sulphur Dioxide Density",
|
name="Sulphur Dioxide Density",
|
||||||
device_class=DEVICE_CLASS_SULPHUR_DIOXIDE,
|
device_class=SensorDeviceClass.SULPHUR_DIOXIDE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.DENSITY_VOC: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.DENSITY_VOC: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.DENSITY_VOC,
|
key=CharacteristicsTypes.DENSITY_VOC,
|
||||||
name="Volatile Organic Compound Density",
|
name="Volatile Organic Compound Density",
|
||||||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
@ -166,7 +154,7 @@ for k, v in list(SIMPLE_SENSOR.items()):
|
||||||
class HomeKitHumiditySensor(HomeKitEntity, SensorEntity):
|
class HomeKitHumiditySensor(HomeKitEntity, SensorEntity):
|
||||||
"""Representation of a Homekit humidity sensor."""
|
"""Representation of a Homekit humidity sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_HUMIDITY
|
_attr_device_class = SensorDeviceClass.HUMIDITY
|
||||||
_attr_native_unit_of_measurement = PERCENTAGE
|
_attr_native_unit_of_measurement = PERCENTAGE
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
@ -187,7 +175,7 @@ class HomeKitHumiditySensor(HomeKitEntity, SensorEntity):
|
||||||
class HomeKitTemperatureSensor(HomeKitEntity, SensorEntity):
|
class HomeKitTemperatureSensor(HomeKitEntity, SensorEntity):
|
||||||
"""Representation of a Homekit temperature sensor."""
|
"""Representation of a Homekit temperature sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_TEMPERATURE
|
_attr_device_class = SensorDeviceClass.TEMPERATURE
|
||||||
_attr_native_unit_of_measurement = TEMP_CELSIUS
|
_attr_native_unit_of_measurement = TEMP_CELSIUS
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
@ -208,7 +196,7 @@ class HomeKitTemperatureSensor(HomeKitEntity, SensorEntity):
|
||||||
class HomeKitLightSensor(HomeKitEntity, SensorEntity):
|
class HomeKitLightSensor(HomeKitEntity, SensorEntity):
|
||||||
"""Representation of a Homekit light level sensor."""
|
"""Representation of a Homekit light level sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_ILLUMINANCE
|
_attr_device_class = SensorDeviceClass.ILLUMINANCE
|
||||||
_attr_native_unit_of_measurement = LIGHT_LUX
|
_attr_native_unit_of_measurement = LIGHT_LUX
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
@ -250,7 +238,7 @@ class HomeKitCarbonDioxideSensor(HomeKitEntity, SensorEntity):
|
||||||
class HomeKitBatterySensor(HomeKitEntity, SensorEntity):
|
class HomeKitBatterySensor(HomeKitEntity, SensorEntity):
|
||||||
"""Representation of a Homekit battery sensor."""
|
"""Representation of a Homekit battery sensor."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_BATTERY
|
_attr_device_class = SensorDeviceClass.BATTERY
|
||||||
_attr_native_unit_of_measurement = PERCENTAGE
|
_attr_native_unit_of_measurement = PERCENTAGE
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue