Author Topic: wxstatus.php  (Read 9855 times)

0 Members and 1 Guest are viewing this topic.

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
wxstatus.php
« on: April 03, 2012, 09:13:44 PM »
How do you add more items on the wxstatus.php page?




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #1 on: April 03, 2012, 10:59:52 PM »
Sample instructions are in the comments area on the wxstatus.php page itself
Code: [Select]
############################################################################
#
# Add your custom checks below using the commented examples
#
# the do_check function has four arguments:
#   do_check($text,$target,$maxtime,$checktype);
#
# where:
#   $text is the text to display on the page.. always a good idea to run it
#        through langtransstr($text) for multilanguage support
#   $target is the item to be checked .. type of item is determined by $checktype
#
#     $target = relative file location/name if $checktype = 'file'
#     $target = unix timestamp (like from time() ) if $checktyp = 'application'
#
#   $maxtime is number of SECONDS expected between updates .. always allow a cushion
#        (extra time) to allow for delays in updates via FTP
#
#   $checktype defaults to 'file' type, use 'application' for timestamp checking from
#         applications.
#
#
############################################################################

/*
// example check for 'file' update time
        $tDir = './';
if(file_exists($tDir.'somefile.ext')) {
           do_check(langtransstr("Some File"),$tDir.'somefile.ext',10*60+15,'file');

        }

// example check for 'application' update time (this WXSIM check is already in wxstatus.php)

if(isset($SITE['WXSIM']) and file_exists('plaintext.txt')) {
       $doPrint = false;
   include_once($SITE['WXSIMscript']);
   print "<!-- wdate='$wdate' -->\n";
   $lastWXSIM = strtotime($wdate);
   // note: '6*60*60 + 2*60' is 6:02:00 hms
           do_check(langtransstr("WXSIM forecast"),$lastWXSIM,6*60*60 + 2*60,'application');

        }

*/
############################################################################
# start of custom checks (put your custom checks below)



# end of custom checks
############################################################################
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: wxstatus.php
« Reply #2 on: April 03, 2012, 11:52:13 PM »
I'm stumped Ken.
Here is what I have...http://www.hayskansasweather.com/wxstatus.php




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline Albuquerque Weather

  • Senior Contributor
  • ****
  • Posts: 265
    • Albuquerque Amateur Weather
Re: wxstatus.php
« Reply #3 on: August 05, 2012, 10:32:53 PM »
I have a similar problem.

I can't figure why NOAA Reports wont display in wxstatus.php
even tho the NOAA Reports page updates.

Ron

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #4 on: August 05, 2012, 11:09:13 PM »
I have a similar problem.

I can't figure why NOAA Reports wont display in wxstatus.php
even tho the NOAA Reports page updates.

Ron

