Add state class support to Luftdaten (#62585)

pull/62588/head
Franck Nijhof 2021-12-22 12:04:31 +01:00 committed by GitHub
parent ee878513a7
commit 66185f8247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from homeassistant.components.sensor import (
SensorDeviceClass, SensorDeviceClass,
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 (
@ -32,6 +33,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="humidity", key="humidity",
@ -39,6 +41,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
icon="mdi:water-percent", icon="mdi:water-percent",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="pressure", key="pressure",
@ -46,6 +49,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
icon="mdi:arrow-down-bold", icon="mdi:arrow-down-bold",
native_unit_of_measurement=PRESSURE_PA, native_unit_of_measurement=PRESSURE_PA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="pressure_at_sealevel", key="pressure_at_sealevel",
@ -53,18 +57,21 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
icon="mdi:download", icon="mdi:download",
native_unit_of_measurement=PRESSURE_PA, native_unit_of_measurement=PRESSURE_PA,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="P1", key="P1",
name="PM10", name="PM10",
icon="mdi:thought-bubble", icon="mdi:thought-bubble",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="P2", key="P2",
name="PM2.5", name="PM2.5",
icon="mdi:thought-bubble-outline", icon="mdi:thought-bubble-outline",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=SensorStateClass.MEASUREMENT,
), ),
) )