-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Compute US AQI and EPA AQI for PMS5003x sensors #22294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, please apply the suggested changes to make code smaller
Thanks, made the requested changes |
Nice to know in Europe that their AQI is US approved. BTW an increase of 400 bytes is not a problem considering the PMS5003 driver is optional on ESP8266. |
Any chance you're able to add the European (or Celsius based results) too? If not I suggest to make the provision for US specific data related to the user selection of Fahrenheit and remove US specific data if user has selected Celsius. |
Yeah happy to add Europe AQI |
In Fahrenheit
and Celcius
|
us_aqi = compute_us_aqi(pms_data.pm25_standard); | ||
} else { | ||
european_aqi = compute_european_aqi(pms_data.pm25_standard); | ||
} | ||
|
||
if (json) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section of code was inconsistent with trailing commas. I changed it so each new json string we append starts with a comma and does not have a trailing comma
I went with string labels for European Air Quality Index. I could not find a numeric scale like the 0-500 one in the US. Let me know if that seems correct. |
Thx. I will have a look regarding the string labels. As it stands we need translations for all english terms shown in the GUI. I'll see how to get rid of some (Like European and US). |
Did some research regarding non-US AQI and as expected it's a can of worms ;-) In short almost every country uses a different calculation of PM2.5 to get to some kind of AQI. See https://en.wikipedia.org/wiki/Air_quality_index. Considering this I strongly feel this calculation needs to be done on the front-end based on Tasmota provided data. Therefore I'll remove the current European calculation and keep the US one based on Fahrenheit. |
Kind of merged this without the celsius part just now. Thx. |
Description:
AQI is a common way to display PM2.5 data and the thresholds are easier to remember than raw pm2.5 data. This PR adds a calculation for standard US AQI and a second one that uses the US EPA adjustments which gives a more accurate AQI for places that experience wildfire smoke.
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass