deformed-offering

Free Weather Website Templates

They're free, but use at your own risk

The scripts referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular weather station website.
RSS feed for Scripts Updates A RSS Feed is available to help keep you informed on updates to the scripts.

Many of these scripts are now available on GitHub at https://github.com/ktrue

Buy Me A Coffee If you find one or more of the scripts useful to you, please consider making a donation to help offset the routine expenses of operation of this website.
Thanks for your kind support!

A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier. Announcements of version updates and new scripts are made on WXForum.net and Weather-Watch forums and saratogaWXPHP Twitter account as they become available.

Note: Twitter widget has been disabled 3-Jul-2023 since it no longer displays the recent update Tweets.

This page was updated Monday, 05-Oct-2020 5:17 PM

PHP/AJAX Website Template Set - Meteobridge Setup

Overview

Note: Since Meteobridge must load the template file(s) from a working website, you will need to have uploaded the Base and MB-plugin files to your weather website before you start the Meteobridge weather tags/realtime update customization listed below.
The below instructions are for Meteobridge V4.x. If you have an older Meteobridge, use this page for configuration instead.

The overall process is:

  1. Configure Meteobridge itself for your weather station hardware
  2. Make sure your weather website has the Base and MB-plugin contents uploaded and available
  3. Edit Settings.php to select desired units-of-measure and date format and upload to website.
  4. Configure Meteobridge Push Services FTP to upload MBtags.php
  5. (optional) Configure Meteobridge Push Services HTTP to create the MBrealtime.txt AJAX data file and MBrealtimegauges.txt Steel Series Gauges JSON data file.
  6. Check for proper uploads of MBtags.php (and optional MBrealtime.txt, MBrealtimegauges.txt files)

1. Configure Meteobridge for your weather station

Setup instructions for Meteobridge software are available at
http://www.meteobridge.com/wiki/index.php/Main_Page

Before moving to the next setup step here, make sure your Meteobridge software setup is complete, and the Live Data page shows data from your sensors displayed on the page such as shown below:

Live Data Sensor display

2. Check your weather website for Base+MB-plugin upload

Using your browser, load http://your.website.com/wxindex.php and see that the page displays (with old, sample data in F,mph,inHg,in units). The data values are not important at this time; The important thing is that the sample data is displayed to indicate that the (uncustomized) website template structure is fully available on your website.

3. Set station units-of-measure in Settings.php

Edit the Settings.php file for your website and locate the section that has:

###########################################################################
# These values should reflect the units-of-measure your weather station
# uses to report the weather data when processing weather tags.
# Note: if you change them here, make sure to make the corresponding
#   changes in the ajax[WXname]wx.js AJAX script also.
###########################################################################

$SITE['WDdateMDY'] = true; // for date format of month/day/year.  =false for day/month/year

$SITE['uomTemp'] = '°F';  // ='°C', ='°F'
$SITE['uomBaro'] = ' inHg';   // =' hPa', =' mb', =' inHg'
$SITE['uomWind'] = ' mph';    // =' km/h', =' kts', =' m/s', =' mph'
$SITE['uomRain'] = ' in';     // =' mm', =' in'
  

Adjust each setting to your prefered units using the allowed values shown in the comment on each line. Then save and upload the modified Settings.php to your website. You do not need to change other settings in this file at this time -- the above values are used in the next steps of this configuration.

4a. Use Meteobridge FTP Services to generate MBtags.php

First test that you have done the above customization and all needed files are available on your website by using your browser to view

http://your.website.com/gen-MBtags.php

where your.website.com is the host name of your weather website. The returned page should start with something like this:

