Author Topic: using METAR current conditions as my dashboard current conditions  (Read 743 times)

0 Members and 1 Guest are viewing this topic.

Offline pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Hello there,

I have another question regarding the use of METAR script by seratoga templates, since Im not using weather display, the current conditions on my webpage dashboard current conditions not working anymore, I have an Idea instead using from WD, I want to use my METAR conditions appear on my ajax dashboard as current conditions.

Can you help me how to import those tags on metar template? and putting it here on my dashboard?

<td align="center" valign="top" class="data1" style="text-align: center;border: none">
                <img src="<?php echo $condIconDir . newIcon($iconnum) ?>" 
                  alt="<?php $t1 = fixupCondition($condwords);
                        echo $t1; ?>"
                        title="<?php echo $t1; ?>" height="74" width="74" />
                        </span>
                    </td>

                    <td align="center" style="text-align: center; border: 1px solid gray;">
                        <span class="ajax" id="ajaxcurrentcond">
                        <?php echo $t1; ?> </span><br/><br/>
                    </td>

                </tr>

above is my dashboard script current conditions which shows "Not Available"

Thank You and regards

-mike-

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #1 on: April 14, 2019, 06:58:17 PM »
I see you're using the WeeWX Weather-display skin to create testtags.php and clientraw.txt.

You can use the following Weewx-currentconds.php script to get the metar sky conditions for you
Code: [Select]
<?php
/*
 File: Weewx-currentconds.php

 Purpose: provide a current conditions and icon from a WeeWX running the WD bridge software

 Add a include("Weewx-currentconds.php") after an include for testtags.php ($SITE['WXtags']) and
 configure a metar in $SITE['conditionsMETAR'] entry.
 Set $SITE['overrideRain'] = true; to enable local rain to override sky conditions from metar.
 
 Author: Ken True - webmaster@saratoga-weather.org

//Version 1.00 - 14-Apr-2019

*/
// --------------------------------------------------------------------------

// allow viewing of generated source

if (isset($_REQUEST["sce"]) and strtolower($_REQUEST["sce"]) == "view" ) {
//--self downloader --
   
$filenameReal __FILE__;
   
$download_size filesize($filenameReal);
   
header("Pragma: public");
   
header("Cache-Control: private");
   
header("Cache-Control: no-cache, must-revalidate");
   
header("Content-type: text/plain");
   
header("Accept-Ranges: bytes");
   
header("Content-Length: $download_size");
   
header("Connection: close");
   
   
readfile($filenameReal);
   exit;
}
#-------------------------------------------------------------------------------------
# function processed WD variables
#-------------------------------------------------------------------------------------
global $SITE,$Debug;
if(isset(
$SITE['conditionsMETAR'])) { // override with METAR conditions for text and icon if requested.
include_once("get-metar-conditions-inc.php");
list($Currentsolardescription,$iconnumber) = mtr_conditions($SITE['conditionsMETAR'], $time$sunrise$sunset);
    if(isset(
$currentrainratehr) and 
      (!isset(
$SITE['overrideRain']) or (isset($SITE['overrideRain']) and $SITE['overrideRain'])) ) {
print "<!-- Weewx-currentconds before: Currentsolardescription='$Currentsolardescription' icon='$iconnumber' -->\n";
print $Debug;
  list($Currentsolardescription,$iconnumber) = 
  WWX_RainRateIcon($Currentsolardescription,$iconnumber,$currentrainratehr,$uomrain,$time,$sunrise,$sunset);
print "<!-- Weewx-currentconds after: Currentsolardescription='$Currentsolardescription' icon='$iconnumber' -->\n";
    }
}

#-------------------------------------------------------------------------------------
# WeeWX support function - WWX_RainRateIcon
#-------------------------------------------------------------------------------------

