Add OpenAQ integration#169755
Open
jeeftor wants to merge 15 commits intohome-assistant:devfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new openaq integration to Home Assistant core, enabling configuration via an API key with location subentries and exposing latest air-quality measurements as sensor entities.
Changes:
- Introduces the OpenAQ integration (config flow + location subentry flow, coordinator-based polling, and
sensorplatform entities). - Adds a full initial test suite with snapshots for sensors and config flow coverage for core paths.
- Registers the dependency (
openaq==0.7.0) and updates generated/metadata files (integrations/config flows, CODEOWNERS, quality scale tracking).
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/openaq/__init__.py |
Sets up the integration entry, creates the shared OpenAQ client, initializes per-location coordinators, forwards platform setups, and unload handling. |
homeassistant/components/openaq/config_flow.py |
Implements API-key config flow plus location subentry flows (map/radius search and direct location ID). |
homeassistant/components/openaq/const.py |
Defines integration constants (domain, defaults, subentry keys). |
homeassistant/components/openaq/coordinator.py |
Coordinator and data normalization for OpenAQ location metadata and latest measurements. |
homeassistant/components/openaq/sensor.py |
Defines sensor entity descriptions, unit mapping, and CoordinatorEntity-based sensor entities per parameter. |
homeassistant/components/openaq/manifest.json |
Declares integration metadata and the openaq==0.7.0 dependency. |
homeassistant/components/openaq/strings.json |
Adds UI strings for the config flow, subentry flow, entities, and translated exceptions. |
homeassistant/components/openaq/icons.json |
Adds icon translations for selected sensor translation keys. |
homeassistant/components/openaq/quality_scale.yaml |
Introduces initial quality scale tracking with TODOs and exemptions. |
tests/components/openaq/__init__.py |
Adds a helper to set up the integration in tests. |
tests/components/openaq/conftest.py |
Provides fixtures for a mock config entry, mock OpenAQ client, and SDK-like response objects. |
tests/components/openaq/test_config_flow.py |
Tests the user flow and location subentry flows (map search, location ID, duplicates). |
tests/components/openaq/test_init.py |
Tests setup success, setup retry behavior, unload client close, and reload listener. |
tests/components/openaq/test_sensor.py |
Tests sensor entity creation, unit/device class behavior, missing values behavior, and unavailable states on refresh failure. |
tests/components/openaq/snapshots/test_sensor.ambr |
Snapshot coverage for the created OpenAQ sensor entities and their states/registry entries. |
requirements_all.txt |
Adds openaq==0.7.0 to the full requirements list. |
requirements_test_all.txt |
Adds openaq==0.7.0 for test environments. |
homeassistant/generated/integrations.json |
Registers the openaq integration in generated integration metadata. |
homeassistant/generated/config_flows.py |
Registers openaq as having a config flow in generated config flow metadata. |
script/hassfest/quality_scale.py |
Adds openaq to integrations without a scored quality scale. |
CODEOWNERS |
Adds code ownership entries for the OpenAQ integration and its tests. |
This was referenced May 4, 2026
MartinHjelmare
previously requested changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Add the OpenAQ integration with API-key setup, map-based monitoring location subentries, and air quality sensor entities.
The location flow searches outward from the selected Home Assistant map point, ranks useful stations by supported sensor coverage and distance, and lets the user add one station at a time. It also adds a disabled-by-default diagnostic distance sensor for each station.
This PR includes the initial OpenAQ quality scale file with Bronze config-flow coverage complete.
Type of change
Additional information
New dependency:
openaq==0.7.0Verification:
uv run pytest -q tests/components/openaquv run python -m script.hassfest --integration-path homeassistant/components/openaqprek run --hook-stage pre-commitChecklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: