Recommendations for air quality metrics

I want to view and log some air quality data with Node Red.
I've struggled a bit with node-red-contrib-openaq (the documentation is lacking both in the examples, and on OpenAQ's site).
But I stopped when I noticed the data for the reference grade stations I was trying to use is over 5 days old.

I'm looking into if it's possible for me to get data directly from AirNow.gov but before going much further with that struggle, I want to check here and see what solutions others have come up with.

I'm trying to get data from nearby reference grade sensors as I'm trying to determine if any of the particulate sensors I had in my project box are accurate enough to be useful.

If you open your browsers devtools (F12) and look at the network tab & refresh the page you will see all the data in a nice JSON format ready for consumption.

It is simply a matter of grabbing the URL and headers then doing a HTTP request directly to the endpoint

demo flow...

[{"id":"16e2bef1fd0a7c1e","type":"function","z":"1683bd9a.5e0a02","name":"","func":"//original curl:  \n\n// curl 'https://airnowgovapi.com/reportingarea/get_state'   \n// -H 'Connection: keep-alive'   \n// -H 'Pragma: no-cache'   \n// -H 'Cache-Control: no-cache'   \n// -H 'sec-ch-ua: \" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\"'   \n// -H 'Accept: */*'   \n// -H 'sec-ch-ua-mobile: ?0'   \n// -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'   \n// -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'   \n// -H 'Origin: https://www.airnow.gov'   \n// -H 'Sec-Fetch-Site: cross-site'   \n// -H 'Sec-Fetch-Mode: cors'   \n// -H 'Sec-Fetch-Dest: empty'   \n// -H 'Referer: https://www.airnow.gov/'   \n// -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,es;q=0.7'   \n// --data-raw 'state_code=NY'   \n// --compressed\n\n\nmsg.method = \"post\";\nmsg.url = \"https://airnowgovapi.com/reportingarea/get_state\";\n\nmsg.headers = {\n    \"Connection\": \"keep-alive\",\n    \"Pragma\": \"no-cache\",\n    \"Cache-Control\": \"no-cache\",\n    \"sec-ch-ua\": \"\\\" Not;A Brand\\\";v=\\\"99\\\", \\\"Google Chrome\\\";v=\\\"91\\\", \\\"Chromium\\\";v=\\\"91\\\"\",\n    \"Accept\": \"*/*\",\n    \"sec-ch-ua-mobile\": \"?0\",\n    \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\",\n    \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n    \"Origin\": \"https://www.airnow.gov\",\n    \"Sec-Fetch-Site\": \"cross-site\",\n    \"Sec-Fetch-Mode\": \"cors\",\n    \"Sec-Fetch-Dest\": \"empty\",\n    \"Referer\": \"https://www.airnow.gov/\",\n    \"Accept-Language\": \"en-GB,en-US;q=0.9,en;q=0.8,es;q=0.7\"\n};\nmsg.cookies = null;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":1400,"wires":[["f65ff22fcbde110d"]]},{"id":"f65ff22fcbde110d","type":"http request","z":"1683bd9a.5e0a02","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1250,"y":1400,"wires":[["73c1f60b6955fa69"]]},{"id":"6b3876b9ab49bfe8","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=NY","payloadType":"str","x":880,"y":1360,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"8a302e8019f2a12a","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=OH","payloadType":"str","x":880,"y":1400,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"320cfe2037f7d178","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=CA","payloadType":"str","x":880,"y":1440,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"73c1f60b6955fa69","type":"debug","z":"1683bd9a.5e0a02","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1430,"y":1400,"wires":[]}]
2 Likes

Related, but not directly, also see this blog post re an IKEA pm2.5 sensor https://www.hardill.me.uk/wordpress/tag/node-red/

1 Like

Thanks! I never occurred to me to look at the source to see if I could get the data that way. I'll try and put this to work when I have a bit more time.

I have a few sensors, but they are different makes and models and none of them agree. I've set them up outside and found a reference grade air quality sensor 1.8 miles away. That should help me figure out which sensors are at least close to accurate. Assuming that 2 are fine, I want one outdoor and one indoor. These will help me determine if the air filters are helping, and if I should open the windows or run the AC instead.

1 Like

https://www.unipi.technology/key_feature/plc-programming-4-integration-of-an-indoor-air-quality-sensor-using-mqtt-367

and also node-red


I've had them connected for week.
See how the computed AQI numbers are pretty variable across the sensors? That's why I need data from a reference grader sensor to qualify these.

@Matt.L I would recommend that you read https://seetheair.wordpress.com/
And if you use linked in follow the blog author Sotirios Papathanasiou on linkedin

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.