Use new SensorDeviceClass enum in gios (#61609)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/61763/head
epenet 2021-12-13 02:15:37 +01:00 committed by GitHub
parent ca12f257ca
commit 9784523dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 25 deletions

View File

@ -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,
),
)