Testing "paid API" for PurpleAir sensors

If a good soul is willing to test:
purple_api_nw.zip (49.4 KB)

  1. make backup of the three changed scripts

  2. upload tne updated easyweathersetup script to your website

  3. run in your browser PWS_easyweathersetup.php
    and
    add the PU api key in tab Devices → question “Purple Air sensor API key”

  4. After saving the settings with the green button, TEST the dashboard and all scripts should run fine

  5. upload the two other scripts.
    The age is now set to 800 seconds and the load file scripts does not has the API key in the code anymore.

  6. Test again.
    If problems occur replace the three updated scripts with the backup you made in step 1.


If all seems OK, I can generate the new full version and updates this week.

Wim

1 Like

Carried out steps 1-4 with no problems, so PWS_easyweathersetup.php seems to be OK.

I did not upload the other two scripts as mine are heavily modified, but I have already changed $purpleRefresh to 600 seconds in my PWS_settings.php. Then I deleted the API key from my PWS_load_files.php and everything seems to be working fine. :slightly_smiling_face:

1 Like

I’ve made all the changes, and everything seems to be working fine.
Tom

Made all the changes as above but ours seems to be not working

1 Like

Without a link to your website, there is not much I can see or check. Therefor these questions:

What is the contents of the . . pwsWd/jsondata/purpleair.txt file?

Did you request a newPurpleAir API key?
and then → Made the project, point points into the project? and so on.
See attached screenshot.

Thanks,
Wim

Hi website is favershamweather.org
We got a API from Purple Air

But you seem to have got a WRITE key instead of a READ key:

File purpleair.txt says “The provided api_key was of the wrong type (WRITE).”

Changed it to Read now it tells me payment is needed to make this call

OK. When you get a key you get a Project, usually your name and a number.

You also get 1,000,000 free points awarded to your Organization, usually your name.

You have to allocate some or all of these points to your Project to read the API.

(Some of us have more than one Project to share the points among.)

Hi,
I’ve made all the changes, and everything seems to be working fine.
Kind Regards,
Tony

Hi Wim,
uploaded the 3 scripts and put my Purple Air key in the setup (didn’t apply for a new key). Seems to work.
Question : has the timeout to be corrected somewhere ? It still says max 2 mins.

./jsondata/purpleair.txt 	  aq-purpleair   	  Stalled   	12 mins 8 seconds
max = 2 mins 	https://api.purpleair.com/v1/s . . .

Thank you for the programs.

1 Like

I think it will come right if you delete …/pwsWD/_my _settings/status.arr and let it rebuild:

As @bitsostring mentions, the status.arr contains previous values to be checked.
Delete the file and it will be rebuild from the latest settings.

Thank you for the suggestion, after a rebuild of the status.arr file it is ok.

Seems to work here.

Guy

It’s working here :slight_smile:
https://home.kabrock.com:8080/weather/index.php?theme=user&lang=en-uk&units=us

12 posts were split to a new topic: wl.comV2-api problems