Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.3.1 (build 4064) - 09 December 2024

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic on an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

BT's Global Sager Weathercaster PHP Scripts For CumulusMX

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

BT's Global Sager Weathercaster PHP Scripts For CumulusMX

Post by Buford T. Justice »

Now FASTER than ever and completely AUTOMATIC with METAR!

After using both the circular Zambretti Forecaster and the Zambretti Weathercard Forecaster, I noticed they were not always accurate as neither uses cloud cover or current weather conditions to make a forecast. I found that The Sager Weathercaster does use cloud cover and current weather conditions making it more accurate. I made BT's Global Sager Weathercaster PHP Scripts For CumulusMX earlier this year and have kept testing and improving them to what they are now. I originally used JavaScript but have since changed them to PHP as of 2013-12-31.

I have added the ability to use The Sager Weathercaster anywhere on Earth as it is originally meant for use in the Northern Temperate Zone.

Prerequisites

Your web server host must have both PHP 5.x and cURL support enabled on your account.

CumulusMX

There are some settings that need to be made to and checked in CumulusMX.

Click on SETTINGS > STATION SETTINGS:
  • Under LOCATION, make sure your latitude and longitude are set correctly.
  • Under OPTIONS, make sure the boxes in front of "Use bearing zero when calm" and "Cumulus pressure trend names" are checked. Also make sure you have correctly entered your GPS coordinates.
  • Click SAVE at the bottom.
  • Close CumulusMX.
Open the CumulusMX\web folder and your weather website directory. Delete these files if you have been using a previous version of this forecaster if they exist:

bt-metar.php
bt-sager.js
bt-sager.php
bt-sager-cu.js
bt-sager-cu.php
bt-sager-var.php

When you open the BT's Global Sager Weathercaster PHP Scripts For CumulusMX.zip attachment at the bottom of this long post, you will see 3 PHP files:

bt-sager.php
bt-sager-cu.php
bt-sager-wc.php

Here is what they do:

bt-sager.php
This file reads data obtained from bt-sager-cu.php and bt-sager-wc.php and displays it in a useful way. You can access this file by clicking on the forecast on your weather webpage.

bt-sager-cu.php
This file is what CumulusMX updates during a web update with the correct variables to determine a forecast.

bt-sager-wc.php
This file takes the variables CumulusMX updates during a web update in bt-sager-cu.php to determine the correct forecast for your location.

Extract these 3 files to your CumulusMX web folder. Now open the CumulusMX web folder and locate bt-sager-cu.php. You will need to open it with a text editor. I HIGHLY RECOMMEND Notepad++ which is free. This is the program I am going to assume you will be using to do all which follows.

You will need to know what your closest airport's ICAO code is in order to get a METAR report. You can find this easily by going to Wunderground. You more than likely upload your CumulusMX data there already so go to the forecast for your location. Near your station name you should see a button called STATION SELECT. Click on that and you should see nearby airport codes using 4 letters. Write down the ID of the one closest to your location. You can learn more about METAR here:

http://www.wunderground.com/metarFAQ.asp
https://en.wikipedia.org/wiki/METAR
http://www.aviationweather.gov/static/a ... ations.txt

Now with bt-sager-cu.php open in Notepad++, go to Line 15 and change XXXX between the quote marks to the METAR station ID you want to use. Be sure to leave the quote marks. Make sure to enter the ICAO code in CAPITAL LETTERS. Save your changes then close Notepad++.

Next you will need to upload all 3 files once to your web server in the same directory CumulusMX uploads to during web updates.

You can now re-open CumulusMX. Once it finishes reading data, click on SETTINGS > EXTRA WEB FILES. You will see a series of boxes. The ones on the left are LOCAL files. The ones on the right are REMOTE files. You will need a blank LOCAL one with a blank REMOTE one to the right of it. Click the empty box under LOCAL. You need to browse to your CumulusMX web folder and select bt-sager-cu.php. This file along with the folder location it is in should now be in the LOCAL box. Now in the REMOTE box, you will need to type in /bt-sager-cu.php or if you are uploading to a folder use the folder name so type in /FOLDER NAME/bt-sager-cu.php. Now to the right of the REMOTE box are some check boxes. You need to check PROCESS? and FTP? so bt-sager-cu.php is updated when CumulusMX performs a web update. Click OK.