<?php
/*
 File: MBtags.php

 Purpose: load Meteobridge variables into a $WX[] array for use with the Canada/World/USA template sets
 NOTE: this file must be processed by Meteobridge as a template file and uploaded to the website
   as MBtags.php using the Meteobridge extended Push Services configuration.

 Author: Ken True - webmaster at saratoga-weather.org

 (created by gen-MBtags.php - V1.00 - 04-Mar-2013)

 These tags generated on 2013-03-08 02:03:17 GMT
   From MBtags-template.txt updated 2013-03-04 05:03:39 GMT

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

   ...

WXsoftware = 'MB';  
$defsFile = 'MB-defs.php';  // filename with $varnames = $WX['MB-varnames']; equivalents
 
$rawdatalines = '
date|[YYYY]-[MM]-[DD]|// local date:|:
time|[hh]:[mm]:[ss]|// local time:|:
dateUTC|[UYYYY]-[UMM]-[UDD]|// UTC date:|:
timeUTC|[Uhh]:[Umm]:[Uss]|// UTCtime:|:
uomTemp|°F|// UOM temperature:|:
uomWind| mph|// UOM wind:|:
uomBaro| inHg|// UOM barometer:|:
uomRain| in|// UOM rain:|:

   ...

If it does, then you are ready to configure Meteobridge Push Services panel. Using your browser, access the Meteobridge control panel by using

http://192.168.1.109/cgi-bin/meteobridge.cgi

as the URL (the 192.168.1.109 should be replaced with the IP address of your Meteobridge system on your local network.

After logging in to Meteobridge if needed, click on the Services, Events tab

Push Services basic tab

Under New, select FTP Upload, Periodical and press Add Service Event to see a new FTP Event.

FTP Setup Event

Fill in the details like the above example with:
Template pointing to the gen-MBtags.php script on your website, the interval (5 minutes recommended), and the Path for the file.
Please note that the Path(File) may have to include additional directories to end up properly in the document root of your website (depends on the default root for your FTP userid). You may need to use public_html/MBtags.php or httpdocs/MBtags.php instead of just the plain filename. Press Save to complete the entry.

 

4b. Setup for FTP upload of MBtags.php

The majority of the weather data displayed on your website from your weather station will be from the Meteobridge weather tags uploaded to your website through the Services, Service Settings FTP/SFTP settings shown in the panel below.

Push Services FTP

Fill in the following fields in the form:

Host:
Enter the FTP address for your website (either the ftp.yourwebsite.com or IP address)
Port:
Enter 21 as the default FTP port to use.
User:
Enter the userid you use for FTP access to your website.
Password:
Enter the user password you use for FTP access to your website.
 

5. Setup of optional AJAX updates using HTTP upload

Using Notepad (or other ASCII text editor), open the MBrealtime-template.txt file (which should be in the document root of your website).

Editing MB-realtime-template.txt

Change the your.website.com highlighted above to the actual URL of your website and do a File, Save.

Do a Edit, Select All, and Edit, Copy to copy the contents of the file to the clipboard, and you can close the file now.

In your browser showing the Services, Events tab, select HTTP Request, Periodical and press Add Service Event.

Service Events HTTP

 

Push Services - HTTP realtime


Select a HTTP interval (I suggest every 10 seconds),
In URL: text entry box and paste the text (ctrl-V) into the field.
In Success: type 'Success' in the text entry box.

Press Save at the bottom of the page to activate.

6. Check website for working upload function

Your MBtags.php should be visible at http://your.website.com/MBtags.php?sce=dump and show current date/time like this sample:

// $WX[] array size = 493 entries.
$WX['date'] = '2013-03-08'; // local date
$WX['time'] = '09:27:57'; // local time
$WX['dateUTC'] = '2013-03-08'; // UTC date
$WX['timeUTC'] = '17:27:57'; // UTCtime
$WX['uomTemp'] = '°F'; // UOM temperature
$WX['uomWind'] = 'mph'; // UOM wind
$WX['uomBaro'] = 'inHg'; // UOM barometer
$WX['uomRain'] = 'in'; // UOM rain
$WX['th0temp-act'] = '50.5'; // outdoor temperature most recent
  ...

If you elected to use the AJAX realtime updates above, then your MBrealtime.txt file at http://your.website.com/MBrealtime.txt should show current date/time like this sample:

08/03/2013 09:33:33 10.6 87 8.5 0.4 0.0 21.0 0.0 2.8 1012.3 NNE 0 m/s C hPa mm -- 0.30 ...

The date setting in MBrealtime.txt is always in dd/mm/yyyy format and the time in 24hr time. The units are always in C,m/s,hPa,mm as the AJAX script converts to your prefered units-of-measure for display.

Note: on some website hosters, you may need to set permissions on MBrealtime.txt and MBrealtimegauges.txt to 666 to enable the file to be written by the conds.php program.

The Status of the FTP/HTTP upload is shown on the Live Data Meteobridge page in the Upload Status tab.

Live Data FTP/HTTP Status

If an error is encountered by the HTTP upload, it will show the error message(s) instead of 'Success!' in the HTTP Upload: line above.
The common issue is a file permissions problem which can usually be remedied by manually setting the permissions on MBrealtime.txt and MBrealtimegauges.txt to 666 so the conds.php script can write the files.

With V1.03 of conds.php, the JSON file (MBrealtimegauges.txt) needed to drive the Steel Series gauges by Mark Crosley is also generated along with the MBrealtime.txt file needed for the ajaxMBwx.js AJAX script to update some of the conditions on your website. The Steel Series gauges will need to be installed separately on your website and the wxssgauges.php main page customized in order to show the gauges.

deformed-offering