From b1e939d1f1f21bc9554262a2d2841e7aca1d6243 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Sun, 29 Jan 2023 04:05:31 +0100 Subject: [PATCH] Fix tradfri air quality device class (#86861) --- homeassistant/components/tradfri/sensor.py | 2 +- tests/components/tradfri/test_sensor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/tradfri/sensor.py b/homeassistant/components/tradfri/sensor.py index 3b92abfad77..689964cb151 100644 --- a/homeassistant/components/tradfri/sensor.py +++ b/homeassistant/components/tradfri/sensor.py @@ -89,9 +89,9 @@ SENSOR_DESCRIPTIONS_FAN: tuple[TradfriSensorEntityDescription, ...] = ( TradfriSensorEntityDescription( key="aqi", name="air quality", - device_class=SensorDeviceClass.AQI, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + icon="mdi:air-filter", value=_get_air_quality, ), TradfriSensorEntityDescription( diff --git a/tests/components/tradfri/test_sensor.py b/tests/components/tradfri/test_sensor.py index 6408613f4e3..10904b8ffa6 100644 --- a/tests/components/tradfri/test_sensor.py +++ b/tests/components/tradfri/test_sensor.py @@ -91,8 +91,8 @@ async def test_air_quality_sensor(hass, mock_gateway, mock_api_factory): assert sensor_1 is not None assert sensor_1.state == "42" assert sensor_1.attributes["unit_of_measurement"] == "µg/m³" - assert sensor_1.attributes["device_class"] == "aqi" assert sensor_1.attributes["state_class"] == "measurement" + assert "device_class" not in sensor_1.attributes async def test_filter_time_left_sensor(hass, mock_gateway, mock_api_factory):