Now you need to update either the CumulusMX indexT.htm file if you are using the default templates from CumulusMX on your weather webpage or you will need to update the template files for the template you are using. Usually most folks use the default CumulusMX templates, but others use the Saratoga or the Weather by You PHP templates. All of these changes are explained below. You only need to change the ones you are using obviously.

indexT.htm
Open this with Notepad++.

CHANGE:

Code: Select all

<head>
<meta charset="UTF-8">
<meta name="description" content="<#location> weather data" />
<meta name="keywords" content="Cumulus, <#location> weather data, weather, data, weather station" />
<title><#location> weather</title>
<link href="weatherstyle.css" rel="stylesheet" type="text/css" />
</head>
TO:

Code: Select all

<head>
	<meta charset="UTF-8">
	<meta http-equiv="refresh" content="299">
	<meta name="description" content="<#location> weather data" />
	<meta name="keywords" content="Cumulus, <#location> weather data, weather, data, weather station" />
	<title><#location> weather</title>
	<link href="weatherstyle.css" rel="stylesheet" type="text/css" />
</head>
CHANGE:

Code: Select all

<p><b>Forecast:</b> <#forecast></p>
TO:

Code: Select all

<p align= "center"><b>12-24 Hour Forecast:</b><br>
<a href = "bt-sager.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><script src = "bt-sager-wc.php"></script></font></b></a></p>
OR FOR SMALLER LETTERS:

Code: Select all

<p><b>12-24 Hour Forecast:</b>&nbsp;<a href = "bt-sager.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000"><script src = "bt-sager-wc.php"></script></font></b></a></p>
PLEASE leave the <a href> link in the code as it makes it easy to see the variables used to determine a forecast simply by clicking on the forecast.

That's it! Now when CumulusMX updates your website, you will see The Sager Weathercaster forecast on your main weather webpage. If you use Saratoga or Weather by You PHP templates on your website, keep reading.

The following is older info as I no longer use these templates, but they should help you still if you do. Just be aware the line numbers mentioned may have changed as these templates have been updated.

Saratoga Templates

Open bt-sager-wc.php with Notepad++. Scroll down to the very bottom of the file. Add // to the front of Line 6145 so it looks like this:

Code: Select all

// echo "document.write ('$sf');";// This allows displaying the forecast on a HTML webpage.  Add // to the front of this line if using a PHP webpage.
Backup these two files just to be safe then open them with Notepad++:

ajax-dashboard.php
top.php

Using the 30 Dec 2013 04:31pm PST (31 Dec 2013 00:31 GMT) version of "Base-USA.zip":

For ajax-dashboard.php on Line 971, CHANGE:

Code: Select all

		   <td class="data1" style="width: 80px;font-size: 8pt;border: none;text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[0] . "</strong><br />" . $forecasttemp[0]; ?></td>
TO:

Code: Select all

		   <p align = "center" style = "line-height : 1.3"><b><font face = "Tahoma" size = "2">12-24 Hour Forecast:</font></b><br>
		   <a href = "bt-sager.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><?php include "bt-sager-wc.php"; echo "$sf"; ?></font></b></a></p>
		   <td class="data1" style="width: 80px;font-size: 8pt;border: none;text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[0] . "</strong><br />" . $forecasttemp[0]; ?></td>
For top.php on Line 113, CHANGE:

Code: Select all

	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
TO:

Code: Select all

	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<meta http-equiv="refresh" content="299">
Weather by You Templates

Open bt-sager-wc.php with Notepad++. Scroll down to the very bottom of the file. Add // to the front of Line 6145 so it looks like this:

Code: Select all

// echo "document.write ('$sf');";// This allows displaying the forecast on a HTML webpage.  Add // to the front of this line if using a PHP webpage.
Backup index.php just to be safe then open it with Notepad++.

Using the "Weather Blues V2 2a" template as an example:

CHANGE Lines 34-47 FROM:

Code: Select all

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title><?php echo $location.' | '.$TT_now; ?></title>
	<meta name="keywords" content="Current, actually, last minute" />
	<meta name="description" content="Current weather observations" />
	<link href="styles.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
	<script type="text/javascript" src="lib/clock/clockt.js"></script> 
	<script type="text/javascript" src="lib/clock/clockp.js"></script>
  <script type="text/javascript" src="lib/dropmenu/dropdowntabs.js"></script>
	<script type="text/javascript">
		var dayname = new Array('<?php echo $Tr_sun."', '".$Tr_mon."', '".$Tr_tue."', '".$Tr_wed."', '".$Tr_thu."', '".$Tr_fri."', '".$Tr_sat."', '".$Tr_sun; ?>');
	</script>