function WWX_RainRateIcon($inText,$inIcon,$inRate,$inUOM,$time,$sunrise,$sunset,$lastRain='0000-00-00T00:00:00') {
   global 
$Debug;
   
/*
Rainfall intensity is classified according to the rate of precipitation:

    Light rain  rate is < 2.5 mm (0.098 in) per hour
    Moderate rain  rate is between 2.5 mm (0.098 in) - 7.6 mm (0.30 in) or 10 mm (0.39 in) per hour
    Heavy rain  rate is > 7.6 mm (0.30 in) per hour, or between 10 mm (0.39 in) and 50 mm (2.0 in) per hour
    Violent rain  rate is > 50 mm (2.0 in) per hour
*/

   
$Debug .= "<!-- WWX_RainRateIcon in='$inText' icon='$inIcon' rate='$inRate' uom='$inUOM' -->\n";
   
$newText '';  // assume no changes
   
$newIcon $inIcon;
   
   
$rate $inRate;
   if(
preg_match('|in|i',$inUOM)) { // convert to mm/hr rate
     
$rate $inRate 25.4;
   }
   
   if(
substr($lastRain,0,4) <> '0000') {
  if($rate 0.001 and time()-strtotime($lastRain) < 30*60) {
 $newText 'Moderate Drizzle';
  }
   }

   if (
$rate 0.0 and $rate 2.5) { $newText 'Light Rain'; }
   if (
$rate >=2.5 and $rate 7.6) { $newText 'Moderate Rain'; }
   if (
$rate >=7.6 and $rate 50.0) { $newText 'Heavy Rain'; }
   if (
$rate >= 50.0)         { $newText 'Violent Rain'; }
   
   if(
$newText <> '' or $rate == 0.0) {
   if ($newText <> '' and $inText <> '') {$newText .= ', ';}
   $newText .= 
      preg_replace('/(Light|Moderate|Heavy|Violent|Extreme){0,1}\s*(Rain|Mist|Drizzle), /i','',$inText);
   $newIcon mtr_get_iconnumber ($time,$newText,$sunrise,$sunset); 
   } else {
   $newText $inText;
   }
   
$Debug .= "<!-- WWX_RainRateIcon out='$newText' icon='$newIcon' rate='$rate' mm/hr -->\n";
   return(array(
$newText,$newIcon));
}

?>

In your home page, after the include for $SITE['WXtags'], add an include("Weewx-currentconds.php").  It will use your testtags.php data and the METAR listed in Settings-weather.php $SITE['conditionsMETAR'] to set $Currentsolardescription and $iconnumber for you to work with the dashboard.   It's the same code I used for other weather software that didn't have the unique WD metar settings.

Also, you'll need to edit ajaxWDwx.js to prevent the weewx-generated clientraw.txt from overriding with the default values when the AJAX update happens.  Change ajaxWDwx.js from
Code: [Select]
// current condition icon and description
set_ajax_obs("ajaxconditionicon",
ajax_wxIcon(clientraw[48])
);

set_ajax_obs("ajaxconditionicon2",
ajax_wxIconJPG(clientraw[48])
);


var currentcond = clientraw[49];
// currentcond = currentcond.replace(/_/g,' ');
// currentcond = currentcond.replace(/^\/Dry\//g,'');
currentcond = currentcond.replace(/\\/g,', ');
// currentcond = currentcond.replace(/\//g,', ');
        currentcond = ajaxFixupCondition(currentcond);
set_ajax_obs("ajaxcurrentcond",currentcond);
set_ajax_obs("gizmocurrentcond",currentcond);
to
Code: [Select]
// current condition icon and description
// set_ajax_obs("ajaxconditionicon",
// ajax_wxIcon(clientraw[48])
// );

// set_ajax_obs("ajaxconditionicon2",
// ajax_wxIconJPG(clientraw[48])
// );


