Author Topic: WU-History now works with WU/TMC API...  (Read 8424 times)

0 Members and 1 Guest are viewing this topic.

Offline BCJKiwi

  • Senior Contributor
  • ****
  • Posts: 295
    • Silver Acorn Weather - N.Z.
Re: WU-History now works with WU/TMC API...
« Reply #25 on: May 28, 2019, 09:32:46 PM »
Mea Culpa
WXDailyHistory.php was not copied to the public server - it is there now.

WXDailyHistory.php was in place on the local server and issues are the same for both local and public servers.

Thanks
« Last Edit: May 29, 2019, 01:57:23 AM by BCJKiwi »

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1526
    • Texas Weather
Re: WU-History now works with WU/TMC API...
« Reply #26 on: May 28, 2019, 10:33:32 PM »
Did you did the first run?
From Ken's github:

Quote

At initial installation
Because WXDailyHistory.php relies on cached JSON data, it's a good idea to preload you cache with historical data manually for all years you have submitted PWS data to WeatherUnderground. The easiest way to do this is via direct URL requests to your website like:

view-source:https://your.website.com/WXDailyHistory.php?&year=2019&graphspan=year&debug=y

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline zeppline

  • Member
  • *
  • Posts: 19
    • Las Vegas Weather Guy
Re: WU-History now works with WU/TMC API...
« Reply #27 on: May 28, 2019, 11:14:09 PM »
yes downloaded from github. I did not load history. I also changed WU info in settings.php my files upload every 5min.

Rainwise MKlll w/ cc3000 logger Win10

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #28 on: May 29, 2019, 01:48:06 AM »
You appear to be running on PHP Version: 5.4.19 which is quite old.. any chance of updating to 5.6 or 7.3?

The image shows you aren't trying to run my script (WXDailyHistory.php) on your site, but you're still configured to use the WU WXdailyHistory.asp page call, and that won't work anymore.

From the distribution, take a look at my WU-History-inc.php and make corresponding changes to your WUG-inc-day.php script.

Hi Ken,
Is the same with my WUG
I dont understand what exactly to do. Sorry
https://www.wetterstation-johanngeorgenstadt.de/wxwugraphs.php
Stefan

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #29 on: May 29, 2019, 09:26:47 AM »
Ken do we have to put this on a cron?

WXDailyHistory.php?&year=2019&graphspan=year&debug=y

I have pulled the data and I was able to see it but now is no longer displaying.

Sorry... the WU data for this date is not currently available. Please try again later.
No, no cron needed.. when you do the manual pull for a year's data, it get's cached and won't be repulled.  Only the current month's data is fetched (and cached) since it is the only data that changes.  Run the year pulls once for all prior years and you're done.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #30 on: May 29, 2019, 09:31:59 AM »
BTW..  like Wim, I'm currently away from home (visiting daughter's family in Illinois), so working from the iPad greatly limits my diagnostic capability. 

For this script set, make sure that WXDailyHistory.php and WU-History-inc.php are in the same directory, and you have configured (either in WXDailyHistory.php or Settings.php) the WCAPIkey and WUID.  You should be able to see CSV data if you load WXDailyHistory.php in your browser.  If you don't see data, run it with ?debug=y on the URL and the HTTPS fetch info will be shown at the bottom of the page to help you debug.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #31 on: May 29, 2019, 10:47:55 AM »
Like a few others..I'm now having issues displaying data using this script.  I also get "Sorry... the WU data for this date is not currently available. Please try again later." message.  However I pretty sure I see files in the ./cache directory.

Link: https://www.hburg-wx.net/wxwuhistory.php

All help appreciated!
steve
I think the issue is with your $SITE['WCAPIkey'] in Settings.php -- It ends in a space, and looks like the old $SITE['WUAPIkey'] entry for the defunct WU-forecast.php script.  Are you using a NEW API key from WeatherUnderground?  If not, acquire a new key and place it in the $SITE['WCAPIkey'] entry in Settings.php to get the WXDailyHistory.php to work.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #32 on: May 29, 2019, 11:59:45 AM »
I have set all correctly as described and it works for many hours.
Now show: Sorry... the WU data for this date is not currently available. Please try again later.
Whe i run : view-source:https://www.wetterstation-johanngeorgenstadt.de/WXDailyHistory.php?&year=2019&debug=y
shows:
<!-- curl fetching 'https://api.weather.com/v2/pws/history/all?stationId=ISACHSEN67&format=json&units=m&date=20190529&apiKey=xxxxxxxxxxxxx' -->
<!-- HTTP stats:  RC=401 dest=104.74.132.80 port=443 (from sce=85.93.89.247)
      Times: dns=0.000 conn=0.004 pxfer=0.019 get=0.037 total=0.056 secs -->
<!-- headers returned:
HTTP/1.1 401 Unauthorized
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 300
Expires: Wed, 29 May 2019 15:51:26 GMT
Date: Wed, 29 May 2019 15:51:26 GMT
Connection: keep-alive
 -->
How can i get to work this new Script longer as 3-4 hours?
Wxwugraphs also not work with daily ,monthly and yearly Data

https://www.wetterstation-johanngeorgenstadt.de/wxwugraphs.php

Stefan

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #33 on: May 29, 2019, 12:29:00 PM »
Stefan, your WXDailyHistory.php is getting a HTTP/1.1 401 Unauthorized from the query to the WU/TWC API .. that indicates you likely have an incorrect API key

See: https://docs.google.com/document/d/13HTLgJDpsb39deFzk_YCQ5GoGoZCO_cRYzIxbwvgJLI/edit for a list of response codes.

Check your WCAPIkey value.. it has to be a NEW wunderground api key.. not an old key.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #34 on: May 29, 2019, 12:50:11 PM »
Hi
I think i must create a new but in wunderground there no option for new api
Status
Paid Membership Expiration:
3/15/2020 Signed Up:
5/20/2017
« Last Edit: May 29, 2019, 12:51:56 PM by Stegrie »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #35 on: May 29, 2019, 12:53:30 PM »
Use your browser to open https://www.wunderground.com/member/api-keys

If you are not logged in, you will be asked to. The system will also verify that you have a PWS uploading to the system.

You will then see a blank box below “Your API keys”.
Agree to the new Terms and Conditions by clicking in the small box next to “I agree”, click on the blue “GENERATE” box, and your new key will be created.

The key will be masked on the screen, but you can use the “Show” link below the box to see it.
There is also another blue box, which, when clicked, copies the key to your clipboard.

Save that key in the $WCAPIkey in the script for standalone use, or if using a Saratoga template, save in Settings.php in a $SITE['WCAPIkey'] setting.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #36 on: May 29, 2019, 12:59:36 PM »
see i have this key ad set these

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #37 on: May 29, 2019, 01:19:18 PM »
In your Settings.php you have
Code: [Select]
$SITE['WCAPIkey'] = ''; That is where you should put the API key you showed above in the setting.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #38 on: May 29, 2019, 01:38:43 PM »
have set, ](*,) still no luck

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #39 on: May 29, 2019, 01:42:06 PM »
The key itself is bad (results in a 401 Unauthorized return).  You should try to get a new key to replace that one.. it won't work otherwise.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #40 on: May 29, 2019, 01:46:20 PM »
in wunderground there no option to get new key, sorry i found nothing to do this
must i delete my device for a new?
so lost all my data
« Last Edit: May 29, 2019, 01:49:07 PM by Stegrie »

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2303
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #41 on: May 29, 2019, 02:00:09 PM »
I'm having the same problem as Stegrie:
Code: [Select]
<!-- curl fetching 'https://api.weather.com/v2/pws/history/all?stationId=KNELINC05&format=json&units=e&date=20190529&apiKey=32 characters' -->
<!-- HTTP stats:  RC=204 dest=23.64.4.191 port=443 (from sce=192.168.2.169)
      Times: dns=0.004 conn=0.023 pxfer=0.077 get=0.058 total=0.136 secs -->
<!-- headers returned:
HTTP/1.1 204 No Content
Content-Length: 0
Content-Type: application/json; charset=UTF-8
Set-Cookie: AK-STATUS=204; expires=Wed, 22-Aug-2001 17:30:00 GMT
Access-Control-Allow-Origin: *
X-Trace-Token: 70e61471-78d5-4d7e-a614-7178d57d7eb4
X-Region: us-east-1
Surrogate-Control: ESI/1.0
Expires: Wed, 29 May 2019 17:57:57 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Wed, 29 May 2019 17:57:57 GMT
Connection: keep-alive
 -->
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #42 on: May 29, 2019, 02:01:12 PM »
No, don't delete your WUID -- send a note to Victoria.Gardner@ibm.com with your WUID and current API key and ask for her to get the key working for the WU/TWC API.  Say it is currently getting a 401-Unauthorized response.

