diff --git a/homeassistant/components/airzone_cloud/sensor.py b/homeassistant/components/airzone_cloud/sensor.py index f45fd248cd5..965ac24a64f 100644 --- a/homeassistant/components/airzone_cloud/sensor.py +++ b/homeassistant/components/airzone_cloud/sensor.py @@ -5,6 +5,10 @@ from typing import Any, Final from aioairzone_cloud.const import ( AZD_AIDOOS, + AZD_AQ_INDEX, + AZD_AQ_PM_1, + AZD_AQ_PM_2P5, + AZD_AQ_PM_10, AZD_HUMIDITY, AZD_TEMP, AZD_WEBSERVERS, @@ -20,6 +24,7 @@ from homeassistant.components.sensor import ( ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( + CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, EntityCategory, @@ -58,6 +63,29 @@ WEBSERVER_SENSOR_TYPES: Final[tuple[SensorEntityDescription, ...]] = ( ) ZONE_SENSOR_TYPES: Final[tuple[SensorEntityDescription, ...]] = ( + SensorEntityDescription( + device_class=SensorDeviceClass.AQI, + key=AZD_AQ_INDEX, + state_class=SensorStateClass.MEASUREMENT, + ), + SensorEntityDescription( + device_class=SensorDeviceClass.PM1, + key=AZD_AQ_PM_1, + native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + ), + SensorEntityDescription( + device_class=SensorDeviceClass.PM25, + key=AZD_AQ_PM_2P5, + native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + ), + SensorEntityDescription( + device_class=SensorDeviceClass.PM10, + key=AZD_AQ_PM_10, + native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + ), SensorEntityDescription( device_class=SensorDeviceClass.TEMPERATURE, key=AZD_TEMP, diff --git a/tests/components/airzone_cloud/test_sensor.py b/tests/components/airzone_cloud/test_sensor.py index b370e75c9aa..5000f1cabea 100644 --- a/tests/components/airzone_cloud/test_sensor.py +++ b/tests/components/airzone_cloud/test_sensor.py @@ -27,12 +27,36 @@ async def test_airzone_create_sensors( assert state.state == "-77" # Zones + state = hass.states.get("sensor.dormitorio_air_quality_index") + assert state.state == "1" + + state = hass.states.get("sensor.dormitorio_pm1") + assert state.state == "3" + + state = hass.states.get("sensor.dormitorio_pm2_5") + assert state.state == "4" + + state = hass.states.get("sensor.dormitorio_pm10") + assert state.state == "3" + state = hass.states.get("sensor.dormitorio_temperature") assert state.state == "25.0" state = hass.states.get("sensor.dormitorio_humidity") assert state.state == "24" + state = hass.states.get("sensor.dormitorio_air_quality_index") + assert state.state == "1" + + state = hass.states.get("sensor.salon_pm1") + assert state.state == "3" + + state = hass.states.get("sensor.salon_pm2_5") + assert state.state == "4" + + state = hass.states.get("sensor.salon_pm10") + assert state.state == "3" + state = hass.states.get("sensor.salon_temperature") assert state.state == "20.0"