Unfortunately for some of us in the US, the air quality is terrible due to wildfires. I created a quick tile to show the current AQI near my house. The data is coming from one of the many purpleair.com sensors.
The code is here (don’t judge me on the code quality ): Glitch :・゚✧
Feel free to clone it and make it your own as I am still fine-tuning mine. The only line that needs to be updated is the one where we fetch the data from purpleair.com (line 204), you want to select a sensor that is near your house. Let me know if you need instructions for finding the sensor id on purpleair.com
@dbaq, thanks for sharing this very cool project. I liked how simple it looks visually.
I’ve moved your post to the Community Project category where other community members usually look for in regarding to the community developed projects. A couple feedback, you may want to take a look of the stio library and allow users to provide the sensor id via the Tile Editor in the dashboard, so they don’t have to look up in the code.
And you can also take advantage of the direct Custom Tile import URL as shown below to allow users to import the source code and create the custom tile in just one simple click. (I created the the import link with the image below and feel free to include it in your original post.)
you may want to take a look of the stio library and allow users to provide the sensor id via the Tile Editor in the dashboard, so they don’t have to look up in the code.
Yep, that’s the plan if I see any interest from the community
Awesome work on this! I really like the clean look and how easy it is to see things at a glance with the stoplight style colors.
Per discussion with @dbaq via PM, here’s a version that works like a native custom tile where it let’s you configure the PurpleAir sensor ID in the tile configuration.
The numbers roughly match but Purple is showing an AQI of 57 (yellow) and the tile is showing 47 (green). Maybe just a minor difference in the conversions to AQI?
The response could return multiple sensors (the main one + all the child sensors). I am using the first one in that list and I am using v1 which is the pm2.5 10 min average. We could also make that configurable.
As for the conversion mismatch, you are right. I also see some differences within the +/- 10. I reimplemented the code from Spare The Air: AQI Calculator: Concentration to AQI which could be slightly different from purpleair.com. In the end, from an AQI perspective, the difference is not meaningful but I will dig into it to understand the difference between purpleair and sparetheair when I get a chance.
@dbaq Really like the new tile and just added it to my dashboard. I have been noticing a rather big difference between what the website report and what my dashboard shows with this ID 17889. This morning, the difference is more than 25 between the two. I tried the calculation manually and have use the data returned by the json (13.74) and ran the calculation on the site AQI Calculator = 44. The tile was reporting 21. Was just wondering if this difference is somewhat normal? Great work!
Hi, is this tile still working? I imported the tile and entered a sensor near me and all I see is a blank tile with the wind icon. I have tried changing sensor IDs and even tried the https://www.purpleair.com/json?show=95579 URL to see if the JSON would show and I get an “over the limit” for the API error page.
Here is the tile I see when I add it to my dashboard:
The API keys are free and can be obtained emailing contact@purpleair.com with your name and email address. Right now, they’re taking a couple of days to respond.
In HE, I’ve moved to this driver for working with PurpleAir.
Many thanks Bob, I have contacted PurpleAir so hopefully will get the API key shortly.
I am using the access through Sharp tools. I’ll let you know how it goes.
I received the API key from PurpleAir - they are very responsive with their support - and have everything working through a Custom Tile in Sharp Tools. @IslandSoul thanks for putting me on the right track.