</head>
TO:

Code: Select all

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="refresh" content="299">
	<title><?php echo $location.' | '.$TT_now; ?></title>
	<meta name="keywords" content="Current, actually, last minute" />
	<meta name="description" content="Current weather observations" />
	<link href="styles.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
	<script type="text/javascript" src="lib/clock/clockt.js"></script>
	<script type="text/javascript" src="lib/clock/clockp.js"></script>
	<script type="text/javascript" src="lib/dropmenu/dropdowntabs.js"></script>
	<script type="text/javascript">
		var dayname = new Array('<?php echo $Tr_sun."', '".$Tr_mon."', '".$Tr_tue."', '".$Tr_wed."', '".$Tr_thu."', '".$Tr_fri."', '".$Tr_sat."', '".$Tr_sun; ?>');
	</script>
</head>
CHANGE Line 92 FROM:

Code: Select all

					<h1><?php echo $Tr_forecast; ?> : <span style="color: #000"><?php echo $forecast; ?></span></h1><br />
TO:

Code: Select all

					<p align = "center" style = "line-height : 1.3"><b><font face = "Tahoma" size = "2">12-24 Hour Forecast:</font></b><br>
					<a href = "bt-sager.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><?php include "bt-sager-wc.php"; echo "$sf"; ?></font></b></a></p><br>
LOCALIZATION

If you use a language other than English, you can customize bt-sager-wc.php after you extract it to the CumulusMX web folder to work properly for your location. Open bt-sager-wc.php with Notepad++ and look at Lines 154-176 and 181-294. These are the lines to be changed to your local language, however, not all of them need to be changed.

As you can see, the arrays are EXPECTED, VELOCITIES, and DIRECTION. You would need to change the Rain/Snow predictions under C, all of the EXPECTED, the VELOCITIES for the wind unit you use, and the DIRECTION for the Zone you are at.

Only change what is between the quote marks and be sure to leave the $fp1 or $fp2, the extra line spaces, periods, parentheses () marks, and semicolon ; marks! For example, let's change Line 194 from English to Spanish. It should look like this when you are done:

Code: Select all

	expected[12] = "$fp1 y calentador; ";
Or to Japanese:

Code: Select all

	expected[12] = "$fp1 暖かい; ";
Notice expected and $fp1 are not translated. Do not translate that or velocities or direction as the PHP Scripts rely on these names and they must be in English. You can change $fp1 and $fp2 to your language on Lines 154-176 (since you probably use Celsius, just Lines 167-174).

The bt-sager-wc.php file also uses English wind directions for N, NE, E, SE, S, SW, W, NW, and Calm. If you have CumulusMX set to use wind directions other than these, you need to change these.

The EASY WAY would be to click on SEARCH>REPLACE in Notepad++. Let's say you need to change NE to NO.

In FIND WHAT, enter with quotes "NE" and in REPLACE WITH, enter with quotes "NO" then click REPLACE ALL. Repeat for the other wind directions you need to change.

Save bt-sager-wc.php and re-upload it to your website.

CHANGE LOG:

2020-12-12
Minor corrections.
NOAA changed the link to the .TXT METAR reports. The .PHP files have been updated for this change.

2016-08-04
NOAA changed the link to the .TXT METAR reports. The .PHP files have been updated for this change.

2014-02-05
The Sager Weathercaster uses older names for Beaufort wind speeds. I updated all of these to their modern wording.

Some other minor improvements have been made.

The barometric pressure offset on Line 17 in bt-sager-cu.php is currently the best way to adjust for wind speeds being forecasted too high consistently. I have tried several other methods to counteract that, but have found none better than the current method of pressure offset.

2014-01-31
The METAR fix in yesterday's version needed an adjustment.

2014-01-30
For those of you who had METAR stations which had a Precipitation Code in the station ID, that has now been fixed so when you update you will not need to delete any Precipitation Codes.

Instead of using and having code for in-between wind directions NNE, ENE, ESE, SSE, SSW, WSW, WNW, and NNW which The Sager Weathercaster doesn't exactly use (they get combined into other directions), I did what The Sager Weathercaster does and just made all wind directions in 45° sections so all wind bearings are accounted for and the directions used are:

N = 338-360 and 1-22
NE = 23-67
E = 68-112
SE = 113-157
S = 158-202
SW = 203-247
W = 248-292
NW = 293-337
Calm = 0

Several other small improvements have been made to all of the PHP files.

2014-01-14
A few people were having issues with their web server hosts blocking PHP's file_get_contents which was needed by the PHP Scripts to get METAR data. I have changed this to cURL which seems to be turned on usually (at least more so than file_get_contents). If your web server host doesn't have cURL, you can ask for it to be turned on for your account or I can give you the code to change cURL back over to file_get_contents if the previous version of these PHP Scripts worked for you.

I decided to take BCJKiwi's advice and have defaults set for $m2 and $m3. The PHP Scripts should now not report any errors in XAMPP after the METAR station ID is entered in and Cumulus updates bt-sager-cu.php.

I fixed an issue with changing commas to decimal points.

A few other tweaks to the PHP Scripts have been made.

2014-01-11
The original bt-sager.php file has been renamed to bt-sager-wc.php.

The original bt-metar.php file is no longer used. Its contents have been added into bt-sager-wc.php.

The original bt-sager-var.php file has been renamed to bt-sager.php.

The Sager Weathercaster forecasts for Rain can now change to Rain or Snow (possibly mixed) or just Rain or Snow depending on the temperature.

You now add your METAR station to Line 14 of bt-sager-cu.php.

The forecast coding shown on your main weather page has also been updated and needs to be changed to what is detailed in the directions above.

METAR Precipitation Codes and optional Descriptors are now translated for those who do not know what they are when viewing bt-sager.php if precipitation is being reported in the METAR.

A Prediction Offset has been added in case the forecasted wind speed is too high or too low. It will be rare that this will need to be used. It is detailed on Line 16 of bt-sager-cu.php.

The <#altimeterpressure> webtag has been changed back to <#press> in bt-sager-cu.php.

2014-01-05
Some METAR reports in Europe and Australia use codes and characters not used here in the USA so I added these and made other modifications to "bt-metar.php" so it should now be highly accurate.

Made some minor improvements to the other .PHP files.

2014-01-03
A few corrections made. Removed the Code Number from in front of the forecast both in "bt-sager.php" and the directions so it doesn't display in front of the forecast on your main weather page or wherever you set it to display.

I made "bt-sager-var.php" prettier.

2013-12-31
The new version of BT's Global Sager Weathercaster For Cumulus now uses PHP instead of JavaScipt making it much faster!

There is no longer any need to use Cumulus' Current Condition box to type out sky conditions thanks to METAR integration!

All directions above have been updated.

Barometric trend now assumes this:

Rising Rapidly = 1.4 hPa change or more per hour.
Rising Slowly = 0.7 to less than 1.4 hPa change per hour.
Normal (Steady) = Between 0.7 and -0.7 hPa change per hour.
Falling Slowly = -0.7 up to -1.4 hPa change per hour.
Falling Rapidly = -1.4 hPa change or more per hour.

Wind bearings more precise.

2013-06-21
Instead of using barometric pressure trend names, barometric trend values determined over three hours average are used converted to hPa:

Falling Rapidly means the pressure is falling at a rate of -1.20 hPa or faster.
Falling Slowly means the pressure is falling at a rate of -0.40 to -1.19 hPa.
Steady means the pressure is falling or rising no faster than a rate of less than -0.40/0.40 hPa.
Rising Slowly means the pressure is rising at a rate of 0.40 to 1.19 hPa.
Rising Rapidly means the pressure is rising at a rate of 1.20 hPa or faster.

The above should improve forecast performance.

The rain override is now set to 30 minutes instead of 15 minutes in case if the rainfall rate is slow.

2013-06-13
JavaScripts date and time represented in international standard date and time notation.

Foggy added as a Mostly Overcast current condition.

JavaScripts var bp has been changed from using the <#RCpress> webtag to using the <#altimeterpressure> webtag in order to bypass Davis Vantage Pro/Pro2 calculations of relative barometric pressure which use other factors in addition to altitude which can make the reading too low and result in an erroneous forecast. The <#altimeterpressure> webtag does the exact same thing as the <#press> webtag for non-Davis weather stations. It is represented as:

Code: Select all

var bp = parseFloat("<#altimeterpressure>".replace(",","."));
The (",",".") part replaces the decimal separator comma with a period.

