Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Station Status question

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Station Status question

Postby aznetcowboy » Wed Jul 16, 2014 5:22 pm

The normal station status readings are:
Component Status
Age h:m:s Latest update time as of 07/16/2014 10:13am

Cumulus realtime Current 0:00:05 07/16/2014 10:12am

Cumulus FTP Current 0:02:50 07/16/2014 10:10am

Cumulus weather data Current 0:03:02 07/16/2014 10:10am

Is there a way to add another update status readings to it? An example is my Fire Weather Index (FWI Calc) status.
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

User avatar
saratogaWX
Posts: 849
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Station Status question

Postby saratogaWX » Thu Jul 17, 2014 1:55 pm

Easy to add. See the code in comments inside wxstatus.php

Code: Select all

<?php
############################################################################
#
# 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
############################################################################
?>

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Re: Station Status question

Postby aznetcowboy » Fri Jul 18, 2014 7:09 pm

Me thinks I am missing the obvious. I am getting nothing. What I am looking for is the find out when/if the file "fwiweb.xml" was uploaded to the root of my domain. I made some guesses as to what the code should have been, but I am no where near close to getting this correct. :cry:

As of right now, the result I am getting is:
Fire Weather Index Data NOT Current 390479:53:22 > 6:00:00

The code I have is:
$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',6*60*60,'fwiweb.xml');
}

The file timestamp is 3:021:02. The time calculation (6*60*60) is confusing. I assume it is where the > 6:00:00 is coming from. I am at least getting something right now, but not what is correct.
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

User avatar
beteljuice
Posts: 2457
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Station Status question

Postby beteljuice » Sat Jul 19, 2014 12:08 am

Code: Select all

        6*60*60 // 6 HOURS

/* I assume you want 6 minutes (and a 'buffer') 6*60+15
    multiplication takes precedence so same as (6*60) +15
*/

Image
......................Imagine, what you will KNOW tomorrow !

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Re: Station Status question

Postby aznetcowboy » Sat Jul 19, 2014 2:28 am

beteljuice wrote:

Code: Select all

        6*60*60 // 6 HOURS

/* I assume you want 6 minutes (and a 'buffer') 6*60+15
    multiplication takes precedence so same as (6*60) +15
*/


I have modified the timing so that the file gets uploaded every 30 minutes, need it or not. The status code is now:
$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',30*60+15,'fwiweb.xml');
}

The results are: Fire Weather Index Data NOT Current 390482:19:36 > 0:30:15


The last update to the fwi file was 20 minutes ago. BTW, what is the "390482:19:36:\" and the "> 0:30:15"?
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

User avatar
saratogaWX
Posts: 849
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Station Status question

Postby saratogaWX » Sat Jul 19, 2014 3:00 am

Looking at the view-source of your wxstatus.php page shows
<h1>Weather Station Status</h1>
<p> <br/><br/>
Station system up for <b>16 hours 14 minutes</b><br/>
Station system free memory <b>2289/4094 MB (free/total)</b><br/>
This website uses <b>Cumulus
(1.9.4-b1096)</b> for weather conditions reporting.<br/>
It was last started <b>1 hour 56 minutes</b>.<br/></p>

<table width="620" border="0" cellspacing="6" cellpadding="3" style="border-collapse:collapse">
<tr>
<th style="width: 40%" scope="col">Component</th>
<th style="width: 15%" scope="col" align="center">Status</th>
<th style="width: 10%" scope="col" align="right">Age<br />h:m:s</th>
<th style="width: 35%" scope="col" align="right">Latest update time as of<br/> 07/18/2014 7:53pm</th>
</tr>

