With wildfire season once again in full swing in the Western U.S., I’ve written a plugin that creates a virtual device reflecting the current state of a PurpleAir sensor. Since I don’t actually own one, I’ve only been able to test it with a public sensor. In theory, you should be able to access a private sensor using its read key. Note that this plugin provides read-only access to the sensor.
The plugin requires the ID of the sensor you want to add. To find the ID of a public PurpleAir sensor near you, go to https://www.purpleair.com/map and click on a sensor. You should see the five-digit ID number in the URL after “&select=” or, alternately, hover over “get this widget” on the sensor details and you’ll find it in the widget code at the beginning of the ID (e.g. “id='PurpleAirWidget_11111”). If the sensor is private, you’ll also have to provide the ReadKey.
Last updated: 19 August 2021
PurpleAir.plugin (10.2 KB)
Also available via GitHub
Plugin Settings:
- SensorID: ID of PurpleAir sensor (can be found in URL of public sensors)
- ReadKey: [optional] Required to access a private sensor
- US_EPA_Correction: Boolean value. Default of “true” applies the US EPA correction to the PM2.5 reading in calculating the US AQI (more accurate for wildfire smoke). More information about this correction can be found here.
Device capabilities:
- AirQualitySensor
- PressureMeasurement
- RelativeHumidityMeasurement
- TemperatureMeasurement
Device attributes:
- AirQuality: Estimate of CAQI based solely on PM2.5 readings. CAQI is designed for comparing traffic-related pollution across various cities, rather than measuring the real-time risk to human health from breathing in particulates in the air. It’s calculated from measurements of NO2, PM10, and O3; PurpleAir doesn’t measure NO2 or O3 and is less accurate at measuring PM10 than PM2.5.
- Altitude: Altitude of PurpleAir sensor
- Humidity: Relative humidity inside housing of PurpleAir sensor. Roughly 4% lower than ambient conditions.
- Latitude: Latitude of PurpleAir sensor
- Longitude: Longitude of PurpleAir sensor
- Pm1: Sensor’s calculation of PM1.0 (ug/m3)
- Pm10: Sensor’s calculation of PM10.0 (ug/m3)
- Pm2_5: Sensor’s calculation of PM2.5 (ug/m3) using PurpleAir’s correction
- Pm2_5cf1: Sensor’s calculation of PM2.5 (ug/m3) without correction
- Pm2_5_10minute: Sensor’s calculation of average PM2.5 over 10 minutes
- Pm2_5_30minute: Sensor’s calculation of average PM2.5 over 30 minutes
- Pm2_5_60minute: Sensor’s calculation of average PM2.5 over 60 minutes
- Pm2_5_6hour: Sensor’s calculation of average PM2.5 over 6 hours
- Pm2_5_24hour: Sensor’s calculation of average PM2.5 over 24 hours
- Pm2_5_1week: Sensor’s calculation of average PM2.5 over 1 week
- Pressure: Pressure (millibars) measured inside housing of PurpleAir sensor
- SensorName: Name of sensor as assigned in PurpleAir
- Temperature: Temperature (degrees F) inside housing of PurpleAir sensor. Roughly 8 degrees F higher than ambient conditions.
- UsAqi: Calculation of US-defined AQI using the PM2.5 readings. If US_EPA_Correction is “true”, the US EPA correction for wildfire smoke is applied.
- UsAqiDescription: Label description of the AQI category (e.g. “Unhealthy for Sensitive Groups”)
- UsApiMessage: Text describing the effects of the AQI category