From ec12becb0cd41bee6a76ec36dfb761e57aede068 Mon Sep 17 00:00:00 2001 From: Michael Neuffer Date: Wed, 14 Oct 2026 18:25:24 +0200 Subject: [PATCH] Add particle count and typical particle size sensors to air-Q (#179216) Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- homeassistant/components/airq/const.py | 4 ++ homeassistant/components/airq/icons.json | 21 +++++++++ homeassistant/components/airq/sensor.py | 55 +++++++++++++++++++++- homeassistant/components/airq/strings.json | 21 +++++++++ 4 files changed, 100 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/airq/const.py b/homeassistant/components/airq/const.py index 3e5c736c8c5c..f9cc58bd4b21 100644 --- a/homeassistant/components/airq/const.py +++ b/homeassistant/components/airq/const.py @@ -7,4 +7,8 @@ CONF_CLIP_NEGATIVE: Final = "clip_negatives" DOMAIN: Final = "airq" MANUFACTURER: Final = "CorantGmbH" ACTIVITY_BECQUEREL_PER_CUBIC_METER: Final = "Bq/m³" +LENGTH_MICROMETER: Final = "μm" +# The device reports the size-resolved particle counts in the native unit of its +# optical counter: the number of particles per 100 mL (0.1 L) of sampled air. +PARTICLE_COUNT_PER_100_MILLILITER: Final = "particles/100mL" UPDATE_INTERVAL: float = 10.0 diff --git a/homeassistant/components/airq/icons.json b/homeassistant/components/airq/icons.json index 0aba9cb27999..3ac3b6087f59 100644 --- a/homeassistant/components/airq/icons.json +++ b/homeassistant/components/airq/icons.json @@ -10,6 +10,24 @@ "oxygen": { "default": "mdi:leaf" }, + "particle_count_0_3": { + "default": "mdi:grain" + }, + "particle_count_0_5": { + "default": "mdi:grain" + }, + "particle_count_1": { + "default": "mdi:grain" + }, + "particle_count_10": { + "default": "mdi:grain" + }, + "particle_count_2_5": { + "default": "mdi:grain" + }, + "particle_count_5": { + "default": "mdi:grain" + }, "performance_index": { "default": "mdi:head-check" }, @@ -25,6 +43,9 @@ "radon": { "default": "mdi:radioactive" }, + "typical_particle_size": { + "default": "mdi:diameter-variant" + }, "virus_index": { "default": "mdi:virus-off" } diff --git a/homeassistant/components/airq/sensor.py b/homeassistant/components/airq/sensor.py index d06d12ab5f37..6e884d69f4af 100644 --- a/homeassistant/components/airq/sensor.py +++ b/homeassistant/components/airq/sensor.py @@ -23,7 +23,11 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import AirQConfigEntry, AirQCoordinator -from .const import ACTIVITY_BECQUEREL_PER_CUBIC_METER +from .const import ( + ACTIVITY_BECQUEREL_PER_CUBIC_METER, + LENGTH_MICROMETER, + PARTICLE_COUNT_PER_100_MILLILITER, +) _LOGGER = logging.getLogger(__name__) @@ -276,6 +280,48 @@ SENSOR_TYPES: list[AirQEntityDescription] = [ state_class=SensorStateClass.MEASUREMENT, value=lambda data: data.get("ph3"), ), + AirQEntityDescription( + key="cnt0_3", + translation_key="particle_count_0_3", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt0_3"), + ), + AirQEntityDescription( + key="cnt0_5", + translation_key="particle_count_0_5", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt0_5"), + ), + AirQEntityDescription( + key="cnt1", + translation_key="particle_count_1", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt1"), + ), + AirQEntityDescription( + key="cnt2_5", + translation_key="particle_count_2_5", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt2_5"), + ), + AirQEntityDescription( + key="cnt5", + translation_key="particle_count_5", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt5"), + ), + AirQEntityDescription( + key="cnt10", + translation_key="particle_count_10", + native_unit_of_measurement=PARTICLE_COUNT_PER_100_MILLILITER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("cnt10"), + ), AirQEntityDescription( key="pm1", device_class=SensorDeviceClass.PM1, @@ -297,6 +343,13 @@ SENSOR_TYPES: list[AirQEntityDescription] = [ state_class=SensorStateClass.MEASUREMENT, value=lambda data: data.get("pm10"), ), + AirQEntityDescription( + key="TypPS", + translation_key="typical_particle_size", + native_unit_of_measurement=LENGTH_MICROMETER, + state_class=SensorStateClass.MEASUREMENT, + value=lambda data: data.get("TypPS"), + ), AirQEntityDescription( key="pressure", device_class=SensorDeviceClass.PRESSURE, diff --git a/homeassistant/components/airq/strings.json b/homeassistant/components/airq/strings.json index 98926534a190..819a5f24cf09 100644 --- a/homeassistant/components/airq/strings.json +++ b/homeassistant/components/airq/strings.json @@ -122,6 +122,24 @@ "oxygen": { "name": "Oxygen" }, + "particle_count_0_3": { + "name": "Particle count (>0.3 μm)" + }, + "particle_count_0_5": { + "name": "Particle count (>0.5 μm)" + }, + "particle_count_1": { + "name": "Particle count (>1 μm)" + }, + "particle_count_10": { + "name": "Particle count (>10 μm)" + }, + "particle_count_2_5": { + "name": "Particle count (>2.5 μm)" + }, + "particle_count_5": { + "name": "Particle count (>5 μm)" + }, "performance_index": { "name": "Performance index" }, @@ -146,6 +164,9 @@ "silicon_hydride": { "name": "Silicon hydride" }, + "typical_particle_size": { + "name": "Typical particle size" + }, "virus_index": { "name": "Virus index" }