var currentcond = clientraw[49];
// currentcond = currentcond.replace(/_/g,' ');
// currentcond = currentcond.replace(/^\/Dry\//g,'');
currentcond = currentcond.replace(/\\/g,', ');
// currentcond = currentcond.replace(/\//g,', ');
        currentcond = ajaxFixupCondition(currentcond);
// set_ajax_obs("ajaxcurrentcond",currentcond);
// set_ajax_obs("gizmocurrentcond",currentcond);

Best regards,
Ken
« Last Edit: April 15, 2019, 07:24:40 PM by saratogaWX »
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 pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #2 on: April 16, 2019, 11:35:27 AM »
I see you're using the WeeWX Weather-display skin to create testtags.php and clientraw.txt.

You can use the following Weewx-currentconds.php script to get the metar sky conditions for you
Code: [Select]
<?php
/*
 File: Weewx-currentconds.php

 Purpose: provide a current conditions and icon from a WeeWX running the WD bridge software

 Add a include("Weewx-currentconds.php") after an include for testtags.php ($SITE['WXtags']) and
 configure a metar in $SITE['conditionsMETAR'] entry.
 Set $SITE['overrideRain'] = true; to enable local rain to override sky conditions from metar.
 
 Author: Ken True - webmaster@saratoga-weather.org

//Version 1.00 - 14-Apr-2019

*/
// --------------------------------------------------------------------------

// allow viewing of generated source

if (isset($_REQUEST["sce"]) and strtolower($_REQUEST["sce"]) == "view" ) {
//--self downloader --
   
$filenameReal __FILE__;
   
$download_size filesize($filenameReal);
   
header("Pragma: public");
   
header("Cache-Control: private");
   
header("Cache-Control: no-cache, must-revalidate");
   
header("Content-type: text/plain");
   
header("Accept-Ranges: bytes");
   
header("Content-Length: $download_size");
   
header("Connection: close");
   
   
readfile($filenameReal);
   exit;
}
#-------------------------------------------------------------------------------------
# function processed WD variables
#-------------------------------------------------------------------------------------
global $SITE,$Debug;
if(isset(
$SITE['conditionsMETAR'])) { // override with METAR conditions for text and icon if requested.
include_once("get-metar-conditions-inc.php");
list($Currentsolardescription,$iconnumber) = mtr_conditions($SITE['conditionsMETAR'], $time$sunrise$sunset);
    if(isset(
$currentrainratehr) and 
      (!isset(
$SITE['overrideRain']) or (isset($SITE['overrideRain']) and $SITE['overrideRain'])) ) {
print "<!-- Weewx-currentconds before: Currentsolardescription='$Currentsolardescription' icon='$iconnumber' -->\n";
print $Debug;
  list($Currentsolardescription,$iconnumber) = 
  WWX_RainRateIcon($Currentsolardescription,$iconnumber,$currentrainratehr,$uomrain,$time,$sunrise,$sunset);
print "<!-- Weewx-currentconds after: Currentsolardescription='$Currentsolardescription' icon='$iconnumber' -->\n";
    }
}

#-------------------------------------------------------------------------------------
# WeeWX support function - WWX_RainRateIcon
#-------------------------------------------------------------------------------------

