WU-UPLOAD(1) User Contributed Perl Documentation WU-UPLOAD(1) wu-upload.pl: Weather Underground Personal Weather Station Upload Script For Lacrosse WS23xx weather stations over serial device This script communications over a serial connection to a compatible LaCrosse Weather Station device, then formats that information and reports it to Weather Underground's ( http://www.wunderground.com ) Personal Weather Station data collection service. This script takes 5-10 seconds to run, most of that time is to obtain the response from serial port connected LaCrosse weather station. You can run this script as a Unix cron command once per minute. If you are using a wireless connection from the LaCrosse base station to the out- side devices, the base station will report 'weird' data when the wire- less connection is unstable, recent additions will prevent uploading of the inappropriate data. The perl/c + modules installed on FC7 x86 w/ standard development libraries, tested on usb-serial connection, as well as on Mac OS X 10.4 & 10.5 using the standard Perl install pulling the modules in via CPAN with the weather station connected over a KeySpan serial-to-USB con- verter. Unix Cron set-up Example cron entries to fire off uploads (expects this script installed in /usr/local/bin) with these scripts installed as a Unix service. They could also be installed under a user's cron with files located in a home directory, etc. Every minute: * * * * * /usr/local/bin/wu-upload.pl >> /var/log/wu-cron.log Every 5 minutes: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/wu-upload.pl >> /var/log/wu-log.log Control Variables Edit the following variables for testing: nosend - set to 1 to NOT send data (testing), normally to 0 to send data. verbose - set to 1 to send more information to standard out Edit the following variables for your connection to Weather Under- ground: rturl - Weather Underground URL for real-time updates id - Weather Underground Personal Weather Station Identification String passwd - Weather Underground Password for PWS ( NOTE: this is sent over HTTP as clear text) freq - Frequency of updates to Weather Underground [in seconds] Edit the following variables for files or devices on your computer: serial - path to the serial port device xmlLog - Path to XML encoded output '/var/log/wu.log'; Data Validation for Wireless connections The La Crosse 2317 Weather Station Pro has the capability of connecting to the outdoor instruments via a wireless connection, advertised as working up to 330 feet, however in my experience it can be dodgy at distances far less than the advertised maximum. When this wireless connection is not functioning this program receives bogus data from the base station over the serial line as there is no valid data from the outside instruments. The following have been observed from the La Crosse 2317 base station under these conditions: tempF='-22.0' dewPtF='-22.0' humidity='AA' or/and winddir='157.5' windspeedmph='114.1' I adding checking for those conditions as well as bounds checking checking for other values, either based on accepted values or extremes. In the event that the data is determined to be invalid, the parameter will not be reported to Weather Underground, however it will be logged, as will the detection of it being incorrect. Bounds wind speed positive number values from 0 to 113 mph, inclusive wind direction positive number values from 0 to 360 degrees, inclu- sive humidity positive number values from 0 to 100 percent, inclusive temperature and dew point report if humidity is valid and these do not both equal -22F dew point should not exceed the current temperature barometer allow values from 25-35 inHg, inclusive rain fall per hour allow values from 0 to 10"/hour inclusive (maximum recorded for my area is 7.5" per hour) Weather Underground Personal Weather Station Data collection Here is the preferred URL used for the real-time uploading of your col- lected weather data to Weather Underground (July 2008): http://rtupdate.wunderground.com/weatherstation/updateweathersta- tion.php If you go here without parameters you will get a brief usage): Here is the usage (July 2008) displayed with blank parameters: RapidFire Server usage action [action=updateraw] ID [ID as registered by wunderground.com] PASSWORD [PASSWORD registered with this ID] dateutc - [YYYY-MM-DD HH:MM:SS (mysql format)] winddir - [0-360] windspeedmph - [mph] windgustmph - [windgust mph] humidity - [%] tempf - [temperature F] rainin - [rain in] dailyrainin - [daily rain in accumulated] baromin - [barom in] dewptf - [dewpoint F] weather - [text] -- metar style (+RA) clouds - [text] -- SKC, FEW, SCT, BKN, OVC softwaretype - [text] ie: vws or weatherdisplay Credits Copyright GPL - original code K Brown 11/30/07 Contributed by Kenneth Brown 12/2007 Updated Bill Caloccia 20/07/2008 Device::LaCrosse::WS23xx by 2007 by Eduardo Santiago perl v5.8.6 2008-07-20 WU-UPLOAD(1)