From 9784523dfb6dea9f0c1ae94bd36237a9bddf19f6 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 13 Dec 2021 02:15:37 +0100 Subject: [PATCH] Use new SensorDeviceClass enum in gios (#61609) Co-authored-by: epenet --- homeassistant/components/gios/const.py | 41 ++++++++++---------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/homeassistant/components/gios/const.py b/homeassistant/components/gios/const.py index 9b98b0bda26..858a756e3e3 100644 --- a/homeassistant/components/gios/const.py +++ b/homeassistant/components/gios/const.py @@ -4,17 +4,8 @@ from __future__ import annotations from datetime import timedelta from typing import Final -from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT -from homeassistant.const import ( - CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - DEVICE_CLASS_AQI, - DEVICE_CLASS_CO, - DEVICE_CLASS_NITROGEN_DIOXIDE, - DEVICE_CLASS_OZONE, - DEVICE_CLASS_PM10, - DEVICE_CLASS_PM25, - DEVICE_CLASS_SULPHUR_DIOXIDE, -) +from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass +from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER from .model import GiosSensorEntityDescription @@ -47,7 +38,7 @@ SENSOR_TYPES: Final[tuple[GiosSensorEntityDescription, ...]] = ( GiosSensorEntityDescription( key=ATTR_AQI, name="AQI", - device_class=DEVICE_CLASS_AQI, + device_class=SensorDeviceClass.AQI, value=None, ), GiosSensorEntityDescription( @@ -55,48 +46,48 @@ SENSOR_TYPES: Final[tuple[GiosSensorEntityDescription, ...]] = ( name="C6H6", icon="mdi:molecule", native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_CO, name="CO", - device_class=DEVICE_CLASS_CO, + device_class=SensorDeviceClass.CO, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_NO2, name="NO2", - device_class=DEVICE_CLASS_NITROGEN_DIOXIDE, + device_class=SensorDeviceClass.NITROGEN_DIOXIDE, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_O3, name="O3", - device_class=DEVICE_CLASS_OZONE, + device_class=SensorDeviceClass.OZONE, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_PM10, name="PM10", - device_class=DEVICE_CLASS_PM10, + device_class=SensorDeviceClass.PM10, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_PM25, name="PM2.5", - device_class=DEVICE_CLASS_PM25, + device_class=SensorDeviceClass.PM25, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), GiosSensorEntityDescription( key=ATTR_SO2, name="SO2", - device_class=DEVICE_CLASS_SULPHUR_DIOXIDE, + device_class=SensorDeviceClass.SULPHUR_DIOXIDE, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), )