function WWX_RainRateIcon($inText,$inIcon,$inRate,$inUOM,$time,$sunrise,$sunset,$lastRain='0000-00-00T00:00:00') {
   global 
$Debug;
   
/*
Rainfall intensity is classified according to the rate of precipitation:

    Light rain  rate is < 2.5 mm (0.098 in) per hour
    Moderate rain  rate is between 2.5 mm (0.098 in) - 7.6 mm (0.30 in) or 10 mm (0.39 in) per hour
    Heavy rain  rate is > 7.6 mm (0.30 in) per hour, or between 10 mm (0.39 in) and 50 mm (2.0 in) per hour
    Violent rain  rate is > 50 mm (2.0 in) per hour
*/

   
$Debug .= "<!-- WWX_RainRateIcon in='$inText' icon='$inIcon' rate='$inRate' uom='$inUOM' -->\n";
   
$newText '';  // assume no changes
   
$newIcon $inIcon;
   
   
$rate $inRate;
   if(
preg_match('|in|i',$inUOM)) { // convert to mm/hr rate
     
$rate $inRate 25.4;
   }
   
   if(
substr($lastRain,0,4) <> '0000') {
  if($rate 0.001 and time()-strtotime($lastRain) < 30*60) {
 $newText 'Moderate Drizzle';
  }
   }

   if (
$rate 0.0 and $rate 2.5) { $newText 'Light Rain'; }
   if (
$rate >=2.5 and $rate 7.6) { $newText 'Moderate Rain'; }
   if (
$rate >=7.6 and $rate 50.0) { $newText 'Heavy Rain'; }
   if (
$rate >= 50.0)         { $newText 'Violent Rain'; }
   
   if(
$newText <> '' or $rate == 0.0) {
   if ($newText <> '' and $inText <> '') {$newText .= ', ';}
   $newText .= 
      preg_replace('/(Light|Moderate|Heavy|Violent|Extreme){0,1}\s*(Rain|Mist|Drizzle), /i','',$inText);
   $newIcon mtr_get_iconnumber ($time,$newText,$sunrise,$sunset); 
   } else {
   $newText $inText;
   }
   
$Debug .= "<!-- WWX_RainRateIcon out='$newText' icon='$newIcon' rate='$rate' mm/hr -->\n";
   return(array(
$newText,$newIcon));
}

?>

In your home page, after the include for $SITE['WXtags'], add an include("Weewx-currentconds.php").  It will use your testtags.php data and the METAR listed in Settings-weather.php $SITE['conditionsMETAR'] to set $Currentsolardescription and $iconnumber for you to work with the dashboard.   It's the same code I used for other weather software that didn't have the unique WD metar settings.

Also, you'll need to edit ajaxWDwx.js to prevent the weewx-generated clientraw.txt from overriding with the default values when the AJAX update happens.  Change ajaxWDwx.js from
Code: [Select]
// current condition icon and description
set_ajax_obs("ajaxconditionicon",
ajax_wxIcon(clientraw[48])
);

set_ajax_obs("ajaxconditionicon2",
ajax_wxIconJPG(clientraw[48])
);


var currentcond = clientraw[49];
// currentcond = currentcond.replace(/_/g,' ');
// currentcond = currentcond.replace(/^\/Dry\//g,'');
currentcond = currentcond.replace(/\\/g,', ');
// currentcond = currentcond.replace(/\//g,', ');
        currentcond = ajaxFixupCondition(currentcond);
set_ajax_obs("ajaxcurrentcond",currentcond);
set_ajax_obs("gizmocurrentcond",currentcond);
to
Code: [Select]
// current condition icon and description
// set_ajax_obs("ajaxconditionicon",
// ajax_wxIcon(clientraw[48])
// );

// set_ajax_obs("ajaxconditionicon2",
// ajax_wxIconJPG(clientraw[48])
// );


var currentcond = clientraw[49];
// currentcond = currentcond.replace(/_/g,' ');
// currentcond = currentcond.replace(/^\/Dry\//g,'');
currentcond = currentcond.replace(/\\/g,', ');
// currentcond = currentcond.replace(/\//g,', ');
        currentcond = ajaxFixupCondition(currentcond);
// set_ajax_obs("ajaxcurrentcond",currentcond);
// set_ajax_obs("gizmocurrentcond",currentcond);

Best regards,
Ken


Hi ken,

Thank You for the assistance. Yes I decided to use weewx because it consumes our electric bill working my CPU 24/7, since our electric company increases again its electric bills which I cannot hold that anymore, so using raspberry pi, I can continue my weather service in the philippines and of course I still want to use your templates on my page still, since for me its more user friendly templates Im using for almost 2-3 years now and as you can see Im still remodelling my weather page because still want to figure out some issues like my weather resports and rain trends.

