← Back to all sparks
P

PurpleAir

ANALYTICS
Velocity0.0

R package PurpleAir by cole-brokamp — release notes from GitHub.

The R client for PurpleAir sensors keeps finding its time-averaging was wrong.

air-qualitysensor-datar-packageapi-wrapperenvironmental-monitoringdata-quality
Current state
PurpleAir is a small R client for the PurpleAir air quality sensor API, covering sensor queries, historical readings, and — more recently — finding a sensor on the local network by IP address and id. Authentication has been simplified to an environment variable only, with the redundant key argument removed. The package is maintained reactively, and most of what ships is correctness work on the queries it already makes.
Where it's heading
The recurring theme is time aggregation. Weekly, monthly and yearly average intervals were wrong and fixed in one release; the weekly average was wrong again and fixed in the next. For an air quality package that is not incidental — averaging window is what turns a stream of sensor readings into an exposure estimate, and downstream analyses inherit the error silently. The other thread is failing earlier and more clearly: explicit errors for spatial inputs the sensor query does not accept, better index parsing so malformed requests never reach the API, and handling for history calls that return nothing. Local sensor discovery is the one genuine capability addition, opening a path that does not depend on the cloud API at all.
Prediction
On this record, further aggregation and input-validation fixes are the likeliest next releases; whether local network access grows past discovery into full local data retrieval is not something the entries indicate.

Recent moves

  1. 3mo ago

    Weekly averages fixed again; API key argument dropped

    Five fixes, and the notable one is that the weekly history average needed correcting a second time, one release after the interval fixes. The rest tightens the failure surface — an explicit error for sf and sfc inputs, better sensor index parsing so bad requests never leave the client, and handling for history calls returning nothing — while the unused key argument is removed in favour of the environment variable alone.

    View source ↗
  2. 10mo ago

    Local sensor discovery, and averaging intervals corrected

    New functions to find a PurpleAir sensor's local IP address and id are the one real capability addition in this window, and they point somewhere different from the rest of the package — at the device on your network rather than the vendor's API. Alongside, the one-week, one-month and one-year average intervals are corrected, and key validation is updated for a changed success code upstream.

    View source ↗
  3. 1y ago

    Bounding box sensor queries fixed

    A single fix to bounding box queries, credited to a user who tested and reported it. Characteristic of how this package develops: small corrections arriving as people hit them in real use.

    View source ↗