Could an App be created to see Air quality via Purple Air
I want to add the ability to select a specific purple air sensor.
I created a PurpleAir app for the Tidbyt! Itās available from the Tidbyt app. Search for āpurpleā. It will list air sensors close by and you can also specify a sensor ID. You can get the sensor ID from the PurpleAir map if you donāt know it already.
Looks great!! Thanks for the app
How do you get the sensor ID from the purple air map? I donāt see it. The one it gave me by default is on the other side of the world.
Go to https://map.purpleair.com and find your location on the map. Choose a nearby sensor by clicking on it and then use your mouse to hover over the āGet this Widgetā text. The tooltip will show the sensor id in the id.
Iām surprised youāre getting a sensor on the other side of the world. I havenāt seen that yet. I wonder if the Purple Air API Iām using to find nearby sensors isnāt returning the correct data, or if I have a bug in the app?
Thank you for your quick reply, posburn. I did that and I put in the number for the closest sensor, but it has the temperature at 120 degrees F! We are hot here today, but not that hot! Also the number it shows for air quality isnāt what it shows on the map. When I loaded the app, it setup Alcatraz Dock as the closest sensor. Iām not sure where this is, but I live in Ukiah, California and have multiple sensors near me (within 5 miles) so this certainly isnāt the closest one. When I put Alcatraz Dock into Google Maps it gave me somewhere in Italy.
I noticed too that I couldnāt change the sensor only the sensor ID. I can click on the sensor, but it brings up my address and something called āAlcatraz Dockā which doesnāt exist as far as I can tell on the PurpleAir map and a little locator icon where it says powered by Google above it.
Alcatraz Dock (in S.F. Bay) is what I use as the default list of sensors before I try getting a list of sensors near your location. So my guess is that getting sensors for your location is failing, so the only one in the list is the default Alcatraz Dock. If you want to send the sensor ID to me that you are using, I can check it out. A couple of things ā¦ the number I calculate in the app may differ a little bit from what is on the map. Itās also possible they have updated their formula and method of calculating that value so that it differs a little bit from the Tidbyt app. Also, when a sensor is in direct sunlight it really heats up which would explain the high temperature reading.
That makes a lot of sense. Here are some sensors that are close to me:
78583
85097
56849
91911
17835
The top few are closer to me. The bottom ones are slightly farther away. When I plug these numbers in, they all give me readings but they all are off. Most come in with air quality readings 30 points low and the last one is about 30 points high.
Thank you for the help posburn!
After taking a look at the map and looking at the sensor IDs you listed, it looks like you may be looking at numbers with no conversion method applied. The Tidbyt PurpleAir app uses the US EPA conversion. Itās possible I need to update it since the numbers are still a bit off, but they are much closer when using that conversion.
In the upper, left-hand corner of the map there is a white rectangle. Click that and then choose āUS EPAā in the āApply Conversionā dropdown and youāll notice that the numbers are closer.
I need to check the latest EPA formulas being used.
I see what you mean. I didnāt realize about the conversion method. They are closer now, but like you said, still a bit off.
Thank you.
@posburn is it possible to add the ability to select which channel it uses (A vs B)? My sensor has a borked channel B and the reading is like 2k. On PurpleAir map, it shows the value from A it seems like (normal reading), but in Tidbyt it is displaying the 2k value.
Hi @skurvy_pirate - the Tidbyt app averages the A and B sensors as PurpleAir recommends. I bet they check both values first to make sure they are valid before using them. I should add that to the Tidbyt app. I could check both and if one is not valid, I donāt use that one and use the other. Iāll see about adding that. Thanks for letting me know.
Also, itās possible one of your sensors needs to be cleaned - have you read this before?
@skurvy_pirate @whoster - Iām working on an update to the PurpleAir app that fixes a few bugs Iāve found when calculating the AQI and adds a config option to select the sensor to use in the calculation. Thanks for that suggestion @skurvy_pirate!
@whoster Iāve also discovered that my code does not handle the case where a PurpleAir device only has one sensor. It always assumes an A and a B sensor are present, which can greatly affect the AQI I calculate in this case. Iām addressing that as well.
Finally, Iām looking into using the confidence score that the API returns for the device. On the PurpleAir map you can see sensors that have a low confidence value easily as they are shown with transparency. The lower the confidence, the less opaque the circle is. I thought that might help @skurvy_pirate as you could check your sensor on the map and see if it is more transparent or not.
If anyone has any feature requests or suggestions now is a good time to let me know.
Thatās great information, posburn! Thank you so much for the update! Let us know when you have it in place and Iāll be glad to test it for you and tell you how accurate it is for the sensors Iām using.
Thanks @posburn! Yeah it appears PurpleAir map is discarding the bad value. I guess you could do something similar but might be interesting/tricky to determine when you are getting bad data from one of the sensors as you might not know if the lower or higher value is the bad value. PurpleAir might be looking at nearby sensors to help make this decision to decide which sensor is bad? My sensor has a confidence of 0 lol (rightfully so, one channel is completely off the charts). I tried blowing it out with pressurized air already but plan to open it up to try and blow it out a little better when I get a chance. Otherwise will be looking to buy a new sensor to replace.
Makes sense. I read on the PurpleAir forums somewhere they have a sensor replacement you can buy. I think it was $49 and replaces both A and B sensors and you can do it yourself. Much cheaper than buying a new PurpleAir device.
The updates for the PurpleAir app are live now. The app now handles devices with low confidence PM sensors and devices with only 1 sensor. You can also choose which PM sensor to use in the configuration options. The default is the average of the A & B sensors if both are working correctly.
A different EPA AQI formula is used and I discovered I was not using the PM values with a correction factor applied. Now the app uses the corrected values.
So, with all of that, I hope youāll find that the AQI value the Tidbyt app shows is closer to what you might find on the PurpleAir map.
Let me know if you have any other suggestions or feedback. Thanks for your help!
Itās possible the update to the PurpleAir app isnāt live yet. Let me know when you see the new Particle Sensor option.