Same suggestion for you too Gerry..
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stegrie

  • Senior Member
  • **
  • Posts: 97
    • Wetterstation Johanngeorgenstadt
Re: WU-History now works with WU/TMC API...
« Reply #43 on: May 29, 2019, 02:05:53 PM »
Thanks Ken, have done this yet...  [tup]

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2303
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #44 on: May 29, 2019, 02:12:08 PM »
Thanks Ken, have done this yet...  [tup]
Likewise, Ken. [tup]
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Re: WU-History now works with WU/TMC API...
« Reply #45 on: May 29, 2019, 03:30:20 PM »

I think the issue is with your $SITE['WCAPIkey'] in Settings.php -- It ends in a space, and looks like the old $SITE['WUAPIkey'] entry for the defunct WU-forecast.php script.  Are you using a NEW API key from WeatherUnderground?  If not, acquire a new key and place it in the $SITE['WCAPIkey'] entry in Settings.php to get the WXDailyHistory.php to work.
[/quote]

I think I have cleared up the WCAPIKey issue.  Navigate to: view-source:https://www.hburg-wx.net/WXDailyHistory.php?&year=2019&debug=y, this is what I get now.

<!-- curl fetching 'https://api.weather.com/v2/pws/history/all?stationId=KVAHARRI7&format=json&units=E&date=20190529&apiKey=xxxxxxxxxxxxxxxx' -->
<!-- HTTP stats:  RC=400 dest=104.90.85.30 port=443 (from sce=144.217.72.101)
      Times: dns=0.000 conn=0.013 pxfer=0.046 get=0.049 total=0.095 secs -->
<!-- headers returned:
HTTP/2 400
access-control-allow-origin: *
content-language: en-US
content-type: application/json; charset=UTF-8
x-region: us-east-1
x-trace-token: 6665ba73-aebc-42bf-a5ba-73aebc42bf2f
content-length: 188
expires: Wed, 29 May 2019 19:24:43 GMT
cache-control: max-age=0, no-cache, no-store
pragma: no-cache
date: Wed, 29 May 2019 19:24:43 GMT
 -->

And I still see: "Sorry... the WU data for this date is not currently available. Please try again later."  when I try to view the results.

Offline dasman

  • Forecaster
  • *****
  • Posts: 474
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #46 on: May 29, 2019, 03:38:50 PM »
I've had the new script and New API up and running for a few days. Then today I started seeing the same as you guys  "Sorry... the WU data for this date is not currently available. Please try again later."
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7906
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #47 on: May 29, 2019, 03:41:19 PM »
You're seeing a 400 return code.. from the docs that means
Quote
400
Bad request. The request could not be understood by the server due to malformed syntax or there is no data found for the location requested.
  I think it is caused by having $WCunits  = 'E'; instead of 'e' (lowercase).

And I've been having timeout-issues (6 seconds) to api.weather.com too.. it results in a 'no data' display.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline baedkesj

  • Member
  • *
  • Posts: 11
    • Harrisonburg, VA Weather
Re: WU-History now works with WU/TMC API...
« Reply #48 on: May 29, 2019, 03:58:18 PM »
You're seeing a 400 return code.. from the docs that means
Quote
400
Bad request. The request could not be understood by the server due to malformed syntax or there is no data found for the location requested.
  I think it is caused by having $WCunits  = 'E'; instead of 'e' (lowercase).

And I've been having timeout-issues (6 seconds) to api.weather.com too.. it results in a 'no data' display.

Changing $WCunits to lowercase 'e' solved my issue!!

Thanks Ken  [tup]

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2303
    • SouthEast Lincoln, NE Weather
Re: WU-History now works with WU/TMC API...
« Reply #49 on: May 29, 2019, 04:12:42 PM »
Mine is working now as well.  I entered 'KNELINC05' instead of 'KNELINCO5' as my station ID. #-o  Unfortunately this isn't the first time I made that mistake.  My API was correct and working.

Thanks to Victoria for very kindly pointing this out. =D&gt;
Regards, Jerry Wilkins
gwwilk@gmail.com