Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PurpleAir? Purple Air
Purple air is a low cost, high quality air quality monitor (  I have one. I get smoke from beach fires. I want to close my windows (already powered by HAI and controllable via CQC) when air quality indicator spikes.

They have a real-ish time api using JSON.

Here is a note to it.

Is there some general purpose CQC device driver that can read this in?

real example (not mine):
note it is one device with 2 sensors so there are 2 sets of "stats". One sensor is the parent of the other.

I wouldn't want/need all fields
I would want time stamps (in local time of last new data point received) and "stats" like v, v1, v2 for each of sensor 1 and sensor 2. These v values are PM2.5 (particulate matter, 2.5 microns or less) expressed in ug/m^3. "v" is real time, v1 is 10 min avg, v2 is 30 minute average, etc.)

Probably some QA checks like "Flag" and "A_H"

So that's a cloud based thing, right?
Dean Roddey
Explorans limites defectum
(04-09-2019, 05:35 PM)Dean Roddey Wrote: So that's a cloud based thing, right?

Stored in cloud. Accessible via json API I provided link to.
How does it know the request is from you? There's no user id or anything discussed in the readme file. There's a sensor id, but I'd have thought that was an id specific to you. Or is that some universally unique id that is only for you?
Dean Roddey
Explorans limites defectum
It doesn't know from whom the request comes and doesn't care. The data is free/public. A bit like WUG in the early days. While WUG required you to have an api-access account, once you did you could access any weather station. This is similar, you can access any PurpleAir pollution monitor, but no api-license is required.

In the example I gave above:
this is not my sensor. But if you know someone's sensor number, you can grab that data. When you own a sensor, you can configure it so that the data is not public. But the default is public. If it is public, it shows up on their map
map here:

It may be that if you configure your station as not public then no one can pull the data from the api. I'm not sure.

But for my case, my PA station is and will be public, so it is just like the case of station 15211 I'm using above.

I got started on this tonight. Am I right in assuming that there's only this one type of sensor, and they all have temp, humidity, pressure, and the particulate thing?
Dean Roddey
Explorans limites defectum
I am getting there. It's considerably more messy than it looked to begin with.
Dean Roddey
Explorans limites defectum
Well that was a lot more work than it should have been. But, give the next drop (5.3.951) a try and see how it works. You will have to create a configuration file in:


It's named after the moniker so you can have more than one if you needed to though probably not. It's JSON because the data is JSON and therefore I already had to bring in the JSON parser and such.

    "scale" : "f",
    "sensors" :
           "name" : "FrontPorch",
           "id" : "15211",
           "mintemp" : "0",
           "maxtemp" : "100",

           "childname" : "SidePorch",
           "childid" : "15212"

So indicate the scale you want, then there's an array of sensors. Each sensor has to have at least the name and main sensor id. If it has a child you can include the child name and its id. Even if has one, if you don't need it to be processed by the driver just leave the child values out.

Indicate the scale you want for the temps (to set a range limit on the temp fields), in the scale you choose of course. If there are two sensors both will use the same range values, which almost always would make sense I would think.

The name part is the base name used to create the field names. It has to be a valid part of a field name.
Dean Roddey
Explorans limites defectum
OK, 5.3.951 is posted and has this driver. It only provides real time particulates because for some bizarre reason the other particulate stuff was put into the content as just a string, though it contains JSON. So it would have required a recursive parse which I didn't plan on in this driver and it would have complicated things a lot. It provides humidity, the flagged value, real time particulates, temp, and pressure.
Dean Roddey
Explorans limites defectum

Forum Jump:

Users browsing this thread: 1 Guest(s)