From 321394d3e2403454e63eb58174906697af8760e3 Mon Sep 17 00:00:00 2001 From: Arne Mauer Date: Thu, 2 Jun 2022 00:00:58 +0200 Subject: [PATCH] Add Particulate Matter 2.5 of ZCL concentration clusters to ZHA component (#72826) * Add Particulate Matter 2.5 of ZCL concentration clusters to ZHA component * Fixed black and flake8 test --- .../components/zha/core/channels/measurement.py | 12 ++++++++++++ homeassistant/components/zha/sensor.py | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/homeassistant/components/zha/core/channels/measurement.py b/homeassistant/components/zha/core/channels/measurement.py index 093c04245c4..7368309cf99 100644 --- a/homeassistant/components/zha/core/channels/measurement.py +++ b/homeassistant/components/zha/core/channels/measurement.py @@ -128,6 +128,18 @@ class CarbonDioxideConcentration(ZigbeeChannel): ] +@registries.ZIGBEE_CHANNEL_REGISTRY.register(measurement.PM25.cluster_id) +class PM25(ZigbeeChannel): + """Particulate Matter 2.5 microns or less measurement channel.""" + + REPORT_CONFIG = [ + { + "attr": "measured_value", + "config": (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 0.1), + } + ] + + @registries.ZIGBEE_CHANNEL_REGISTRY.register( measurement.FormaldehydeConcentration.cluster_id ) diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index 36ca873188f..cdc37876889 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -607,6 +607,17 @@ class PPBVOCLevel(Sensor): _unit = CONCENTRATION_PARTS_PER_BILLION +@MULTI_MATCH(channel_names="pm25") +class PM25(Sensor): + """Particulate Matter 2.5 microns or less sensor.""" + + SENSOR_ATTR = "measured_value" + _attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT + _decimals = 0 + _multiplier = 1 + _unit = CONCENTRATION_MICROGRAMS_PER_CUBIC_METER + + @MULTI_MATCH(channel_names="formaldehyde_concentration") class FormaldehydeConcentration(Sensor): """Formaldehyde Concentration sensor."""