<!-- include-wxstatus.php - V1.05 - 06-Mar-2013 -->
<!-- ./realtime.txt age = 6 secs. 0:00:06 -->
<tr>
<td>Cumulus realtime</td>
<td align="center"><span style="color: green"><b>Current</b></span></td>
<td align="right">0:00:06</td>
<td align="right">07/18/2014 7:53pm </td>
</tr>
<!-- CUtags.php age = 217 secs. 0:03:37 -->
<tr>
<td>Cumulus FTP</td>
<td align="center"><span style="color: green"><b>Current</b></span></td>
<td align="right">0:03:37</td>
<td align="right">07/18/2014 7:50pm </td>
</tr>
<!-- CUtags.php internal update date time='7/18/2014 19:50' fixed='2014-07-18 19:50' -->
<!-- age = 229 secs. 0:03:49 -->
<tr>
<td>Cumulus weather data</td>
<td align="center"><span style="color: green"><b>Current</b></span></td>
<td align="right">0:03:49</td>
<td align="right">07/18/2014 7:50pm </td>
</tr>
<!-- GR3='/home/elghek00/domains/elgheko.us/public_html/GR3/KDMA_cr_0.jpg' -->
<!-- end include-wxstatus.php -->
<!-- age = 1405738429 secs. 390482:53:49 -->

<tr>
<td>Fire Weather Index Data</td>
<td align="center"><span style="color: red"><b>NOT Current</b></span></td>
<td align="right">390482:53:49</td>
<td align="right"> > 0:30:15 <br/><b></b></td>
</tr>

</table>

so the display is not 'Fire Weather Index Data' but the GRLevel3 Radar image data check, and
/GR3/KDMA_cr_0.jpg doesn't exist on your site.

Zip and attach your wxstatus.php page (or rename it to .txt and attach it here). I think your code shown in the above post is in a extended PHP comment (and is therefore not executed).

Best regards,
Ken

User avatar
beteljuice
Posts: 2457
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Station Status question

Postby beteljuice » Sat Jul 19, 2014 3:08 am

It should be in the form of - Age h:m:s Latest update time as of 07/16/2014 10:13am

but there is definately something odd going on.

What is the time/datestamp of your ./fwicalc.xml file ?
Last edited by beteljuice on Sat Jul 19, 2014 3:47 am, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Re: Station Status question

Postby aznetcowboy » Sat Jul 19, 2014 3:18 am

Ken,

Here it (wxstatus.zip) is as requested.

Tom
You do not have the required permissions to view the files attached to this post.
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Re: Station Status question

Postby aznetcowboy » Sat Jul 19, 2014 3:21 am

beteljuice wrote:I [i]should[/] be in the form of - Age h:m:s Latest update time as of 07/16/2014 10:13am

but there is definately something odd going on.

What is the time/datestamp of your ./fwicalc.xml file ?

The current timestamp is 08:04:18 and my current time is 08:20:00. Hmmmm, this doesn't happen to operate on a 24 HR clock does it?
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

User avatar
saratogaWX
Posts: 849
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Station Status question

Postby saratogaWX » Sat Jul 19, 2014 3:25 am

That timestamp of 1405738429 is essentially 'now'.

I just looked at wxstatus you posted, and your mod IS in the correct place.

If you're not running GRLevel3 radar, please change your Settings.php code

Code: Select all

$SITE['GR3radar']    = 'KDMA';    // set to lower-case full name of NEXRAD radar site
$SITE['GR3DIR']        = '/GR3';     // set to directory for GRLevel3 images (or '.' for root directory
$SITE['GR3type']    = 'cr';        // radar image type 'cr','br','cr248','br1' etc.
$SITE['GR3img']        = 'jpg';    // GR3 image type 'jpg' or 'png'
$SITE['GR3cnt']        = 10;        // number of images in series 10=(_0 ... _9 in name of file)
$SITE['GR3width']    = 512;        // width of GR3 images
$SITE['GR3height']  = 512;        // height of GR3 images
$SITE['showradarstatus'] = true; // set to false to suppress 'active' message by radar-status.php
to

Code: Select all

