PurpleAir 2023-11-04 json error for real

Today more stations report (sometimes) the error message
“Problem 57: Invalid / no JSON data purpleair.txt Check settings and data”
Sadly there are now two reasons for this.

  1. the API error discussed already, occurs always
  2. A real json error occurs and refreshing/reloading solves the problem

This is correct data for my station, I use also the not changing fields for testing:

{
  "api_version" : "V1.0.11-0.0.49",
  "time_stamp" : 1699088722,
  "data_time_stamp" : 1699088702,
  "sensor" : {
    "sensor_index" : 7302,
    "last_seen" : 1699088609,
    "name" : "Sluispark Leuven",
    "latitude" : 50.886333,
    "longitude" : 4.700227,
    "humidity" : 56,
    "temperature" : 60,
    "pm2.5" : 1.3,
    "pm10.0_atm_a" : 1.52,
    "pm10.0_atm_b" : 1.2,
    "stats" : {"pm2.5" : 1.3, "pm2.5_10minute" : 1.6, "pm2.5_30minute" : 2.2, "pm2.5_60minute" : 2.6, "pm2.5_6hour" : 2.2, "pm2.5_24hour" : 2.2, "pm2.5_1week" : 6.2, "time_stamp" : 1699088609}
  }
}

This is the data in error, there is an extra } at the end

{
  "api_version" : "V1.0.11-0.0.49",
  "time_stamp" : 1699088968,
  "data_time_stamp" : 1699088965,
  "sensor" : {
    "sensor_index" : 190464,
    "last_seen" : 1699088829,
    "pm2.5" : 3.6,
    "pm10.0_atm_a" : 4.1,
    "pm10.0_atm_b" : 3.56,
    "stats" : {"pm2.5" : 3.6, "pm2.5_10minute" : 5.4, "pm2.5_30minute" : 4.2, "pm2.5_60minute" : 3.2, "pm2.5_6hour" : 1.8, "pm2.5_24hour" : 1.6, "pm2.5_1week" : 2.8, "time_stamp" : 1699088829}
  }
}}

I have no idea how much stations have this and what causes this.
After a reload of the file, the data is OK.

Wim

What file is this code in? The error started on my site after I uploaded 21 updated files yesterday from 2023-09-09.zip.

Arcola, Virginia, USA Home Weather Station (wd version) (novawx.dscloud.me)

Hi,
Your jsondata/purpleair.txt shows the problem

"error" : "ApiKeyInvalidError",
  "description" : "The provided api_key was not valid."

After PurpleAir start using an API-key, a demo-developers key was in the first lines op the purplair scripts for a few months.
The final 2012_lts update you installed moved the PurpleAir-API-key to your easyweather settings in tab "Devices → third field “Purple Air sensor API key”

If you do not have a key already you have to apply for one as described in this topic

Succes,
Wim

Hi Wim,

Thanks for the quick reply.

Yes, I have a PurpleAir API-key already that was working until yesterday. I see the key is now missing from "Devices → third field “Purple Air sensor API key”.

I tried adding the Read key and then the Write key to "Devices → third field “Purple Air sensor API key” but the error persists.

You should only use a READ-key, there are no scripts which can use a WRITE-key which gives this error in your jsondata/

"error" : "ApiKeyTypeMismatchError",
  "description" : "The provided api_key was of the wrong type (WRITE)."

When you insert that read key, the current file with the warning will be replaced after the cached-data is invalid, at least 800 seconds in the current scripts

PWS_load_files.php (470) AQ-Purpleair__: File not old enough (679/800 seconds)

You can check all those things in the . . ./pwsWD/PWS_module_test.php script.
Loading all files an extra time is the bottom button
Checking a files age and content is the left button second row.
Select a file f.i. jsondata/purpleair.txt and click “List contents”

To get the file faster reloaded, use your FTP program to delete the jsondata/purpleair.txt and reload all files (bottom button). This wil give an error about a missing file, but we did that ourselves.

Succes,
Wim

Thanks again Wim. I guess I just needed to be patient and wait a few minutes for the Read Key to update. It’s working now.

Bill