Ok ill get it ken, Ill get back to you if the problem still exist, right now Im studying your instructions here then Ill proceed, can't get to work fast due to  my busy work here.  ](*,)

Thanks in advance and "MABUHAY"

-Mike-
« Last Edit: April 16, 2019, 11:39:53 AM by pimohdaimaoh »

Offline pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #3 on: April 16, 2019, 04:36:13 PM »
Hello ken,

It worked after 4 hrs of trial and error, I figured it out when putting above WxTags without inside the <? and ?>, will definitelly not work at all and after I put ";" on include("Weewx-currentconds.php"); it does work already, However when I do changing my  ajaxWDwx.js , the Date changed to 1933 instead of 2019, after its AJAX updates, I do changing its m/d/y or d/m/y on the settings to see if fixed but nothing happenes.

What would be the possible problem below attached image? (the second image)


Thanks and regards

-Mike-

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #4 on: April 17, 2019, 12:31:53 PM »
The include for the Weewx-currentconds.php has to be done AFTER the include for the wxtags since it overrides two fields (current conditions and icon).

Your homepage is trying to load http://pimohweather.webutu.com/ajaxWeewx.js and that script is getting a 404.  If you're using the Weewx->WD skin, then you should be using ajaxWDwx.js for the AJAX script.  I'm not familiar with (nor distribute) a ajaxWeewx.js script.
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 pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #5 on: April 18, 2019, 12:25:09 PM »
The include for the Weewx-currentconds.php has to be done AFTER the include for the wxtags since it overrides two fields (current conditions and icon).

Your homepage is trying to load http://pimohweather.webutu.com/ajaxWeewx.js and that script is getting a 404.  If you're using the Weewx->WD skin, then you should be using ajaxWDwx.js for the AJAX script.  I'm not familiar with (nor distribute) a ajaxWeewx.js script.

Hello,

Yes, It is actually my intention to dissable ajaxWDwx.js , because when I include it in ajax dashboard, it still works fine as before, however the values like (see attached) the Date values changes to uncorrect yr date, also the wind gust value gives also incorrect value and also to its UV and  solar values, so I decided to disable the .js temnporarily so that the dashboard data shows the correct values, however of course to update the data, I should put like <meta http-equiv="refresh" content="60"> to ajaxdashboard to auto refresh it since no .js script to auto updates data. Still cant figure it out the .js script how to correct those values in  ajaxWDwx.js so that I can use that .js again properly.