2013-06-07
Fixed the diurnal variation of the barometer by moving the barometer trends of Rising Slowly and Falling Slowly to be seen as Steady/Normal. This should keep the forecast from switching so much. I had thought matching Rising Slowly and Falling Slowly between The Sager Weathercaster and Cumulus was the same but it is not.

Sager uses Rising Rapidly, Rising Slowly, Normal, Falling Slowly, and Falling Rapidly.

Cumulus uses Rising Very Rapidly, Rising Quickly, Rising, Rising Slowly, Steady, Falling Slowly, Falling, Falling Quickly, and Falling Very Rapidly.

The Sager has 5 dial positions for barometer trends. To make all of these match properly between Sager and Cumulus:

1) Rising Rapidly, Rising Very Rapidly, and Rising Quickly.
2) Rising.
3) Rising Slowly, Normal, Falling Slowly, and Steady.
4) Falling.
5) Falling Rapidly, Falling Quickly, and Falling Very Rapidly.

More info at viewtopic.php?p=82953#p82953

2013-06-05
The JavaScripts now assume it is Partly Cloudy if nothing is entered into the Current Condition Box.

Added km/h, kts (knot), and m/s wind speed readings to the forecast. These are determined by the wind unit selected in Cumulus.

Shortened the "bt-sager.js" file by using variables to determine certain arrays.

Localization directions added to this post.

2013-05-30
Thanks to steve, support for the new Cumulus webtag <#MinutesSinceLastRainTip> has been added. Now if you are away from your weather station, it will override the current condition forecast as a rain forecast if the rain sensor has been activated within the last 15 minutes.

Also added the longitude to the bt-sager-cu.js file to make finding a location easier.

2013-05-10
Thanks to steve, support for the new Cumulus GPS webtags which convert commas into periods has been added.

Added directions for other weather templates.

2013-05-07
Thanks to mcrossley, I added his suggestion of making some variables change automatically in the JavaScripts to lowercase letters to lessen the problem of having data being entered using proper capitalization.

I changed the Calm wind condition in bt-sager.js so that if it was Calm 3 hours ago and now the wind is blowing, the wind is seen as being Steady.

2013-05-05
Original release.
You do not have the required permissions to view the files attached to this post.
Last edited by Buford T. Justice on Sun 13 Dec 2020 6:20 am, edited 102 times in total.
bnwrx
Posts: 464
Joined: Wed 25 Feb 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by bnwrx »

I am trying your new forecaster, but I am getting "...Forecast Offline..." and not a forecast. This happened with a previous edition, but was later fixed...
Any ideas?
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice »

bnwrx wrote:I am trying your new forecaster, but I am getting "...Forecast Offline..." and not a forecast. This happened with a previous edition, but was later fixed...
Any ideas?
Looks like it is working fine to me on the website in your signature:

12-24 Hour Forecast:
Unsettled; No important change. Some tendency for slight increase in winds during day, diminishing in evening. East or Southeast winds.

http://woodlandweather.org/
http://woodlandweather.org/bt-sager-cu.js
http://woodlandweather.org/bt-sager.js
bnwrx
Posts: 464
Joined: Wed 25 Feb 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by bnwrx »

Buford T. Justice wrote:
bnwrx wrote:I am trying your new forecaster, but I am getting "...Forecast Offline..." and not a forecast. This happened with a previous edition, but was later fixed...
Any ideas?
Looks like it is working fine to me on the website in your signature:

12-24 Hour Forecast:
Unsettled; No important change. Some tendency for slight increase in winds during day, diminishing in evening. East or Southeast winds.

http://woodlandweather.org/
http://woodlandweather.org/bt-sager-cu.js
http://woodlandweather.org/bt-sager.js
Yes, it now appears OK. I was trying to use both of your scripts, but when I did, only one forecast showed so I deleted your "Zambretti" and its OK now.....
rich27gc
Posts: 75
Joined: Thu 08 Jul 2010 3:15 pm
Weather Station: WeatherDuino Pro2
Operating System: Raspbian
Location: Shap, Cumbria
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by rich27gc »

I'm trying the forecast and finding it very unreliable. I have the page refreshing every 5 mins, sometimes I get a forecast but the majority of the time I get ...Forecast Unavailable...

Below is the test page I've set up

http://www.shapweather.co.uk/cumulus/index10.htm
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice »

