# \[Matter\] Ajouter la gestion de la qualité de l'air

**URL:** <https://community.gladysassistant.com/t/matter-ajouter-la-gestion-de-la-qualite-de-lair/9620>\
**Category:** Demande de fonctionnalités\
**Tags:** feature-core, in-progress\
**Created:** [Juin 23, 2025, 12:42 UTC](https://community.gladysassistant.com/t/matter-ajouter-la-gestion-de-la-qualite-de-lair/9620 "2025-06-23T12:42:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [Juin 23, 2025, 12:42 UTC](https://community.gladysassistant.com/t/matter-ajouter-la-gestion-de-la-qualite-de-lair/9620/1 "2025-06-23T12:42:33Z")

</div>

**Description**

Ajouter la gestion des capteurs de «&nbsp;AirQuality&nbsp;» dans l’intégration Matter :

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/3/6/364d4c5773a82a50954a9d2208bbbb2145d4bd13.png)

---

<div class="post-metadata">

**Author:** ![cursor-bot](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cursor-bot/32/22252_2.png) [@cursor-bot](https://community.gladysassistant.com/u/cursor-bot)\
**Post date:** [Août 17, 2026, 12:08 UTC](https://community.gladysassistant.com/t/matter-ajouter-la-gestion-de-la-qualite-de-lair/9620/2 "2026-08-17T12:08:55Z")

</div>

Salut tout le monde !

Ce sujet est désormais **en cours de développement**.

Une PR a été ouverte pour ajouter le support du cluster AirQuality Matter :

> <https://github.com/GladysAssistant/Gladys/pull/2891>
>
> Implements feature request: https://community.gladysassistant.com/t/matter-ajout…er-la-gestion-de-la-qualite-de-lair/9620
> 
> \> \*\*Note:\*\* this PR was opened by an automated Claude Code run. It needs human review and testing on a real Matter device (no physical AirQuality sensor was available to validate the mapping end to end).
> 
> \### Description
> 
> The Matter \`AirQuality\` cluster (id 91 / \`0x005B\`) exposes a single \`airQuality\` attribute, an enum holding the overall air quality verdict the device computes itself: \`Unknown(0)\`, \`Good(1)\`, \`Fair(2)\`, \`Moderate(3)\`, \`Poor(4)\`, \`VeryPoor(5)\`, \`ExtremelyPoor(6)\`. The Matter integration already handled the individual concentration clusters (PM2.5, PM10, CO2, VOC, NO2, formaldehyde) but not this overall verdict.
> 
> \*\*Taxonomy choice — a new type, not a new category.\*\* \`docs/specs/device-feature-categories.md\` lists \`voc-matter-index-sensor\` / \`no2-matter-index-sensor\` as legacy exceptions that must not be used as precedents for new protocol-named categories, and rule 5 says not to create a category when a new type on an existing one is enough. So this adds a \`level\` type to the existing \`airquality-sensor\` category, next to the numeric \`aqi\` type:
> 
> \- \`DEVICE\_FEATURE\_TYPES.AIRQUALITY\_SENSOR.LEVEL = 'level'\`, values from the new \`AIR\_QUALITY\_LEVEL\` constant;
> \- the value scale is Matter's, which is also how Zigbee air quality sensors report an overall level (rule 3: align with the standard by default);
> \- inline scope comments on both the new constant and the two types state the boundary: \`aqi\` holds the numeric index, \`level\` the qualitative verdict, an integration maps whichever form its device natively reports and never both, and the raw concentrations behind the verdict keep going to their own per-pollutant categories;
> \- units declared in \`DEVICE\_FEATURE\_UNITS\_BY\_CATEGORY\_AND\_TYPE\` (\`aqi\` → AQI, \`level\` → none).
> 
> \*\*Per-device value set through \`supported\_options\` (rule 6).\*\* Only \`Unknown\`, \`Good\` and \`Poor\` are always part of the Matter enum — \`Fair\`, \`Moderate\`, \`VeryPoor\` and \`ExtremelyPoor\` are each behind an optional cluster feature. The new \`airQualityMatterMapping.js\` builds the feature's \`supported\_options\` from the cluster's supported features, exactly like \`getAcModeSupportedOptions\` does for the air conditioning mode, and \`min\`/\`max\` follow that list.
> 
> Server changes:
> 
> \- \`server/services/matter/utils/convertToGladysDevice.js\`: discovery of the \`AirQuality\` cluster as a read-only \`airquality-sensor/level\` feature;
> \- \`server/services/matter/lib/matter.listenToStateChange.js\`: subscription to the \`airQuality\` attribute;
> \- \`server/services/matter/lib/matter.readInitialDeviceStates.js\`: initial read so the feature has a value right after pairing;
> \- \`server/services/matter/utils/airQualityMatterMapping.js\` (new): supported-options mapping;
> \- \`server/services/matter/README.md\`: \`AirQuality\` row moved to handled, counters and percentage updated (27 / 132 = 20.5%).
> 
> Front changes (full plumbing per rule 8):
> 
> \- type label and the seven value labels in \`en\`, \`fr\` and \`de\`;
> \- icon in \`front/src/utils/consts.js\`;
> \- dashboard badge: \`BadgeNumberDeviceValue\` now allows a type-specific color method, so the level does not get read on the numeric-index scale (where it would stay green forever). The level uses the same palette as the AQI index, and an out-of-enum value falls back on the shared "unknown" label instead of an empty badge;
> \- MQTT device page: default \`min\`/\`max\`/\`read\_only\` and catalog preview value/label for the new type.
> 
> Scene triggers and the history grouping needed no change: \`getDeviceFeatureValueOptions\` picks up the numeric value labels automatically, and \`airquality-sensor\` is already in the climate history group.
> 
> \## Forum
> 
> Forum: https://community.gladysassistant.com/t/matter-ajouter-la-gestion-de-la-qualite-de-lair/9620
> 
> \### Checklist
> 
> \- \[x\] Tests pass: \`cd server && npm run coverage\` (Codecov requires 100% coverage on changed lines) and Cypress (\`npm run cypress:run\`) if the UI changed
> - Ran the Matter suites (\`test/services/matter/\*\*\`, 270 passing) plus \`test/utils\`, \`test/lib/device\`, \`test/services/mqtt\` and \`test/services/homekit\` (1043 passing). \`nyc\` reports \*\*100% line coverage\*\* on every touched server file (\`convertToGladysDevice.js\`, \`matter.listenToStateChange.js\`, \`matter.readInitialDeviceStates.js\`, \`airQualityMatterMapping.js\`), including the fallback branch where the cluster declares no optional level feature. The full \`npm run coverage\` and Cypress were \*\*not\*\* run in this environment — CI will cover them.
> \- \[x\] Linter and prettier pass on both front and server (\`npm run eslint\`, \`npm run prettier\`)
> - \`npm run eslint\` and \`prettier --check\` pass on \`server/\` and \`front/\` (0 errors; only pre-existing warnings), and \`npm run compare-translations\` passes for en/fr/de.
> \- \[x\] No undocumented breaking change
> - Adding a type to an existing category is additive; no existing feature, selector or value changes.
> 
> 
> \---
> \_Generated by \[Claude Code\](https://claude.ai/code/session\_013yxguVaLdJ8ZKmw5x3HePT)\_
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Added Matter and MQTT support for air-quality level readings, including initial values and live updates.
> \* Added qualitative air-quality levels from “Unknown” to “Extremely poor.”
> \* Added localized English, French, and German labels.
> \* Added color-coded badges and a dedicated air-quality level icon.
> \* Air-quality levels now appear as read-only sensor information with supported ranges based on device capabilities.
> 
> \* \*\*Documentation\*\*
> \* Updated Matter compatibility coverage to include air-quality support.

N’hésitez pas à suivre la PR, à tester dès que possible et à faire vos retours ici.