Maybe you could help me fixing ajaxWDwx.js to properly puts the correct data on the dashboard but the Weewx-currentconds.php is 100% working on my current dashboard, Thank You so Much on that, I can accurately monitor the event status of weather using METAR. because of this even our local weather forcaster using my webpage as second referenced data.

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #6 on: April 18, 2019, 01:29:36 PM »
You seem to be running an older version of Alternative-ajax-dashboard.php - 6.95 - 05-JAN-2016 by Scott, with your own mods (and strangely enough, some Leuven scripts mixed in (module ws_luftdaten1.php),

The customary AJAX script for the alternative dashboard is ajaxWDwx3.js instead of the stock ajaxWDwx.js script for the Saratoga template.

Both of those scripts use http://pimohweather.webutu.com/pimohweewx/WD/clientraw.txt as the clientraw source.

Using my WD parser against your http://pimohweather.webutu.com/pimohweewx/WD/ shows your WeeWX-generated clientraw.txt to be malformed -- there are misplaced values (likely due to extra spaces in the record).  That's why neither AJAX script seems to work properly -- the clientraw.txt data record doesn't have the info in the correct space-delimited record.  I suggest you update your WeeWX skin that creates the clientraw*.txt files to the latest version and see if that fixes the errors you're seeing.  When the WD-parser shows the correct number of fields (and with proper contents), your site will work with the AJAX enabled.
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 pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #7 on: April 18, 2019, 02:33:44 PM »
You seem to be running an older version of Alternative-ajax-dashboard.php - 6.95 - 05-JAN-2016 by Scott, with your own mods (and strangely enough, some Leuven scripts mixed in (module ws_luftdaten1.php),

The customary AJAX script for the alternative dashboard is ajaxWDwx3.js instead of the stock ajaxWDwx.js script for the Saratoga template.

Both of those scripts use http://pimohweather.webutu.com/pimohweewx/WD/clientraw.txt as the clientraw source.

Using my WD parser against your http://pimohweather.webutu.com/pimohweewx/WD/ shows your WeeWX-generated clientraw.txt to be malformed -- there are misplaced values (likely due to extra spaces in the record).  That's why neither AJAX script seems to work properly -- the clientraw.txt data record doesn't have the info in the correct space-delimited record.  I suggest you update your WeeWX skin that creates the clientraw*.txt files to the latest version and see if that fixes the errors you're seeing.  When the WD-parser shows the correct number of fields (and with proper contents), your site will work with the AJAX enabled.

Thanks ken, now I see the suspected weewx WD-Extension skin.conf might be the cause, I will try to fix in its skin.conf, however I didnt try to edit skins in weewx yet since, but I will try and see what I got, right now I am running the dashboard without the .js script temporarily while I try to figure those errors. Thank You for the assistance.
« Last Edit: April 18, 2019, 02:39:58 PM by pimohdaimaoh »

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #8 on: April 18, 2019, 07:14:28 PM »
I think I found the issue with the clientraw.txt format -- there are 5 timestamps that have the format 'hh:mm:ss AM' with a space separating the time from the AM or PM.  I worked up a fix to the clientraw.txt.tmpl file in the weewx/skins/Clientraw directory and have attached the tar-gz'ed version for you.  It does fix the 5 timestamps (I tried it on my 3.9.1 weewx with 1.0.3 version of the WD plugin).

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

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #9 on: April 19, 2019, 12:11:03 PM »
I think I found the issue with the clientraw.txt format -- there are 5 timestamps that have the format 'hh:mm:ss AM' with a space separating the time from the AM or PM.  I worked up a fix to the clientraw.txt.tmpl file in the weewx/skins/Clientraw directory and have attached the tar-gz'ed version for you.  It does fix the 5 timestamps (I tried it on my 3.9.1 weewx with 1.0.3 version of the WD plugin).

Hope this helps...

Oh, Thanks ken. . . . I will paste this when I come back home, for sure this will fix the issue of my yr date using .js script

(UPDATE)

Nice Ken it worked, it correctly post the correct yr and time, will observe if this affects other values


regards

-mike-
« Last Edit: April 19, 2019, 01:20:10 PM by pimohdaimaoh »

Offline garlandclan

  • Member
  • *
  • Posts: 9
    • Garland Clan Weather
Re: using METAR current conditions as my dashboard current conditions
« Reply #10 on: May 18, 2020, 12:01:57 PM »
Ken,

I am running the Burnsville scripts, with Weewx, and WeewxWD 1.0.3, and have the same conditions issue as above.  I am interested in having the sun replaced with METAR conditions as well, but the ajaxWDx3.js is a bit different than your snippet above. 

There is additional code, including some stuff regarding gizmocurrentcond.  Would I still just comment out that entire section?  I don't want to break anything else.  Also, you mention replacing the rain (overrideRain) for sky conditions.  What is that for? 

Thank you!
Sean
https://weather.lavacrawlers.com

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #11 on: May 18, 2020, 01:56:24 PM »
There's an architectural problem with the WeewxWD plugin for Weewx -- it was designed to emulate Weather-Display to generate the testtags.php and a clientraw.txt so it could be used with the original V2 Saratoga WD-AJAX-PHP template set.  Real Weather-Display will use a combination of a Metar and local wind/rain to produce the $currentsolardescription and $iconnumber in both testtags.php and clientraw.txt.  The WeewxWD plugin does neither -- it uses 0 for $iconnumber and no weather conditions.

All the non-WD software plugins for the V3 Saratoga template have logic in the xx-tags.php to set the needed variables from a selected metar, but only in the tags (not the realtime files).  When the software type=WD, the dashboard (etc) thinks real Weather-Display is driving the site, and so all the parts (dashboard, gizmo, ajaxWDwx.js) think that the iconnumber and weather conditions are set, and with the WeewxWD software, they are not.

To do what you want, the equivalent functions (including calling get-metar-conditions-inc) from one of the other plugins would have to be converted to Python and added to the template files in Weewx to generate testtags.php and clientraw.txt -- I'm afraid that's beyond my scope to adapt.  I know PHP quite well, python, not so much..sorry.
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 ConligWX

  • Forecaster
  • *****
  • Posts: 488
  • #conligwx
    • conligwx.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #12 on: May 18, 2020, 02:06:41 PM »
Unfortunately I Personally would be more worried about the fact most of your scripts are out of date on the whole web site

http://www.pimohweather.com/check-fetch-times.php?show=versions

https://weather.lavacrawlers.com/check-fetch-times.php?show=versions

Apologies for being the bringer of bad news  #-o
Regards Simon


Offline garlandclan

  • Member
  • *
  • Posts: 9
    • Garland Clan Weather
Re: using METAR current conditions as my dashboard current conditions
« Reply #13 on: May 18, 2020, 04:02:52 PM »
To Ken: 
Okay, gotcha.  I've been dealing with it forever, but after seeing the initial post here, thought maybe I could get some sort of action on it.  Guess since I AM actually using the WeewxWD plugin, and using the testags/clientraw, that it won't really ever work until the WD component gets re-written.... 

Thank you!

To ConfigWX: 
Not sure I am worried or really care about the date on the scripts.  The page works, and is helpful.  The only thing "missing" is the one spot of data that is related to something that WeewxWD doesn't actually produce.  I built this system quite some time ago, using the Burnsville, and Saratoga (was born in Saratoga BTW) scripts.  Obviously the Burnsville stuff isn't updated (well not from the original guy), and the other stuff, I just haven't kept up with.  I have modified (feels like anyway) every file or many files, and to update all the scripts, and go through regression testing again doesn't really feel all that fun to me.  I'm not a coder, I'm an IT consultant and MSP and weather hobbyist.  I tinker at home with fun projects like this for the fun of it, and not really production.  I like where it is, and am happy enough that unless there was a specific reason to "update" I don't know that I would

For people who always have to have the most updated systems, I guess they'd probably cringe.  My buddy has never updated his system, or scripts and they are way older than mine LOL.  At any rate, it isn't bad news, or scary and I'm not worried. 
Thanks though, I had no idea that feature/function existed.  Pretty nifty.

Sean Garland
https://weather.lavacrawlers.com

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7807
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: using METAR current conditions as my dashboard current conditions
« Reply #14 on: May 18, 2020, 05:00:32 PM »
Hi Sean,
And hello to an ex-Saratogan :)

The main reason I update scripts from time-to-time is to address changes to source data sites as they change from http to https-only and/or change the location on the source weather sites for the data.  Occasionally, I'll do a major update to scripts to replace something (like using OpenStreetMaps/Leaflet instead of Google Maps for things like quake-json, mesonet-map, global-map script sets).
There are parts of your site that are silently broken due to lack of script updates, so I'd really recommend you do an update to get full functionality back on your site.  With the update tool (linked if check-fetch-times.php?show=versions finds a need), you can get a customized set of ALL updates needed as a .zip file, with recommendations on how to update for each file.  Generally, the support scripts can just be updated without configuration as they derive your configuration from entries in Settings.,php.
The same recommendation applies to your buddy .. if you want your site to continue working with full functionality, having the current versions of support scripts is needed.

Best regards,
Ken
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 garlandclan

  • Member
  • *
  • Posts: 9
    • Garland Clan Weather
Re: using METAR current conditions as my dashboard current conditions
« Reply #15 on: May 18, 2020, 05:08:46 PM »
Hey Ken,

Thanks for the update.  I'm actually going to do a compare from script to script just to see where I've made changes.  I feel like over the years I've made so many changes, that I will need to implement the edits in the new file as well.  I do believe in updates, and have had to rebuild my maps links several times now (due to addresses changing, going to HTTPS as you say, etc).  Even had to update the two maps on my main page yesterday because they broke... 

I just can't remember everywhere I've made a change.  Just looking at the very first file, advforecast2.php, I have my point-printable link in there, and my NOAA zone.  I'm just worried about having more stuff be wrong/break after updates. 

Anyway - yeah born at Good Sam there on the south side of 17, and lived in Los Gatos.  Moved out when I was 6, but love it there and still have a lot of family down there and in the area.  Couldn't afford to move back.  Living up here outside of Weed CA, though, you get used to no traffic, and no crowding, with a full view of Mount Shasta from my couch, so there is that ;)

Thanks!
Sean Garland
https://weather.lavacrawlers.com

Offline garlandclan

  • Member
  • *
  • Posts: 9
    • Garland Clan Weather
Re: using METAR current conditions as my dashboard current conditions
« Reply #16 on: May 18, 2020, 05:12:54 PM »
One more thing Ken,

I don't know PHP or Python really, but how difficult would it be to pull some other sort of data directly from METAR or Wunderground for the current conditions?  Or is that just something that can't be done?

I did read today, that weewx-wd may get an update this month, or soon (said "soon" 2 weeks ago), but not sure the conditions will be addressed (guessing not).  I was going to just remove the section from the dashboard, but wondering just what it would take to take some direct link to NOAA/METAR data and replace that section....  I totally understand if it's too much to even go into.  I do understand (somewhat) how the scripts work, and see where they are pulling values, settings, and data, but not really sure how to accomplish what I'm thinking about.  I know I'm not the only user of Weewx, with weewx-wd and the very fine scripts.

I mainly went with Burnsville because they had a mobile template.  Not sure (never tested) what mobile looks like on straight Saratoga scripts.  I typically use my phone with the page up 24x7 (saved page on my mobile browser too) so I have instant access to my info.  I only check on the computer when playing, or watching the .74" of rain we got yesterday...

Thanks again!
Sean Garland
https://weather.lavacrawlers.com

Offline pimohdaimaoh

  • Senior Contributor
  • ****
  • Posts: 253
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: using METAR current conditions as my dashboard current conditions
« Reply #17 on: May 20, 2020, 06:30:55 PM »
Unfortunately I Personally would be more worried about the fact most of your scripts are out of date on the whole web site

http://www.pimohweather.com/check-fetch-times.php?show=versions

https://weather.lavacrawlers.com/check-fetch-times.php?show=versions

Apologies for being the bringer of bad news  #-o

hello there,

Thanks for bringing that up, Well actually I already noted about that since Ken updated all the scripts to V3 and most of my scripts are too older now, Im planning to update to latest scripts, HOWEVER latest of seratoga scripts lately cannot YET compatible to my recent ajax assembled it causes too much errors that is hard to handle for now and since I used a combined bashewa scripts and burnsville, so I havent yet time to update my scripts, it doesnt matter to me if my seratoga script for now are out of date, as long its still operational normally, although theres a hidden broke on each scripts coz of out of date versions.

I already did re configuring using seratoga latest scripts in separate folder time to time untill all can be compatible and working without too much trouble of errors running scripts to be fixed.

Regards

-Mike-
« Last Edit: May 20, 2020, 06:45:25 PM by pimohdaimaoh »