Saratoga template Purpleair script problem

OK, I give up.

No data from Purpleair - check Sensor ID/API key

Json:

{“SensorId”:“44:17:93:1:4d:6d”,“DateTime”:“2023/08/29T01:32:21z”,“Geo”:“PurpleAir-4d6d”,“Mem”:20016,“memfrag”:15,“memfb”:16952,“memcs”:936,“Id”:1090,“lat”:61.106400,“lon”:-149.843506,“Adc”:0.03,“loggingrate”:15,“place”:“outside”,“version”:“7.02”,“uptime”:64467,“rssi”:-73,“period”:120,“httpsuccess”:1088,“httpsends”:1092,“hardwareversion”:“2.0”,“hardwarediscovered”:“2.0+BME280+PMSX003-B+PMSX003-A”,“current_temp_f”:63,“current_humidity”:73,“current_dewpoint_f”:54,“pressure”:1005.25,“p25aqic_b”:“rgb(3,228,0)”,“pm2.5_aqi_b”:11,“pm1_0_cf_1_b”:1.12,“p_0_3_um_b”:379.85,“pm2_5_cf_1_b”:2.60,“p_0_5_um_b”:106.13,“pm10_0_cf_1_b”:2.77,“p_1_0_um_b”:22.50,“pm1_0_atm_b”:1.12,“p_2_5_um_b”:3.46,“pm2_5_atm_b”:2.60,“p_5_0_um_b”:0.35,“pm10_0_atm_b”:2.77,“p_10_0_um_b”:0.00,“p25aqic”:“rgb(1,228,0)”,“pm2.5_aqi”:8,“pm1_0_cf_1”:1.32,“p_0_3_um”:402.63,“pm2_5_cf_1”:1.89,“p_0_5_um”:111.84,“pm10_0_cf_1”:2.11,“p_1_0_um”:18.16,“pm1_0_atm”:1.32,“p_2_5_um”:1.33,“pm2_5_atm”:1.89,“p_5_0_um”:0.00,“pm10_0_atm”:2.11,“p_10_0_um”:0.00,“pa_latency”:404,“response”:201,“response_date”:1693272725,“latency”:516,“wlstate”:“Connected”,“status_0”:2,“status_1”:2,“status_2”:2,“status_3”:2,“status_4”:0,“status_5”:0,“status_6”:2,“status_7”:0,“status_8”:0,“status_9”:0,“ssid”:“ASUS50”}

TIA!

Possibly related to this? https://discourse2.weather-watch.com/t/charges-for-purpleair-api-calls/72160

That’s the error message from Ken’s purpleair-inc.php script: have you entered valid ID and read key in lines 14 and 16? (Note the ID is not the MAC address of the sensor.)

BTW you should delete one of the duplicate lines 41 and 61 beginning $pajson = file_get_contents or you will make two calls to the API every time - see here.

Your json looks like the one you can get direct from the sensor using http://198.162.1.xxx/json, but Ken’s scripts are looking for the json returned from a call to the PurpleAir API.

I still can’t get the purple air scripts to work. I had it working with numerous errors but canned it. Can someone help mee por favor!

When did you get your device, and when did you get your PurpleAir API read key?

You may want to wait until Ken updates the scripts in the near future. If you recently bought your PurpleAir device you now have to pay for calls to the PurpleAir API, and the original scripts could cost quite a lot.

II’ve had the purpleair for several months. My API Read is new………….

Maybe you should post on the wx-forum also

The discussions and help from the author @ktrue about the new PurpleAir-API can be found here

Wim

OK. I know that Ken’s script works because I’m running it myself, so can we check the API end?

When you first go to PurpleAir Develop to get a read key you set up a Project, usually your name plus a number. (You can edit the name.)

You also get a million free points, awarded to your Organisation, usually your name.

Then you have to transfer some or all of your Organisation’s points to your Project or you will not be able to make calls to the API.

Apologies if you have done all this already :slightly_smiling_face:

Every call from Ken’s current script costs you 155 points (310 if you don’t delete one of the lines, as I mentioned above!), so eventually you will run out of points and have to buy more. So I do not recommend the cron job he mentions in one of the WXForum posts referenced above: that was OK for the free API. If you use the script as supplied you only make a call each time the air quality page is visited.

Thank you, thank you! Moving points to my project made it all work.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.