mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Add Airzone Cloud Air Quality zone sensors (#106571)
* airzone-cloud: add Air Quality sensors Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * tests: airzone_cloud: add missing AQI test Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --------- Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
e5ac7970ca
commit
d3d6870c04
@ -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,
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user