Use state class enums in airvisual (#60819)

This commit is contained in:
Tobias Sauerwein 2021-12-02 09:53:02 +01:00 committed by GitHub
parent 831e69d07c
commit 63c377a239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,9 @@
from __future__ import annotations from __future__ import annotations
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
@ -81,7 +81,7 @@ GEOGRAPHY_SENSOR_DESCRIPTIONS = (
name="Air Quality Index", name="Air Quality Index",
device_class=DEVICE_CLASS_AQI, device_class=DEVICE_CLASS_AQI,
native_unit_of_measurement="AQI", native_unit_of_measurement="AQI",
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_POLLUTANT, key=SENSOR_KIND_POLLUTANT,
@ -98,7 +98,7 @@ NODE_PRO_SENSOR_DESCRIPTIONS = (
name="Air Quality Index", name="Air Quality Index",
device_class=DEVICE_CLASS_AQI, device_class=DEVICE_CLASS_AQI,
native_unit_of_measurement="AQI", native_unit_of_measurement="AQI",
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_BATTERY_LEVEL, key=SENSOR_KIND_BATTERY_LEVEL,
@ -112,7 +112,7 @@ NODE_PRO_SENSOR_DESCRIPTIONS = (
name="C02", name="C02",
device_class=DEVICE_CLASS_CO2, device_class=DEVICE_CLASS_CO2,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_HUMIDITY, key=SENSOR_KIND_HUMIDITY,
@ -125,35 +125,35 @@ NODE_PRO_SENSOR_DESCRIPTIONS = (
name="PM 0.1", name="PM 0.1",
device_class=DEVICE_CLASS_PM1, device_class=DEVICE_CLASS_PM1,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_PM_1_0, key=SENSOR_KIND_PM_1_0,
name="PM 1.0", name="PM 1.0",
device_class=DEVICE_CLASS_PM10, device_class=DEVICE_CLASS_PM10,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_PM_2_5, key=SENSOR_KIND_PM_2_5,
name="PM 2.5", name="PM 2.5",
device_class=DEVICE_CLASS_PM25, device_class=DEVICE_CLASS_PM25,
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_TEMPERATURE, key=SENSOR_KIND_TEMPERATURE,
name="Temperature", name="Temperature",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=DEVICE_CLASS_TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_KIND_VOC, key=SENSOR_KIND_VOC,
name="VOC", name="VOC",
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
) )