/*
$SITE['GR3radar']    = 'KDMA';    // set to lower-case full name of NEXRAD radar site
$SITE['GR3DIR']        = '/GR3';     // set to directory for GRLevel3 images (or '.' for root directory
$SITE['GR3type']    = 'cr';        // radar image type 'cr','br','cr248','br1' etc.
$SITE['GR3img']        = 'jpg';    // GR3 image type 'jpg' or 'png'
$SITE['GR3cnt']        = 10;        // number of images in series 10=(_0 ... _9 in name of file)
$SITE['GR3width']    = 512;        // width of GR3 images
$SITE['GR3height']  = 512;        // height of GR3 images
$SITE['showradarstatus'] = true; // set to false to suppress 'active' message by radar-status.php
*/
so the check for GR3 data (which is failing) should stop interfering with the display.

Then change your code from

Code: Select all

$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',30*60+15,'fwiweb.xml');
}
to

Code: Select all

$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',30*60+15,'file');
}

The last argument must be either 'file' or 'application' as values.. it doesn't understand the 'fwiweb.xml' 4th argument literal string.



Best regards,
Ken

User avatar
aznetcowboy
Posts: 240
Joined: Fri Jan 04, 2013 6:03 pm
Weather Station: Davis 6153 Vantage Pro2
Operating System: Windows 10 Home 64-bit
Location: Tucson, AZ
Contact:

Re: Station Status question

Postby aznetcowboy » Sat Jul 19, 2014 3:55 am

saratogaWX wrote:<SNIP>

Then change your code from

Code: Select all

$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',30*60+15,'fwiweb.xml');
}
to

Code: Select all

$tDir = './';
if(file_exists($tDir.'fwiweb.xml')) {
do_check(langtransstr("Fire Weather Index Data"),$tDir.'fwiweb.xml',30*60+15,'file');
}

The last argument must be either 'file' or 'application' as values.. it doesn't understand the 'fwiweb.xml' 4th argument literal string.


Best regards,
Ken


Thank you Ken! I was wondering what that "file" meant. I blew that one, big time. Over the years I programmed in CA-Clipper and HTML, not PHP. :bash:

What has the GR3 got to do with it? That is one thing I've never been able to get working and I guess I forgot all about it over time. :groan:


Tom
Tom Wills
Kingston Knolls Terrace, Tucson, AZ

El Gheko Neighborhood Weather Station: http://www.elgheko.us
El Gheko Neighborhood Association: http://na.elgheko.us

Image

dazza1223
Posts: 209
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: Station Status question

Postby dazza1223 » Sun Jan 14, 2018 12:56 am

can i uses on my site cumulus mx or i need to use it with the template wxstatus.php???

User avatar
saratogaWX
Posts: 849
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Station Status question

Postby saratogaWX » Sun Jan 14, 2018 11:28 pm

The wxstatus.php (and include-wxstatus.php) do rely on having the Saratoga template installed for other parts that are used (Settings.php, Settings-weather.php, common.php).

The 'guts' of the page are handled in include-wxstatus.php -- you could replace all the $SITE['...'] variable calls with the appropriate data concerning your site, and use the basic code. A bit of a programming exercise, but doable, nonetheless.

dazza1223
Posts: 209
Joined: Sun Jan 25, 2015 8:41 pm
Weather Station: davis vantage vue
Operating System: raspberry pi 3
Location: worthing
Contact:

Re: Station Status question

Postby dazza1223 » Sun Jan 14, 2018 11:32 pm

well im not very good with php and i dont think u got the time to help me to set something like this up

User avatar
saratogaWX
Posts: 849
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Station Status question

Postby saratogaWX » Sun Jan 14, 2018 11:49 pm

Generally, with PHP, you learn by doing. Having someone do it for you is not learning. This is a hobby.. enjoy it by learning :)


Return to “Saratoga Templates”

Who is online

Users browsing this forum: No registered users and 4 guests