From 0364922d80cfd2cd27c391b30fc714893cc8ac62 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Tue, 14 Sep 2021 14:04:55 -0600 Subject: [PATCH] Add long-term statistics for AirNow sensors (#56230) --- homeassistant/components/airnow/sensor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/airnow/sensor.py b/homeassistant/components/airnow/sensor.py index ed879d32d4a..b0d8c69cff2 100644 --- a/homeassistant/components/airnow/sensor.py +++ b/homeassistant/components/airnow/sensor.py @@ -1,7 +1,11 @@ """Support for the AirNow sensor service.""" from __future__ import annotations -from homeassistant.components.sensor import SensorEntity, SensorEntityDescription +from homeassistant.components.sensor import ( + STATE_CLASS_MEASUREMENT, + SensorEntity, + SensorEntityDescription, +) from homeassistant.const import ( ATTR_ATTRIBUTION, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, @@ -31,18 +35,21 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( icon="mdi:blur", name=ATTR_API_AQI, native_unit_of_measurement="aqi", + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key=ATTR_API_PM25, icon="mdi:blur", name=ATTR_API_PM25, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + state_class=STATE_CLASS_MEASUREMENT, ), SensorEntityDescription( key=ATTR_API_O3, icon="mdi:blur", name=ATTR_API_O3, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, + state_class=STATE_CLASS_MEASUREMENT, ), )