Skip to content

Add AQI rating template sensor example to the PurpleAir docs #25687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

bachya
Copy link
Contributor

@bachya bachya commented Jan 10, 2023

Proposed change

Many people ask why the PurpleAir integration doesn't have an AQI sensor (the API doesn't provide that data). I've been sharing an example to create one via a template sensor; this PR includes it in the official docs.

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

  • Link to parent pull request in the codebase: N/A
  • Link to parent pull request in the Brands repository: N/A
  • This PR fixes or closes issue: N/A

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

@bachya bachya self-assigned this Jan 10, 2023
@home-assistant home-assistant bot added the current This PR goes into the current branch label Jan 10, 2023
@bachya
Copy link
Contributor Author

bachya commented Jan 10, 2023

Not sure why CI is failing.

@domoritz
Copy link
Contributor

domoritz commented Jan 10, 2023

This is great. Thanks for adding the example to get the AQI levels. Could you also add an example to calculate the AQI (as a number) from the PM2.5? I think the documentation is at https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf and there are some corrections needed. https://gitlab.com/gibwar/home-assistant-purpleair/-/tree/main/ has the calculations built in.

@bachya
Copy link
Contributor Author

bachya commented Jan 10, 2023

This is great. Thanks for adding the example to get the AQI levels. Could you also add an example to calculate the AQI (as a number) from the PM2.5? I think the documentation is at https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf and there are some corrections needed. https://gitlab.com/gibwar/home-assistant-purpleair/-/tree/main/ has the calculations built in.

Those calculations are quite complicated for a template sensor. Doesn't mean it can't be done, but I would recommend that being a separate docs PR.

@lilyball
Copy link

FWIW as a user I would really love the actual corrected AQI number. The general "good/moderate/bad" rating is not particularly helpful.

@bachya
Copy link
Contributor Author

bachya commented Jan 10, 2023

FWIW as a user I would really love the actual corrected AQI number. The general "good/moderate/bad" rating is not particularly helpful.

I'm not sure I agree with that sentiment (especially since values like "Good" are already directly correlated with an AQI range). Nevertheless, the example in this PR can be adopted as a framework for producing an AQI value instead (as long as the math is changed).

@bachya bachya force-pushed the purpleair-template-sensor branch from 9adebf6 to 7c1748d Compare January 12, 2023 18:22
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @bachya 👍

../Frenck

@frenck frenck merged commit 54bf0ef into home-assistant:current Jan 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2023
@bachya bachya deleted the purpleair-template-sensor branch January 17, 2023 21:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
current This PR goes into the current branch
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants