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.
A RSS Feed is available to help keep you informed on updates to the scripts.
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
and saratogaWXPHP Twitter account as they become available.
This page was updated
Tuesday, 19-Mar-2013 12:17 PM
PHP/AJAX Website Template Set - Meteobridge Setup
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 overall process is:
- Configure Meteobridge itself for your weather station hardware
- Make sure your weather website has the Base and MB-plugin contents uploaded and available
- Edit Settings.php to select desired units-of-measure and date format and upload to website.
- Configure Meteobridge Push Services FTP to upload MBtags.php
- (optional) Configure Meteobridge Push Services HTTP to create the MBrealtime.txt AJAX data file and MBrealtimegauges.txt Steel Series Gauges JSON data file.
- 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
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:
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 Push 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
where your.website.com is the host name of your weather website. The returned page should start with something like this:
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:|:
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
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 Push Services tab
Then tick the Expert Mode checkbox and press Save to enlarge the view to enable the options shown below.
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 Individual FTP Upload function shown in the panel below.
Fill in the following fields in the form:
- FTP Host:
- Enter the FTP address for your website (either the ftp.yourwebsite.com or IP address)
- Enter 21 as the default FTP port to use.
- Enter the FTP userid you use for FTP access to your website.
- Enter the FTP user password you use for FTP access to your website.
- Template#1 schedule:
- Select a schedule for the upload from the dropdown list. I recommend every 5 minutes for the MBtags.php uploads.
- Template#1 template URL:
- Enter the URL for the template generator on your website like:
(You had tested that
URL for proper function in the step shown above)
- Template#1 File:
- Enter MBtags.php as the file name for the uploaded file.
If you are NOT going to use the optional AJAX updates to your website, then press Save to activate the FTP upload now and you are done with configuration. Otherwise proceed to the next section (and do not press Save now).
Note: when Save is pressed, Meteobridge will restart data collection, and since the data is stored in RAM, some of the needed data will not be available until one hour after the restart. This will cause the Barometer Trend text and up/down arrows for temperature, humidity, dewpoint and barometer to not be displayed until one hour after data collection restarts. This is normal operation for Meteobridge.
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).
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 Push Services Expert page, click on the Individual HTTP Upload URL: text entry box and paste the text (ctrl-V) into the field.
Select a Send Interval (I suggest every 10 seconds),
Select a Success Condition: of 'success string' and type 'Success' in the following 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 Weather Network Status area.
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.