Author Topic: Saratoga Template Status 'NOT CURRENT' and 1 other issue  (Read 552 times)

0 Members and 1 Guest are viewing this topic.

Offline gs100

  • Member
  • *
  • Posts: 2
Saratoga Template Status 'NOT CURRENT' and 1 other issue
« on: May 15, 2022, 02:17:25 PM »
I'm trying to transition from Weather Display/Saratoga Weather Templates to Weewx/Saratoga, so rather than take down my hosted http/php server and local Weather Display server, I'm trying to initially duplicate the site locally with a Raspberry Pi running Weewx 4.80 and a local Ubuntu computer running Apache2 with the Sarasota USA template. I have  Peet Bros 2100 weather station hardware. This system is NOT currently visible to the outside world. After debugging and a reasonable burn-in period I'll move to the hosted server.

I've got almost everything running well, with a couple of anomalies:

1) The Weather Station Status page shows that "WeeWx weather data" is "NOT CURRENT", and is showing the Unix epoch date for "Latest Update Time".  The Saratoge/Weewx setup instructions indicate that the "Weather Data" status is determined from the  internal date:time of the data in WEEWXtags.php. I'm no programmer (an understatement to be sure!), but I decided to do a little digging and it looks like wxstatus.php depends on include-wxstatus.php for the status info. But in include-wxstatus.php I can't see any reference to the WEEWXtags.php file. Is there something I've overlooked?

(Incidentally, the internal date and time values are current and correct in the WEEWXtags.php file)

2) I'm getting "Undefined variable: VPuv in /var/www/html/ajax-gizmo.php on line 206, referrer: http://7040-micro-04.home/wxnwsradar.php" and other referrers including wxindex.php and wxstatus.php in the Apache2 error.log.

I don't have a UV sensor, so I set "UV" to false in Settings-weather.php. "UVscript is set to 'get-UV-forecast-inc.php'.

I tried to chase down what was happening, but my inabilities as a programmer caught up with me. Any idea what might be causing these errors?

Thanks in advance for any advice.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9282
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Template Status 'NOT CURRENT' and 1 other issue
« Reply #1 on: May 15, 2022, 04:19:20 PM »
Understand that it's quite difficult to do a detailed debug of what's happening without public access to the site .. I'll have to rely on your descriptions (maybe fraught with uncertainty).

For the wxstatus.php, yes, include-wxstatus.php does the heavy lifting and checks 2 things:
1) the FTP update time uses the filemtime("WEEWXtags.php") for it's result .. it shows current if it is < 5 minutes old (based on comparing it to current time on the RPi.
If the WEEWX Data line is having the issue, then check the value in Settings.php of
Code: [Select]
$SITE['WDdateMDY'] = true; // for WD date format of month/day/year.  =false for day/month/year
  Look at WEEWXtags.php?sce=dump and see if the date entry looks like
Code: [Select]
$date = '05/15/2022';
and if it does, then 'true' is correct.  If it looks like
Code: [Select]
$date = '15/05/2022';
then the
Code: [Select]
$SITE['WDdateMDY'] = false; // for WD date format of month/day/year.  =false for day/month/year
should be used instead.   For reference, this is the part that checks for the FTP and Data entries in include-wxstatus.php
Code: [Select]
    do_check($SITE['WXsoftwareLongName']." ".langtransstr("FTP"),$SITE['WXtags'],60*5+15,'file');
  }
  // check the internal date of the tags file
  $chkdate = fixup_date($date) . ' ' . fixup_time($time); // handle all formats to make standard
  print "<!-- ".$SITE['WXtags']." internal update date time='$date $time' fixed='$chkdate' -->\n";
  do_check($SITE['WXsoftwareLongName']." ".langtransstr("weather data"),strtotime($chkdate),60*5+15,'application');

2) The Undefined VPuv in ajax-gizmo.php Line 206 , without a UV sensor, you can change ajax-gizmo.php from
Code: [Select]
<span class="ajaxcontent8" style="display: none"><?php langtrans(&#39;UV Index&#39;); ?>:
           <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
</span>
to
Code: [Select]
<?php if(isset($VPuv)) { // display if UV is available ?>
<span class="ajaxcontent8" style="display: none"><?php langtrans(&#39;UV Index&#39;); ?>:
           <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
</span>
<?php // end of UV check ?>

Hope this helps...
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 gs100

  • Member
  • *
  • Posts: 2
Re: Saratoga Template Status 'NOT CURRENT' and 1 other issue
« Reply #2 on: May 19, 2022, 12:05:56 PM »
Sorry it's taken me so long to respond.

You nailed both issues for me. Item (1) was indeed caused be the inversion of day vs month. I changed 'true' to 'false' and the issue immediately resolved.

Item (2) is what took the most time to resolve, due initially to an apparent typo in my first attempt to implement your suggested changes. My unnoticed typo caused more PHP errors, so I decided to move the site files to a currently unused hosted site to make troubleshooting easier. It was only after the move that I discovered the host (1and1/Ionos) doesn't offer PHP error logging by default, and the method to implement it isn't the most intuitive in the world.

So, after a day of trial and error, PHP logging was a reality, and I discovered that it really pays to proofread after I type something, spaces matter, and cut and paste is your friend.

So in summary, all is now well, and I truly thank you for taking the time to assist with this. My troubleshooting skills were definitely not up to the task.

Again, thanks...