# Recommendations for air quality metrics

**URL:** <https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156>\
**Category:** General\
**Created:** [1 August 2021 06:55 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156 "2021-08-01T06:55:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt.L](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Matt.L](https://discourse.nodered.org/u/Matt.L)\
**Post date:** [1 August 2021 06:55 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/1 "2021-08-01T06:55:09Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 August 2021 08:33 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/2 "2021-08-01T08:33:35Z")

</div>

> [@Matt.L](#):
>
> I'm looking into if it's possible for me to get data directly from [AirNow.gov](http://AirNow.gov)

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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c2a9319ba612829cf0684e7ee0161623adb6788.png)

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/29dc911296c77ffd64aebdc050cd65f775ae334d.png)

demo flow...

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2021 08:50 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/3 "2021-08-01T08:50:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matt.L](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Matt.L](https://discourse.nodered.org/u/Matt.L)\
**Post date:** [5 August 2021 07:33 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/4 "2021-08-05T07:33:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matt.L](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Matt.L](https://discourse.nodered.org/u/Matt.L)\
**Post date:** [5 August 2021 07:51 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/5 "2021-08-05T07:51:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [5 August 2021 11:19 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/6 "2021-08-05T11:19:38Z")

</div>

[https://www.unipi.technology/key\_feature/plc-programming-4-integration-of-an-indoor-air-quality-sensor-using-mqtt-367](https://www.unipi.technology/key_feature/plc-programming-4-integration-of-an-indoor-air-quality-sensor-using-mqtt-367)

and also node-red

---

<div class="post-metadata">

**Author:** ![Matt.L](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Matt.L](https://discourse.nodered.org/u/Matt.L)\
**Post date:** [5 August 2021 16:42 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/7 "2021-08-05T16:42:43Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a71e9a557dc106a87171bd50d363e650417bf604.png)  
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.

---

<div class="post-metadata">

**Author:** ![iiLaw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iilaw/32/14782_2.png) [@iiLaw](https://discourse.nodered.org/u/iiLaw)\
**Post date:** [5 August 2021 18:00 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/8 "2021-08-05T18:00:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 October 2021 18:01 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/9 "2021-10-04T18:01:03Z")

</div>

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