rich27gc wrote:I'm trying the forecast and finding it very unreliable. I have the page refreshing every 5 mins, sometimes I get a forecast but the majority of the time I get ...Forecast Unavailable...

Below is the test page I've set up

http://www.shapweather.co.uk/cumulus/index10.htm
JavaScript is a case sensitive language. You have "partly sunny" in your Current: box. That needs to be "Partly Sunny" as stated in the first post.

Because JavaScript is case sensitive, you found an error I had overlooked. I had created a strings.ini file for Cumulus and changed all the names to where the first letter is capitalized. Your barometer is "Falling slowly" and mine is "Falling Slowly" with a capital S. I added the default Cumulus names to the JavaScripts to correct for this so thanks for bringing that to my attention.

I also added a fix for Calm wind conditions.

Follow the directions in the first post again skipping the indexT.htm part. Redownload the .ZIP file and upload bt-sager.js to your website and save bt-sager-cu.js to your Cumulus/web folder.
Last edited by Buford T. Justice on Tue 07 May 2013 9:58 pm, edited 1 time in total.
rich27gc
Posts: 75
Joined: Thu 08 Jul 2010 3:15 pm
Weather Station: WeatherDuino Pro2
Operating System: Raspbian
Location: Shap, Cumbria
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by rich27gc »

Thanks, will give that a go tomorrow
User avatar
mcrossley
Posts: 13942
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by mcrossley »

You could make the comparisons case insensitive by using all lower case in your main scripts arrays and changing the bt-sager-cu.js to have entries such as (it may save a few headaches)...

var c = "<#currcond>".toLowerCase();
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice »

mcrossley wrote:You could make the comparisons case insensitive by using all lower case in your main scripts arrays and changing the bt-sager-cu.js to have entries such as (it may save a few headaches)...

var c = "<#currcond>".toLowerCase();
COOL! THANKS! That probably will save some headaches. I am still learning JavaScript.
rich27gc
Posts: 75
Joined: Thu 08 Jul 2010 3:15 pm
Weather Station: WeatherDuino Pro2
Operating System: Raspbian
Location: Shap, Cumbria
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by rich27gc »

That's working well now.

Thanks
User avatar
robynfali
Posts: 1076
Joined: Sat 31 Jul 2010 10:34 pm
Weather Station: Vantage Vue
Operating System: Windows XP
Location: Anglesey, North Wales, UK
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by robynfali »

That looks awesome, do you know how you might install it into the templates that Jacques makes, such as mine?
User avatar
Werk_AG
Posts: 198
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino 4Pro
Operating System: Windows 7
Location: Cercal CDV - Portugal
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG »

Does the script work with different time format than <#timeUTC format="m/d/yyyy h:nn:ss AM/PM"> UTC ?
In the way that script works, I think it will not be easy to use use it with other language than English, or I'm wrong?

Regards
Image
The freedom to choose the weather instruments you want
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice »

robynfali wrote:That looks awesome, do you know how you might install it into the templates that Jacques makes, such as mine?
Attach your indexT.htm or whatever template page you use and I will look at it.
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice »

Werk_AG wrote:Does the script work with different time format than <#timeUTC format="m/d/yyyy h:nn:ss AM/PM"> UTC ?
In the way that script works, I think it will not be easy to use use it with other language than English, or I'm wrong?

Regards
That command is there simply so I or the user knows the last time Cumulus updated the variables. UTC is universal so it makes no difference on the location.

The JavaScripts are in English, but you could translate the forecasts at the top of bt-sager.js on Lines 21-95 to whatever you want making sure not to remove the spaces, periods, or semicolons at the ends. For instance:

Code: Select all

	expected[0] = "Fair; ";
	expected[1] = "Fair and warmer; ";
	expected[2] = "Fair and cooler; ";
Could become:

Code: Select all

	expected[0] = "Justo; ";
	expected[1] = "Justo e aquecedor; ";
	expected[2] = "Justo e refrigerador; ";
Just be sure to leave the array names alone as I did above and keep the spaces, semicolons, quotes, periods, etc. the way they are.
User avatar
Werk_AG
Posts: 198
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino 4Pro
Operating System: Windows 7
Location: Cercal CDV - Portugal
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG »

Thanks for the info. I'm not aware of that...
Image
The freedom to choose the weather instruments you want
Post Reply