Hi Ron,
Your version of include-wxstatus.php is V1.04, but it has a bit of strange code in it
Code: [Select]
  if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['Reports'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['Reports'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

That should read as
Code: [Select]
  if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

Try doing that update, and the timing on the monthly report should display.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #5 on: August 05, 2012, 11:11:55 PM »
I'm stumped Ken.
Here is what I have...http://www.hayskansasweather.com/wxstatus.php

That's the default display for a Base-USA, WD-plugin template set.  What is it you wanted to add for checking?

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: wxstatus.php
« Reply #6 on: August 05, 2012, 11:37:20 PM »
I'm stumped Ken.
Here is what I have...http://www.hayskansasweather.com/wxstatus.php

That's the default display for a Base-USA, WD-plugin template set.  What is it you wanted to add for checking?

Best regards,
Ken

Cam status.




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #7 on: August 06, 2012, 12:35:10 AM »
So what file do you check for your webcam to see if it's current?  Specific filename please.. and how often do you update the webcam image you want to check for?
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: wxstatus.php
« Reply #8 on: August 06, 2012, 02:43:31 AM »
So what file do you check for your webcam to see if it's current?  Specific filename please.. and how often do you update the webcam image you want to check for?

It's the time stamp image on my home page. The middle image of the 3 at the top of the page.  It's ok Ken it's no biggie.




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #9 on: August 06, 2012, 08:39:19 AM »
So what file do you check for your webcam to see if it's current?  Specific filename please.. and how often do you update the webcam image you want to check for?

It's the time stamp image on my home page. The middle image of the 3 at the top of the page.  It's ok Ken it's no biggie.

So try
Code: [Select]
############################################################################
# start of custom checks (put your custom checks below)


        $tDir = './';
if(file_exists($tDir.'somefile.ext')) {
           do_check(langtransstr("Webcam image file"),$tDir.'jpgwebcam.jpg',10*60+15,'file');

        }


# end of custom checks
############################################################################
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Albuquerque Weather

  • Senior Contributor
  • ****
  • Posts: 265
    • Albuquerque Amateur Weather
Re: wxstatus.php
« Reply #10 on: August 06, 2012, 08:45:16 AM »
Thanks for the reply Ken,
I replaced that code - Should it show as NOT CURRENT or not display 'til after midnight when update is done.
I got the updated version from your site just now and replaced the whole include file.

Ron


I have a similar problem.

I can't figure why NOAA Reports wont display in wxstatus.php
even tho the NOAA Reports page updates.

Ron

Hi Ron,
Your version of include-wxstatus.php is V1.04, but it has a bit of strange code in it
Code: [Select]
 if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['Reports'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
 $SITE['Reports'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

That should read as
Code: [Select]
 if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
 $SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

Try doing that update, and the timing on the monthly report should display.

Best regards,
Ken
« Last Edit: August 06, 2012, 09:10:56 AM by Albuquerque Weather »

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: wxstatus.php
« Reply #11 on: August 06, 2012, 07:45:02 PM »




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #12 on: August 06, 2012, 07:48:44 PM »
Excellent!

I could say that leaving in the 'somefile.ext' instead of replacing it with 'jpgwebcam.jpg' would be a learning experience, but I confess, it was just a 'finger check' as often happens when code is crafted on-the-fly without actually trying it out.

But.. I think you found that issue, fixed it, and now it works (and a bit of PHP learning on the side is always appropriate) :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: wxstatus.php
« Reply #13 on: August 06, 2012, 07:53:16 PM »
Pretty slick there Ken. Thanks for helping me AGAIN! \:D/




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline Albuquerque Weather

  • Senior Contributor
  • ****
  • Posts: 265
    • Albuquerque Amateur Weather
Re: wxstatus.php
« Reply #14 on: August 07, 2012, 08:35:00 AM »
Yhanks again Ken,
Checked my status this am and still no NOAA Reort listed in Status.

These are in Reports folder -
NOAAYR2012.txt
NOAAMO0812.txt

Do I need to do anything else?


Thanks for the reply Ken,
I replaced that code - Should it show as NOT CURRENT or not display 'til after midnight when update is done.
I got the updated version from your site just now and replaced the whole include file.

Ron


I have a similar problem.

I can't figure why NOAA Reports wont display in wxstatus.php
even tho the NOAA Reports page updates.

Ron

Hi Ron,
Your version of include-wxstatus.php is V1.04, but it has a bit of strange code in it
Code: [Select]
 if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['Reports'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
 $SITE['Reports'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

That should read as
Code: [Select]
 if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
 $SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }

Try doing that update, and the timing on the monthly report should display.

Best regards,
Ken

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #15 on: August 07, 2012, 11:36:51 AM »
Hi Ron,

Here's the code in include-wxstatus.php that checks for the NOAA report:
Code: [Select]
  // checks for optional NOAA-style report updates
  if($SITE['WXsoftware'] == 'CU' and isset($WX['LatestNOAAMonthlyReport']) and
file_exists($SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'])) {
do_check($SITE['WXsoftwareLongName']." ".langtransstr("NOAA report"),
  $SITE['NOAAdir'].$WX['LatestNOAAMonthlyReport'],24*60*60+10*60,'file');
  }
Looking at your CUtags.php shows that the entry for $WX['LatestNOAAMonthlyReport'] is not present.. You're using the CUtags template from 2011-08-30 03:08:09 GMT .. you may need to update it to the current one (generated 2012-01-22 21:01:59 GMT) which has the missing tag in it.  Download the CU-plugin.zip and use the new CUtags and the problem should be resolved.

BTW.. that framed-approach to your http://www.albuquerqueweather.info/ site (frame loading http://cherokiwi.com/cumulus/ pages) makes it very messy to navigate to the pages to do diagnostics .. all this 'open frame in new tab' to see what's really there. :(

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Albuquerque Weather

  • Senior Contributor
  • ****
  • Posts: 265
    • Albuquerque Amateur Weather
Re: wxstatus.php
« Reply #16 on: August 07, 2012, 09:31:45 PM »
Thanks Ken
That fixed it.
The frame loading you mention should resolve when I renew at godaddy.


Ron

Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: wxstatus.php
« Reply #17 on: September 02, 2012, 04:24:35 PM »
Hi there,

Is there any way I can get this to work for an external image as my webcam image is linked up to my Weather Underground image?

Thanks

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #18 on: September 02, 2012, 04:34:01 PM »
As distributed, the functions you can add on wxstatus.php page all work with files in the filesystem on your website, not with external files on another website.  If you can find/specify the image file you're uploading to WU, you could check that file for 'current' .. see the comments/instructions in the wxstatus.php page on how to check a file.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: wxstatus.php
« Reply #19 on: September 02, 2012, 04:40:05 PM »
Hi Ken,

Where do I find those instructions?

Thanks

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #20 on: September 02, 2012, 04:53:48 PM »
Right in the middle of the wxstatus.php page
Code: [Select]
############################################################################
#
# Add your custom checks below using the commented examples
#
# the do_check function has four arguments:
#   do_check($text,$target,$maxtime,$checktype);
#
# where:
#   $text is the text to display on the page.. always a good idea to run it
#        through langtransstr($text) for multilanguage support
#   $target is the item to be checked .. type of item is determined by $checktype
#
#     $target = relative file location/name if $checktype = 'file'
#     $target = unix timestamp (like from time() ) if $checktyp = 'application'
#
#   $maxtime is number of SECONDS expected between updates .. always allow a cushion
#        (extra time) to allow for delays in updates via FTP
#
#   $checktype defaults to 'file' type, use 'application' for timestamp checking from
#         applications.
#
#
############################################################################

/*
// example check for 'file' update time
        $tDir = './';
if(file_exists($tDir.'somefile.ext')) {
           do_check(langtransstr("Some File"),$tDir.'somefile.ext',10*60+15,'file');

        }

// example check for 'application' update time (this WXSIM check is already in wxstatus.php)

if(isset($SITE['WXSIM']) and file_exists('plaintext.txt')) {
       $doPrint = false;
   include_once($SITE['WXSIMscript']);
   print "<!-- wdate='$wdate' -->\n";
   $lastWXSIM = strtotime($wdate);
   // note: '6*60*60 + 2*60' is 6:02:00 hms
           do_check(langtransstr("WXSIM forecast"),$lastWXSIM,6*60*60 + 2*60,'application');

        }

*/
############################################################################
# start of custom checks (put your custom checks below)



# end of custom checks
############################################################################
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: wxstatus.php
« Reply #21 on: September 03, 2012, 03:23:30 AM »
Hi Ken,

Again, sorry but my brain is blown again! I have put the coding as it says and put the file url that comes from weather underground where $tDir is and where 'somefile.ext' is.

Thanks

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #22 on: September 03, 2012, 12:13:01 PM »
Hi Will,

In order to help diagnose the problem, you should post what you've put on the page between the
Code: [Select]
############################################################################
# start of custom checks (put your custom checks below)



# end of custom checks
############################################################################

section.

Based on the wording of your response
Quote
I have put the coding as it says and put the file url that comes from weather underground where $tDir is and where 'somefile.ext' is.
I think you may have a misconception about what can be checked with the wxstatus.php script.

You can check any LOCAL file in your website by relative path and filename like:
  ./realtime.txt
  ./some/other/directory/filename.jpg

You can't check any REMOTE file (a file not on your website), or any file that would cause
you to specify 'http://....'

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: wxstatus.php
« Reply #23 on: September 03, 2012, 12:34:25 PM »
Hi Ken,

Sorry, here is what I put.

Code: [Select]
*/
############################################################################
# start of custom checks (put your custom checks below)
 $tDir = './';
if(file_exists($tDir.'http://icons.wunderground.com/webcamramdisk/w/i/williamwilbur/1/')) {
           do_check(langtransstr("Webcam Image"),$tDir.'current.jpg?1346270456',10*60+15,'file');

        }


# end of custom checks
############################################################################
?>

Thanks

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: wxstatus.php
« Reply #24 on: September 03, 2012, 12:38:28 PM »
Yep, that's the (uncustomized) sample code I'd included on the wxstatus.php page as an example.

Based on your prior discussion about checking for a webcam upload, and seeing that your home page has a webcam image, I took a look at where that image is being hosted and found that it is actually at
http://icons.wunderground.com/webcamramdisk/w/i/williamwilbur/1/current.jpg

Since that image is NOT HOSTED on your site, you can't use the wxstatus.php page to check it for currency. (That's what I meant by the local v.s. remote discussion above).  If the current.jpg file is also somewhere on your website locally, then you can use the wxstatus.php to check it.. if not, then no check is feasible.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything