[RELEASE] Free PurpleAir Air Quality Station - Now with native Hubitat support!

PurpleAir Air Quality Station v1.1.01, updated on March 28, 2019

This DTH provides continuously updated Air Quality Index based on the PM2.5 data supplied by a Purple Air air quality sensor (see www.purpleair.com for more information).

Now automatically supports both SmartThings and Hubitat - no edits required

Now supports PurpleAir “Inside” sensors (with a single laser)!

Simple Setup

To use this Air Quality Station in SmartThings, you will need to:

  1. Create a new SmartThings device handler using the supplied source code
  2. Create the actual device: log into the IDE, select your Location, select Devices and then select Create New Device
  3. Specify your preference for update frequency
  4. Specify the desired PurpleAir Station ID you want to monitor

To find a specific Station ID:

  • Use the live PurpleAir Map to locate a station (https://www.purpleair.com/map)
  • Open this URL in a new Window or Tab: (https://www.purpleair.com/json)
  • Search for the NAME of the station you found above
  • The Station ID is the first element in the results[:] map - you will enter this ID (1-5 digit number) into the preferences for the Air Quality Station

That’s it - save, and you should be up and running!

The code for this PurpleAirStation can be found here:

To integrate directly into your SmartThings IDE, use these parameters:

Owner: SANdood
Name: PurpleAirStation
Branch: master

Change Log

  • 1.0.00 - Initial Release
  • 1.0.01 - Cleanup of description Texts & bug fixes
  • 1.0.02 - Fixed some typos
  • 1.0.03 - More string edits
  • 1.0.04 - Updated icons & color handling
  • 1.0.05 - Now uses BigDecimal for maximum precision
  • 1.0.06 - Finalized conversion to BigDecimal
  • 1.0.07 - Better error handling
  • 1.0.08 - Changed all numeric attributes to “number”
  • 1.0.09 - Changed to maintain and display only integer AQI (decimals are distracting)
  • 1.0.10 - Fixed room/thing tile display
  • 1.0.11 - Handles Inside PurpleAir Sensor (only 1 sensor by design)
  • 1.0.12 - Internal cleanup of Inside sensor support, added runEvery3Minutes()
  • 1.0.13 - Code annotations for hubitat users
  • 1.0.14 - Added CAQI calculation for new “Air Quality Sensor” - see https://en.wikipedia.org/wiki/Air_quality_index#CAQI
  • 1.1.01 - Automatic support for both SmartThings and Hubitat|


As always, my contributions to the SmartThings community are entirely free, but should you feel compelled to make a donation, you can do so here: https://paypal.me/BarryABurke


This is great! Thank you for the app. I was able to add my home station.

1 Like

PurpleAir Air Quality Station was updated to v1.0.10 today - see Changelog above (in first message).

Thanks for this. Does it work with the indoor sensor as well? I can get it working with my outside one but I want to turn on air cleaners etc (nor cal) based on indoor air quality. I set the indoor one to be public in case that was the issue but still have not been able to get it to work.

I don’t know of any differences between indoors and outdoors PurpleAir sensors. Where you able to find the device ID in www.purpleair.com/json ?

I am able to find the ID. The differences I am aware of are the indoor sensor has only one laser and also has a color changing LED to indicate air quality.

Do you mind sharing with me the ID # of your internal device? I’ll have a look at the JSON it is providing and see why it isn’t making it through my code…

You can PM/Message me if you prefer…

Sent PM. Thanks!

Yeah, got it working … uh oh, I’m gonna die :frowning_face:

Pick up the latest v1.0.11 - it now supports the Indoors version of PurpleAir sensors

Great, many thanks. The kids should sleep good tonight :slight_smile:

Now I just need to turn on the air cleaner in that room and circulate the whole house air with nest when it gets too high :stuck_out_tongue:

FWIW, I use FooBots for my internal Air Quality Sensor, and it has direct integration with Nest & Ecobee to run the fan when it gets yucky inside. That said, I don’t think it ever has actually turned on the fan (my house is pretty tightly closed up, with HEPA 15 filters in the HVAC…

Updated to v1.0.12 on August 10, 2018 at 4:55pm EDT

  • Internal code cleanup
  • Better error/logging messages
  • Added runEvery3Minutes - ‘Inside’ sensors seem to update less frequently than outside ones
1 Like

Wow, $230 for a stupid little laser particle sensor? Aren’t there much better air quality sensors out there at this price?

Maybe? If you found/find one can you post it here?

I could be wrong, but it looks to me like that FooBots mentioned up above does a ton more than just simple particle detection and it is only $200. What am I missing?

Obviously, I agree that the Foobot is better for indoors, and PurpleAir for outdoors, since that is the path I’ve taken. There is a SmartThings DTH for the Foobot as well, although it doesn’t use the same AQI Scale.

The only thing missing is that neither Foobot nor PurpleAir provide (true) CO^2 measurements (Foobot’s interpolate abs estimate).

Foobots is meant for indoor air quality. PurpleAir for outdoor. If you live in the Western US these days, and you have people in your family with lung issues. You know the value of having good outdoor air quality readings. (as well as indoor)

Barry (@storageanarchy), I’m using your DTH for a webCoRE piston that displays the AQI/PM values. However, when retrieving the AQI and PM data, any trailing zero (0) gets dropped from the retrieved value. For example, here’s a screen shot of the piston’s status page with the AQI10 and AQI24 values of 3 and 2, respectively … they’re supposed to be 30 and 20:

This also applies to the retrieved PM data, but is doesn’t really matter (to me) since it’s dropping the zero (0) at the end of a decimal number.

For a quick fix (I haven’t found the time yet to thouroughly look at the code), I temporarily changed (back?) the AQI attributes from ‘number’ to ‘string’ in my local copy of the DTH. The following example screen-capture now correctly displays the AQI10 value of 30, in this case:

Thanx for the DTH! :+1:

1 Like

I am unable to find the device ID in that jumble of letters and numbers, is there an easy way?