Use new SensorDeviceClass enum in awair (#61290)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
e130688141
commit
c0529ac1ce
1 changed files with 5 additions and 9 deletions
|
@ -8,15 +8,11 @@ import logging
|
||||||
from python_awair.air_data import AirData
|
from python_awair.air_data import AirData
|
||||||
from python_awair.devices import AwairDevice
|
from python_awair.devices import AwairDevice
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntityDescription
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_BILLION,
|
CONCENTRATION_PARTS_PER_BILLION,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEVICE_CLASS_CO2,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SOUND_PRESSURE_WEIGHTED_DBA,
|
SOUND_PRESSURE_WEIGHTED_DBA,
|
||||||
|
@ -69,14 +65,14 @@ SENSOR_TYPE_SCORE = AwairSensorEntityDescription(
|
||||||
SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
|
SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
|
||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_HUMID,
|
key=API_HUMID,
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
unique_id_tag="HUMID", # matches legacy format
|
unique_id_tag="HUMID", # matches legacy format
|
||||||
),
|
),
|
||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_LUX,
|
key=API_LUX,
|
||||||
device_class=DEVICE_CLASS_ILLUMINANCE,
|
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||||
native_unit_of_measurement=LIGHT_LUX,
|
native_unit_of_measurement=LIGHT_LUX,
|
||||||
name="Illuminance",
|
name="Illuminance",
|
||||||
unique_id_tag="illuminance",
|
unique_id_tag="illuminance",
|
||||||
|
@ -97,14 +93,14 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
|
||||||
),
|
),
|
||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_TEMP,
|
key=API_TEMP,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
unique_id_tag="TEMP", # matches legacy format
|
unique_id_tag="TEMP", # matches legacy format
|
||||||
),
|
),
|
||||||
AwairSensorEntityDescription(
|
AwairSensorEntityDescription(
|
||||||
key=API_CO2,
|
key=API_CO2,
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
icon="mdi:cloud",
|
icon="mdi:cloud",
|
||||||
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
||||||
name="Carbon dioxide",
|
name="Carbon dioxide",
|
||||||
|
|
Loading…
Add table
Reference in a new issue