[EDGE] PurpleAir Air Quality Edge Driver

I am making available an Edge driver for air quality measurements, that is based on an original Groovy-based driver.

PurpleAir provides realtime monitoring of air quality. You can use your own sensors, or access the many sensors in your geographic area. A free access key can be obtained from their website.

PurpleAir provides a RESTful API to access their sensors via the internet, but because Edge drivers are normally limited to communicating to the local network only, in order to use this driver, you will need to be running my edgebridge application on an always-on LAN computer (Raspberry Pi, Windows, Linux). This application provides a ā€˜proxyā€™ or ā€˜bridgeā€™ for forwarding the API requests to addresses outside the local network.

Features

  • Displays AQI, AQI category, and sensor names
  • Average of multiple sensors within a defined latitude/longitude coordinate box, or use a specific sensor by index number
  • Automatic periodic updates
  • Dynamically change the update interval via automations

Thanks to @bthrock for requesting this driver and testing it.

The driver is available on my shared projects channel now, and more information is available in the github README file.

7 Likes

TAustin, I presume this works with their newer Touch Indoor Sensor as well. Does your driver allow reporting of the VOCs, or just the AQI? Iā€™d love a local solution for reading VOC, Iā€™m currently using Amazonā€™s devices, but rely on their Smarthome to flip a virtual switch to accomplish what I want.

Hello - Right now, the devices include only the AQI, but as long as the VOC data is included in the API response, thereā€™s no reason I couldnā€™t add it.

This is what I see in the docs regarding the voc measurement:

voc	Number	
VOC concentration (IAQ) in Bosch static iaq units as per BME680 spec sheet, EXPERIMENTAL. Null if not equipped.

Variations:
voc returns average for channel A and B.
voc_a returns channel A data.
voc_b returns channel B data.

Would you just want the voc or do you care also about the channel A and B data?

I think having the average is better than the individual channel data. Thanks!

This sounds cool but I have a couple of questions.
Do you know what data is being returned by voc_a and voc_b? Ģ¶AĢ¶rĢ¶eĢ¶ Ģ¶oĢ¶nĢ¶eĢ¶ Ģ¶oĢ¶fĢ¶ Ģ¶tĢ¶hĢ¶oĢ¶sĢ¶eĢ¶ Ģ¶cĢ¶hĢ¶aĢ¶nĢ¶nĢ¶eĢ¶lĢ¶sĢ¶ Ģ¶bĢ¶eĢ¶iĢ¶nĢ¶gĢ¶ Ģ¶uĢ¶sĢ¶eĢ¶dĢ¶ Ģ¶tĢ¶oĢ¶ Ģ¶rĢ¶eĢ¶tĢ¶uĢ¶rĢ¶nĢ¶ Ģ¶mĢ¶eĢ¶aĢ¶sĢ¶uĢ¶rĢ¶eĢ¶mĢ¶eĢ¶nĢ¶tĢ¶ Ģ¶dĢ¶aĢ¶tĢ¶aĢ¶ Ģ¶fĢ¶oĢ¶rĢ¶ Ģ¶PĢ¶MĢ¶ Ģ¶2Ģ¶.Ģ¶5Ģ¶,Ģ¶ Ģ¶aĢ¶nĢ¶dĢ¶ Ģ¶tĢ¶hĢ¶eĢ¶ Ģ¶oĢ¶tĢ¶hĢ¶eĢ¶rĢ¶ Ģ¶fĢ¶oĢ¶rĢ¶ Ģ¶PĢ¶MĢ¶ Ģ¶1Ģ¶0Ģ¶?Ģ¶
Is there a free tier for API calls, or will we be responsible to pay for our API calls?

Edit: Ģ¶PĢ¶aĢ¶rĢ¶tĢ¶iĢ¶cĢ¶lĢ¶eĢ¶ matter is part of AQI measurements, not VOC.
Edit #2: Correct terms are particulate matter, or particle pollution.

Iā€™ve started to look at the code modifications to add the VOC data. Could you help me out by providing me an example of the response data that includes the VOC value(s), along with the (SmartThings) device settings you use? Iā€™m not entirely clear on if this is coming from sensors within a search box, or from a specific device you have configured, and if the latter, how the data is formatted.

You can direct message me the info. Thanks.

