One of my Particle Internet Buttons shows the current AQI index using the LEDs on the ring of the internet button. I used the AirNowAPI.Org API.
AirNow APII generated a URL for my area. This can be done in a few ways, above shows doing it by Zipcode, you can also use a map area. Be sure to select the JSON format. Then I created a new Particle Web Hook using the URL generated from the AirNow API tool. Using the GET request type. In the advanced tab I entered:{{0.AQI}}~{{1.AQI}}~{{2.AQI}}
into the response template section. In my case, AQI 0 is Ozone, AQI 1 is PM 2.5 and AQI 2 PM 10. Some stations may not return all 3. Some may only do a subset of the three. For more information about AQI visit: https://airnow.gov/index.cfm?action=aqibasics.aqi .
It should look similar to the following when done:
Once created, the Webhook generates code to use to call in your particle code to trigger the request and to receive the event once the Webhook has parsed the data out.
The colors progress as the AQI increases. The first two being green, second set of two are yellow, third set red, fourth a purple, then the last single LED a magenta color.
Comments