PurpleAir_API

@ PurpleAir owners only!

Attached a folder with three replacement scripts and the URL/links as in this post.

The adapted scripts will load the data using the API https://api.purpleair.com/#api-welcome

Blame PurpleAir not the script author:
Every user has to obtain a developer key by sending an e-mail https://community.purpleair.com/t/making-api-calls-with-the-purpleair-api/180
Read the introduction and click the link link “contacting us”.

Insert the API-key you will get by e-mail into line 3 of PWS_load_files.php version 2022-05-29 from the zip.

$purpleairAPI   = '72F1F60C-C16B-11EA-982D-42010A800242';  // obtain a developer key by e-mail at purpleiar

Back-up the three scripts on your webserver first!
Upload the three scripts to your webserver.

After a few minutes the cron-job will replace the old data file with a new file and the PWS_Dashboard block and popup should look as in the past.

=== ToDo

[ul][li]Some “good-soul” should write a more clear description[/li]
[li]A sensor-owner with a Voc chip should post a link to test the Voc data, Wim has only access to a standard PurpleAir sensor[/li]
[/ul]

Hope this helps,

Bill


purpleAPI.zip (17.7 KB)

Hi,
installed the scripts and the values are coming in.

I have a device with VOC , although the value seems to be stuck on 25 all the time.
What kind of link do you need :?
This is the widget provided by purple air :

<div id='PurpleAirWidget_57949_module_VOC_conversion_C0_average_0_layer_basic'>Loading PurpleAir Widget...</div>
<script src='https://www.purpleair.com/pa.widget.js?key=DU85L1NPUG9YP843&module=VOC&conversion=C0&average=0&layer=basic&container=PurpleAirWidget_57949_module_VOC_conversion_C0_average_0_layer_basic'></script>

Hi,

Only the link to your PWS_Dashboard website.
Then Wim can check the PurpleAir-ID and the converted file in the json/ folder.
He then can use his own API-key to load your data and find the field-names and test the values.

Bill

Thanks alot Leuven7, really appreciated.

Working perfect. :smiley:

Bjørn

here it is : https://www.matar.be/pwsWD/index.php

Just updated the scripts and my PurpleAir data is importing again. Thank you Bill and Wim! Unfortunately, I have an older PurpleAir and it does not have the VOC sensor.

-Chris

Thank you Leuven7 ours is back up and running

Hi

Does anyone know if its possible to display VOC values with the new api ?

Thanks

Graham

I changed this :
put $Voc to true

#------------------------- EXTRA sensor settings
$Voc            = true;
$iaq_Bosch      = 'iaqB';
#
#-----------------------------------------------

and changed Voc to voc (small letters) in following code :

#
#  Voc measurements  to be added as no sensor available to test
if ($Voc <> false && array_key_exists('voc',$parsed_json['sensor']) ) 
     {  $Voc = $parsed_json['sensor']['voc'];  }   // ?????????
#

unfortunately my value is stuck to 25 since a couple of months