When I signed up, they had just converted over to a points system and I got a million points assigned to my account for free. They get deducted every time I make an API call, so not sure whatā€™s going to happen when I run outā€¦

Thatā€™s some useful information, thanks for sharing. I guess how long the free point allotment will last all depends on the individualā€™s call frequency, and after the points are used, weā€™ll need to buy more.

I donā€™t, at the moment have a Purple Air device. I currently use an Amazon device, the behavior of which is limited because it can only interact with SmartThings via a simple binary switch. I use the VOCs to trigger an exhaust fan when they are over a certain threshold. Iā€™d really like to make the trigger more sophisticated, e.g. the VOCs increased by X or more over Y or less minutes, and that is why I asked about VOCs in your driver.

Itā€™s worth noting that with Toddā€™s driver you have the ability to dynamically change the update interval via automations.

In our area, where smoky skies due to wildfires are part of what we call ā€œsummer,ā€ AQI has a significant effect on our HVAC automations, so I use the interval change capability to adjust the update frequency based on changing conditions. For example, if the AQI is elevated or changes rapidly, I increase the frequency of updates. If it drops, the call frequency drops.

Also, itā€™ll take me years to use 1 million points, and $10 to buy another. I can live with that.

I really donā€™t know how the PurpleAir Touch Indoor Air Quality Monitor actually works, so I canā€™t say 100% for sure if it would work with this driver. The web page says that its data is made available through the ā€œPurpleAir Mapā€; if that means it looks like any other PurpleAir sensor on their network, then yes, it should work. In my vicinity I found a couple public PurpleAir sensors that are returning VOC data and Iā€™ve already made modifications to my driver to display that in addition to the AQI.

If you get one and we find issues, Iā€™ll be happy to do whatever we need to to make it work, even if that means a separate Edge driver.

Please let me know what you plan to do.

1 Like

Thatā€™s a really good idea, rather keeping a constant call frequency. The wildfire smoke is a factor here, too, and I was also looking at the PurpleAir Touch but will hold off until I see if it can be supported by this driver. Until then, my Cube air purifiers is running on Auto.

And youā€™re right, those million points will last a long time for the majority of us.

1 Like

Thanks for the advice @TAustin in using this driver.
My API key is in the device settings, and I am doing a ā€œSearch for devicesā€ and have put in my lat and log and increased the search box size to 25 as well. But I am getting a 402 error in the Bridge server. when pasting the link from the bridge server into a browser I get the following
{
ā€œapi_versionā€ : ā€œV1.0.11-0.0.47ā€,
ā€œtime_stampā€ : 1690585572,
ā€œerrorā€ : ā€œApiKeyMissingErrorā€,
ā€œdescriptionā€ : ā€œNo API key was found in the request.ā€
}
What am I doing wrong?

DM me a screenshot of your device settings screen.

I am having the same exact issue. Did you figure it out?

It looked like he may need to have followed this procedure to ensure that his assigned points are useable:

Your organization starts with one million points. However, these points are not added to any projects yet. On https://develop.purpleair.com/ home, select the ā€œProjectsā€ tab. Next to the project you want to add points to, select the ā€œUpdate Projectā€ button. Near the top of this pop-up is your organizationā€™s total number of points. Below that, you can enter the number of points to give to this project. Once that is updated, your API keys will work once more.

More information is available here: New API Dashboard - Announcements - PurpleAir Community.

1 Like

Worked perfectly!

Appreciate the help as always!

1 Like

(1) If I am the owner of both outdoor and indoor PurpleAir sensors and I have direct LAN access to the sensors, is there any way to use this driver without going through the external API and spending API points?

(2) How can I add an additional device to monitor a second specific PurpleAir sensor?

I was able to answer my own question (2) about how to add an additional device.
I used vEdge Creator V2.94 to create a virtual air quality sensor and then changed the driver of that device to ā€œPurpleAir AQI v1.0ā€. After filling in the settings, it now provides me an additional PurpleAir sensor device in SmartThings.

I donā€™t know what the direct interface to the devices is. If it replicates the cloud-based API, then it may be possible to get it to work. DM me if you want to discuss further.

Regarding what you did to create a second device, Iā€™m very surprised that would even work! Regardless, giving the ability to create additional PurpleAir devices is a feature I can add, but just never did since no one asked before. :slight_smile: But if you are happy with what you have, then that may not be necessary!