Skip to content

[aqi] Add NowCast AQI sensor using PM2.5 and PM10#79

Merged
TrevorSchirmer merged 2 commits intobetafrom
aqi-nowcast-sensor
Feb 27, 2026
Merged

[aqi] Add NowCast AQI sensor using PM2.5 and PM10#79
TrevorSchirmer merged 2 commits intobetafrom
aqi-nowcast-sensor

Conversation

@bharvey88
Copy link
Copy Markdown
Contributor

@bharvey88 bharvey88 commented Feb 24, 2026

Version: 25.12.18.2

What does this implement/fix?

Adds a NowCast AQI sensor to the AIR-1 using the built-in ESPHome aqi platform. The sensor takes PM2.5 and PM10 readings from the SEN55, computes an AQI sub-index for each using 2024 EPA breakpoints, and publishes the worse of the two values. The entity exposes device_class: aqi so Home Assistant formats and colours it correctly.

Why "NowCast AQI" and not "AQI"?

A true US EPA Air Quality Index requires ozone (O₃) and sulfur dioxide (SO₂) sub-indices that the AIR-1 hardware does not measure. This value is computed from PM2.5 and PM10 only using the 2024 EPA breakpoints and should be understood as a particulate-matter air quality indicator, not a certified AQI reading.

Reference: EPA Technical Assistance Document for the Reporting of Daily Air Quality

The sensor is callback-driven — it updates the moment either PM sensor publishes a new reading, so no additional poll interval is needed and it adds no overhead to the reportAllValues script.

Types of changes

  • Bugfix (fixed change that fixes an issue)
  • New feature (thanks!)
  • Breaking change (repair/feature that breaks existing functionality)
  • Dependency Update - Does not publish
  • Other - Does not publish
  • Website of github readme file update - Does not publish
  • Github workflows - Does not publish

Checklist / Checklijst:

  • The code change has been tested and works locally
  • The code change has not yet been tested

If user-visible functionality or configuration variables are added/modified:

  • Added/updated documentation for the web page

Uses PM2.5 and PM10 from the SEN55 via the built-in esphome aqi platform.
Returns the higher of the two sub-indices per 2024 EPA breakpoints.
Named "NowCast AQI" rather than "AQI" because the device lacks ozone and SO2.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

Warning

Rate limit exceeded

@bharvey88 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between aa6e149 and 797ee73.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml

Walkthrough

A new AQI (Air Quality Index) sensor configuration was added to the ESPHome Core.yaml file. The sensor platform monitors air quality using PM2.5 and PM10.0 particle measurements, applying the NowCast AQI calculation method.

Changes

Cohort / File(s) Summary
ESPHome AQI Sensor Configuration
Integrations/ESPHome/Core.yaml
Added new AQI sensor platform entry with id nowcast_aqi that calculates NowCast AQI from existing PM2.5 and PM10.0 sensor readings.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A whisker-twitched addition to the air,
NowCast AQI, floating there,
PM particles dance and swirl,
A sensor's gentle quality-whirl! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a NowCast AQI sensor that uses PM2.5 and PM10 measurements, which aligns perfectly with the file modification in Core.yaml.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aqi-nowcast-sensor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Integrations/ESPHome/Core.yaml`:
- Around line 310-315: The AQI sensor block using platform: aqi (id:
nowcast_aqi, calculation_type: AQI) does not set a device_class, so add an
explicit device_class: aqi entry to that sensor definition to ensure Home
Assistant recognizes it correctly (i.e., update the sensor with id nowcast_aqi
to include device_class: aqi).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e523911 and aa6e149.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml

Comment thread Integrations/ESPHome/Core.yaml
@TrevorSchirmer TrevorSchirmer merged commit 93a0384 into beta Feb 27, 2026
11 checks passed
@TrevorSchirmer TrevorSchirmer deleted the aqi-nowcast-sensor branch February 27, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants