diff --git a/homeassistant/components/airnow/sensor.py b/homeassistant/components/airnow/sensor.py index 31bb3d793a1..f3d29cc65df 100644 --- a/homeassistant/components/airnow/sensor.py +++ b/homeassistant/components/airnow/sensor.py @@ -6,6 +6,7 @@ from dataclasses import dataclass from typing import Any from homeassistant.components.sensor import ( + SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, @@ -57,10 +58,9 @@ class AirNowEntityDescription(SensorEntityDescription, AirNowEntityDescriptionMi SENSOR_TYPES: tuple[AirNowEntityDescription, ...] = ( AirNowEntityDescription( key=ATTR_API_AQI, - translation_key="aqi", icon="mdi:blur", - native_unit_of_measurement="aqi", state_class=SensorStateClass.MEASUREMENT, + device_class=SensorDeviceClass.AQI, value_fn=lambda data: data.get(ATTR_API_AQI), extra_state_attributes_fn=lambda data: { ATTR_DESCR: data[ATTR_API_AQI_DESCRIPTION], @@ -69,10 +69,10 @@ SENSOR_TYPES: tuple[AirNowEntityDescription, ...] = ( ), AirNowEntityDescription( key=ATTR_API_PM25, - translation_key="pm25", icon="mdi:blur", native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, state_class=SensorStateClass.MEASUREMENT, + device_class=SensorDeviceClass.PM25, value_fn=lambda data: data.get(ATTR_API_PM25), extra_state_attributes_fn=None, ), diff --git a/homeassistant/components/airnow/strings.json b/homeassistant/components/airnow/strings.json index ff1ba6481c8..aed12596176 100644 --- a/homeassistant/components/airnow/strings.json +++ b/homeassistant/components/airnow/strings.json @@ -23,12 +23,6 @@ }, "entity": { "sensor": { - "aqi": { - "name": "[%key:component::sensor::entity_component::aqi::name%]" - }, - "pm25": { - "name": "[%key:component::sensor::entity_component::pm25::name%]" - }, "o3": { "name": "[%key:component::sensor::entity_component::ozone::name%]" }