Meteohub plugin for Saratoga AJAX/PHP templates

Moderator: Mattk

JohnR
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: Fri Dec 23, 2011 11:01 pm

Re: Meteohub plugin for Saratoga AJAX/PHP templates

Post by JohnR »

Following up my own post, after a lot of digging round the files, I managed to get yesterday's rain figure showing correctly by changing the following in MH-defs.php

$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',1,$uomrain); mh-defs.php

to

$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',0,$uomrain); mh-defs.php

I don't know if this is the correct way but it seems to work.

All this leaves now is the Rain History in MH-trends-inc.php, where:

"Today days since last rain on" has no value showing at all.
"Week 0.0 mm over last 7 days" is not correct (should be 9.00mm) unless it means week so far, not last seven days.
"Month 9.00 mm last month" is correct.

[edit]

A couple of other rain oddities I'm getting on the MH-trends-inc.php page -

1.
RAIN
Today 0.30 mm (0.3 mm last hour)


The 0.30 mm for today is correct but it was several hours ago, not in the last hour.

2.
The Current figures at the top of the page has 0.3mm of rain but this should be zero unless Current means total for the day.

Everything else bar the rainfall issues seems to be working fine - very pleased!

John

[further edit]

Tracked down one of these (I think):

In MH-trends-inc.php, we have:

<td><?php echo langtrans('Today'); ?></td>
<td><?php echo unUnit($dayrn) . $uomRain; ?>
(<?php echo unUnit($hourrn) . $uomRain; ?> <?php langtrans('last hour'); ?>) </td>
<td><?php echo langtrans('Today'); ?></td>

In MH-defs.php

$dayrn is: $dayrn = $WX['day1_rain0_total_mm'];

which is 0.3mm in MHtags.php and displays as the day's rainfall, which is correct

but

$hourrn is: $hourrn = $WX['day1_rain0_total_mm']-$WX['last60m_rain0_total_mm'];

which is 0.3mm and 0mm respectively in MHtags.php, so last hour is displayed as 0.3mm when it is in fact 0mm.

I changed $hourrn to: $hourrn = $WX['last60m_rain0_total_mm']; which seems to have fixed it.

The current rain figure at the top of the page is in MH-trends-inc.php as $rain0minuteago, which in MH-defs.php is $WX['day1_rain0_total_mm'], so it is the total for the day. Is this the way it should be shown?

Just Today and Week in Rain History to sort out! (removed for time being).

[yet another edit]

In the Trends (MH-trends-inc.php) Yesterday max gust speed was not showing the correct value. It is using $maxgustyest. In MH-defs.php:

$maxgustyest = $WX['yday_wind0_gustspeed_mph'];

but I think it should be

$maxgustyest = $WX['yday_wind0_gustspeedmax_mph'];

In my case, this gives the correct value.

John
User avatar
saratogaWX
Junior Boarder
Junior Boarder
Posts: 36
Joined: Tue Jun 14, 2011 2:39 am
Location: Saratoga, CA, USA
Contact:

Re: Meteohub plugin for Saratoga AJAX/PHP templates

Post by saratogaWX »

Just a heads-up to all the World template users: WeatherUnderground changed their website on 1-Feb-2012 and now disallow non-browser access to their main pages, and this has caused the WU-forecast.php script to become inoperative, and really not fixable. I'm redesigning the WU-forecast.php script (V2) to use their new JSON API instead, and I hope to have a release in the next couple of days. Meanwhile, your dashboard and wxforecast.php pages will be missing the icons and text for your forecasts.

Sorry for the inconvenience.

Best regards,
Ken

p.s. I'll be releasing the update to the MH-defs.php that John and I worked out in the near future.. Thanks for all your work on getting the rain trends to display correctly, John!
Free Weather website PHP templates and scripts at Saratoga-Weather.org
User avatar
saratogaWX
Junior Boarder
Junior Boarder
Posts: 36
Joined: Tue Jun 14, 2011 2:39 am
Location: Saratoga, CA, USA
Contact:

Re: Meteohub plugin for Saratoga AJAX/PHP templates

Post by saratogaWX »

Status update:

I talked via email with John Celenza of WeatherUnderground and the issue with the WU-forecast.php script was caused by an IP block by WunderGround on my server's IP address. They have kindly removed the block, and the script works again.

I did do an update to WU-forecast.php V1.28 tonight to add the ability to follow the 301 redirect to their block.asp page, and cache the contents in the cache file. If it happens that you find no forecast, even after doing a ?force=1 to force a cache refresh, then check the contents of your cache file (do a view source on the page to find the name/location of the file), and in the file will be the text of the block page .. you can use the IP address there to contact WU to ask the block be removed.

I also changed the request to include a User-agent: PHP,WU-forecast.php,saratoga-weather.org so they can identify that the request was made by the WU-forecast.php script (and that they should contact me for questions).

Sorry for the alarm .. in short:
1) WU was blocking some IPs for excessive traffic (I think)
2) The script couldn't get past the block, so stopped offering you a forecast.
3) the updated script V1.28 has diagnostics to help you put a request to WU to unblock if it happens to you

Updates for V3 template users or for non-template users.

I am working (and about 80% finished) with a WU API JSON script and will release it later, but the WU-forecast.php can live on to serve :)

Best regards,
Ken
Free Weather website PHP templates and scripts at Saratoga-Weather.org
User avatar
saratogaWX
Junior Boarder
Junior Boarder
Posts: 36
Joined: Tue Jun 14, 2011 2:39 am
Location: Saratoga, CA, USA
Contact:

Re: Meteohub plugin for Saratoga AJAX/PHP templates

Post by saratogaWX »

I've updated the MH-plugin.zip to have two fixes:

1) the MH-defs.php V1.04 to fix baro for sea-level display, and
2) the MH-trends-inc.php V1.07 for rain in trends page, and for Notice: errata and one short PHP tag;

Updates available (18-Feb-2012) at the updates page.

My thanks to John at http://rainer.me.uk/weather/ for his work in diagnosing the issues with the trends rain total displays!

Best regards,
Ken
Free Weather website PHP templates and scripts at Saratoga-Weather.org
Post Reply