From c0529ac1ce567e76f96d3267bb4caee7b5b18f8d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 8 Dec 2021 21:54:50 +0100 Subject: [PATCH] Use new SensorDeviceClass enum in awair (#61290) Co-authored-by: epenet --- homeassistant/components/awair/const.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/awair/const.py b/homeassistant/components/awair/const.py index 68ca3335d97..352237da386 100644 --- a/homeassistant/components/awair/const.py +++ b/homeassistant/components/awair/const.py @@ -8,15 +8,11 @@ import logging from python_awair.air_data import AirData from python_awair.devices import AwairDevice -from homeassistant.components.sensor import SensorEntityDescription +from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_PARTS_PER_MILLION, - DEVICE_CLASS_CO2, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_TEMPERATURE, LIGHT_LUX, PERCENTAGE, SOUND_PRESSURE_WEIGHTED_DBA, @@ -69,14 +65,14 @@ SENSOR_TYPE_SCORE = AwairSensorEntityDescription( SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = ( AwairSensorEntityDescription( key=API_HUMID, - device_class=DEVICE_CLASS_HUMIDITY, + device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, name="Humidity", unique_id_tag="HUMID", # matches legacy format ), AwairSensorEntityDescription( key=API_LUX, - device_class=DEVICE_CLASS_ILLUMINANCE, + device_class=SensorDeviceClass.ILLUMINANCE, native_unit_of_measurement=LIGHT_LUX, name="Illuminance", unique_id_tag="illuminance", @@ -97,14 +93,14 @@ SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = ( ), AwairSensorEntityDescription( key=API_TEMP, - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=TEMP_CELSIUS, name="Temperature", unique_id_tag="TEMP", # matches legacy format ), AwairSensorEntityDescription( key=API_CO2, - device_class=DEVICE_CLASS_CO2, + device_class=SensorDeviceClass.CO2, icon="mdi:cloud", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, name="Carbon dioxide",