-c /path/to/vanprod.conf This allows you to override the location of the configuration file. Defaults to /etc/vanprod.conf if not present.

-d Debug mode. This is intended only for short term diagnosis of problems you may be having. vanprod will become a daemon, but it will be EXTREMELY chatty in writing information into the syslog at the debug priority. You may also use this in conjuction with -t for initial testing and debugging.

-l Do not calculate or update loop ratio. See comments below or in vanprod.conf for details on this value. As of version 2.3 the daemon will calculate this value and keep it current in your configuration file unless you set this switch.

-n No database updates. vanprod will not try to load the DBI module or make any updates to a database. Text files as described below are not affected by this option.

-t Test mode. vanprod will not become a daemon. It will test for correct communication with the weather station, print the results on stdout and exit.

tty = /dev/ttyS1 This is the serial port where your weather station is connected.

facility = local0 This is the syslog facility that the daemon will use for messages. Make sure that what you put here is configured in your syslog.conf file.

directory = /some/path/to/weather This is the directory where the daemon will write the output files it generates. Details on these files and their contents are described below.

piddir = /var/run This is the directory where the daemon will write a file containing it's pid. The name of the file is vanprod.pid.

send_to_wu = 1 This defines whether or not to update weather underground. If this is set to 1 yes or true, vanprod will attempt to send data to weather underground in normal mode. If set to 2 or rapid, rapid fire updates will be enabled. Rapid fire will fork a persistent child process and send to weather underground every time the parent vanprod completes a data gathering loop. In other words an update is sent every $loop_ratio seconds. Any other values will be interpreted as false.

update_wu_min = 0,5,10,... This is a comma seperate list of the minutes past the hour that you wish to send an update to weatherunderground if you are using normal mode updates.

send_to_cwop = 1 Same as above, only for APRSWXNET/CWOP. If you are not familiar with what this is or would like info on signing up, see http://www.wxqa.com. APRSWXNET/CWOP does not support rapid fire mode.

update_cwop_min = 1 CWOP updates are now coded to occur every 10 minutes if you are sending to CWOP. This is in accordance with guidelines from the CWOP program. Set this to the value of the minute during each 10 when you should send your updates. Your update minute should be equal to the last digit in your CWOP ID. For hams, use your station ID assigned to you from MADIS. Example: My station ID is AR536, so my setting for this value would be 6. This will result in updates being sent to CWOP at 6, 16, 26, 36, 46, and 56 past the hour.

wu_id = MY_STATION Set this to your station id assigned to you by weather underground.

wu_password = mypassword Set this to your weather underground password.

cwop_password = -1 Your cwop password if you are a ham operator and have one. This password allows packets coming from licensed ham operators to be validated and passed on to an RF (amateur packet radio) network by an Igate. If you are a licensed ham and would like to enable the possibility for your weather data to be broadcast on a local packet radio network, set your passcode here. To obtain your passcode, you may send your callsign to russell.b.chadwick@noaa.gov, or I will be happy to provide this information for you. Again, just e-mail your callsign to me at stsander@sblan.net. (73 de N5KJT) Folks using a CW#### ID (i.e. non-hams) should leave this set to -1.

cwop0 cwop1 cwop2.....cwopN This is where you can set the order in which a connection attempt is made to the cwop servers.

lat = 1234.56Nlon = 12345.67W Your latitude and longitude. These are used for APRSWXNET/CWOP reports. The format for latitude is exactly 4 digits followed by a decimal then 2 digits followed by a hemisphere designator. The digits are ddmm.mm where d is degrees, m is minutes carried out to a resolution of 1/100th (.01) of a minute. Be sure to insert leading zeros as needed. The longitude is identical except there are 3 digits required for the degrees, so it becomes dddmm.mm. This follows the LORAN format if you wish to find more details. Note that the number of digits required is fixed so leading zeros are required for values less than 10 (or 100). ACME mapper appears to have the most accurate mapping of these values if you don't happen to have a GPS handy. If you make a format error (or change the format of the defaults) the daemon will write a warning in your syslog instead of sending to APRSWXNET/CWOP.

bar_offset = 0 This is the offset for the barometer expressed in millibars. (.01 inches of mercury = .338637526 millibars) This only affects calculations within the daemon and not the console. Any offset you have set on the console is ignored by the daemon and needs to be set here to be seen by the daemon.

sensor_exclude = 0 This variable allows you to temporarily disable a sensor or sensors from being included in updates sent to Weatherunderground and CWOP and stored in the RRDs. This variable is used as a bitmask to exclude the various sensors. The values for the sensors are as follows:

To exclude more than one sensor add the values for the sensors together. For example: To exclude Wind Speed and Direction set this to 12. To exclude Temperature and Humidity set it to 17. The setting of this variable only affects updates to WU, CWOP, and the RRDs. It has no impact on the text files written by the daemon or the values stored in the mysql database.

oldobs = 7 How many days old a dailyobs file should be to be deleted when a new day is started. Details on what this file contains are below. Note that this value will only be used when the daemon is running at midnight and starting a new day as part of it's own internal processes. If you would like to keep these files forever, you can set this to -1. The dailyobs file is typically between 70 and 75 KB for a 24 hour period.

db = mysql Type of database you want to use to store your daily extremes. The daemon will store the minimum and maximum values and the time they occurred in the database.

db_name = weather The name of the database to use.

db_user = stan Name of database user that can add records to the database you specified on the previous line.

db_password = mypassword Password for the database user described above.

db_table = reports Name of database table that contains the values we track and store. The following commands should set things up for you:

The routine that uploads this information to the database currently uses an sql insert command, so the ordering of the fields is important.

tid0 through tid7 This is where you can set up some meaningful strings for the up to 8 transmitters allowed with the wireless Vantage Pro.

alarm_interval = 300 This controls how often messages are written to syslog and any actions defined below are taken in the event of an alarm. This should be expressed in seconds as it will be internally adjusted by the loop ratio.

loop_ratio This the ratio of the number of passes through the data gathering loop to 1 second of real time. This value allows the daemon to more accurately track the values that are time based in some manner. There isn't much effect on shorter intervals like the average wind direction, but for longer intervals such as the barometer trend or 24 hour rainfall totals, the error introduced can be easily noticed. (OK, so maybe I'm a perfectionist.)

slow This should be set to an integer value that represents how many seconds you need to slow the daemon down. If your loop ratio is less than 1, I highly recommend that you set this to at least 1 so that the daemon will not make more than 1 loop per second. Running too fast may produce unpredictable performance.

*_q This is where you can set thresholds for the various "silent" alarms. These settings are independant of the alarms set on the Vantage Pro console.

alarm_action This is where you can define a script that vanprod will execute whenever an alarm threshold (silent or console) is crossed. This is in addition to messages that will be written to your syslog. Two arguments will be passed to this script, the designator for which value has triggered the alarm, and the current value. Example: for a low outdoor temperature alarm, the arguments passed would be low_outtemp value. The "designators" are simply the threshold variables without the _q on the end. If you have the 15 minute rainfall (flash flood) alarm set on your Vantage Pro console, when this triggers, it will be sent to your script with a designator of ff. Standard out and Standard error will be captured from this script, and any output that is captured will be written to your syslog.

Baud Rates

The factory default baud rate for the Vantage Pro weather station is 19200. If you need to use a different setting, you may change it in the Davis module source file, Davis.xs.

Signals

INT or TERM will cause the daemon to exit gracefully.

HUP Will cause the daemon to re-initialize. (re-read the values from vanprod.conf, the extremes file, and dump and reload it's stacks.

In most instances, the daemon collects the data provided by the weather station. Some values like wind chill, heat index, and dewpoint are not provided and the daemon calculates these for you. The daemon also checks the crc values on each packet received from the weather station, and if an error is detected, a notice level message is sent to the syslog and the packet is not processed. If an obviously out of range value is detected within the packet, a notice is sent to the syslog and that value is not processed or used in any calculations.

In the case of the barometric trend, the daemon will calculate this in order to determine the rate of rise or fall in the barometer, thus allowing you to set a silent alarm threshold. This information is provided by the Rev. B firmware, but it is ignored by the daemon. The daemon now forces a new barometer reading once per minute. This is the same as if you had pushed the BAR button on the console twice. The daemon now will calculate the altimeter setting from the pressure read from the console. This reading will be regarded by the daemon as the barometer value. While it is not meterologically correct to use these two interchangeably, the altimeter setting is what CWOP needs to receive and is also what you most commonly see on TV and most internet weather sites as the barometer reading. The daemon will write the SLP reading (which is what the console shows you on the display) into the RRDs and the dailyobs file so it will be available to you to use if you wish. In order for this to work, you MUST have your elevation set correctly in the console. This is contrary to my own reccommendation in previous versions of this software.

In the case of wind direction, it takes the degree reading from the weather station and translates it into a more human friendly form that will be written into the database and the current and extremes files. Examples: NE instead of 45 degrees, ESE instead of 105 degrees, etc. Also for internet site updates and for the daily obs file, it calculates the average direction of the wind during the last three minutes. The gust that is reported to internet sites is the highest wind speed observed since the previous report. The average wind speed is used as the basis for calculating the wind chill.

The daemon does it's own calculation for the rainfall rate even though this is provided by the weather station. I live in the Southwestern desert areas of the US, so this type of calculation makes sense for my climate. It isn't likely to be that big of a deal or make that much difference in an area that receives more precipitation. The calculation that I use does NOT require 2 "dumps" of the rain sensor within 15 minutes in order to register a rate like the rate provided on the console. It also will not jump ridiculously high if you have a shower that dumps the sensor several times in a short period and then ends 5 minutes later. I do record the rate from the console in the current observations file so it is available if you wish to use it. The data sent to the internet sites is the rate the daemon calculates, which is simply the actual amount of rain received in the previous 60 minutes, unless it is between midnight and 1 AM, then the rate reflects the amount of rain received since midnight.

Because the database updates and the correct function of the rainfall rate calculations depend on a close syncronization between the time on the weather station and the time on the computer system, the daemon will syncronize the weather station console time with the computer system time at noon each day.

The daemon also keeps track of the console and transmitter battery voltages and will write a notice to the syslog if the battery voltage drops too low. This message will repeat at a rate controlled by the $alarm_interval variable until the condition is corrected.

The daemon now monitors what I think are the common alarms that may be set on your console. You may also set silent versions of these alarms in the vanprod.conf file. The daemon will log a warning to your syslog when any alarms are triggered. These messages will continue at a rate controlled by the alarm_interval setting in vanprod.conf. The alarms monitored are: falling barometer, rising barometer, low indoor temperature, high indoor temperature, low indoor humidity, high indoor humidity, high rain rate, 15 minute rainfall (aka flash flood alarm), 24 hour rain total, storm total rainfall, low outdoor temperature, high outdoor temperature, wind gust, wind speed (average), low outdoor dewpoint, high outdoor dewpoint, high heat index, low wind chill.

The daemon will fork a child process to post the updates to internet sites and perform the database updates. If the fork calls fail, the daemon will still perform these functions, just in a single threaded manner. Note that a fork is done for weather underground rapid fire mode, and this child will persist as long as the parent daemon.

Leaf moisture, soil moisture, evapotranspiration, extra temperature and humidity readings from additional sensors, and alarms for these sensors are ignored. The daemon does collect solar radiation and UV index readings if present.

The daemon will generate 3 files and 5 RRDs in the directory that you specify in vanprod.conf. These files are intended for use by other scripts or programs as opposed to being human readable even though they are plain text files. This way tasks such as graphing or supplying information to a web page can be done independently of the daemon. A brief description of each file's name, and contents follows.

extremes.mm.dd.yyyy This file contains the minimum and maximum values observed for a day. The daemon always begins a new day at midnight. This file always contains a single line of comma seperated values in this order: minimum barometer and the time of observation, maximum barometer and the time of observation, minimum outdoor temp and time, maximum outdoor temp and time, maximum wind speed, direction and time, minimum outdoor humidity and time, maximum outdoor humidity and time, minimum outdoor dewpoint and time, maximum outdoor dewpoint and time, minimum wind chill and time, maximum heat index and time, maximum rainfall rate and time, and the daily rainfall and year to date rainfall totals, minimum indoor temp and time, maximum indoor temp and time, minumum indoor humidity and time, maximum indoor humidity and time, minimum indoor dewpoint and time, and maximum indoor dewpoint and time, 24 hour rainfall, 1 hour rainfall, maximum uv index and time, maximum solar radiation and time.

dailyobs.mm.dd.yyyy This file is appended to once per minute and contains the then current observations for that minute on a single line. The values are comma seperated and in the following order: hour, minute, barometer, outdoor temp, average wind speed, wind gust for the previous 60 seconds, the average direction, outdoor humidity, outdoor dewpoint, wind chill, heat index, indoor temp, indoor humidity, indoor dewpoint, daily rain amount, 1 hour rainfall, 24 hour rainfall, previous 15 minutes rainfall, uv index, solar radiation, SLP from the console.

Below is a translation of the forecast rule number to the text messages displayed on the Vantage Pro console. Only the rule number is recorded in the current observations file. Thanks to Tim Miller for providing these and doing some work on the forecast rule captures.

Here is a listing of the forecast icon numbers. Note that I only list each icon component. Add the values together to get the various icon combinations. (Example 3 = Cloud with rain 1 (rain) + 2 (cloud) = 3)

The daemon now utilizes round robin databases via rrdtool that is built with --enable-perl-site-install passed at compile time. If your distro did not build rrdtool that way, then you will need to add 'use lib qw(path/to/rrdtool/lib/perl)' to the daemon code. If your rrdtool was built with --disable-perl then it does you no good and you will need to get a different installation of rrdtool. This utility is very useful for time based observations and comes with toolkits for querying the contents of the rrd and creating graphics on the fly. See http://www.rrdtool.org for information on this utility and to download it if your distro doesn't provide a handy copy for you. Five round robin databases will be created in the daemon's working directory, wind.rrd, indoor.rrd, outdoor.rrd, barometer.rrd, and rain.rrd. Wind.rrd contains the wind speed, gust, and the basic elements required to determine an average wind direction, which are the sine and cosine values of the wind direction expressed in radians. It does not contain a wind direction value expressed in degrees. The reason behind this is so that when the RRD does the averaging in order to cover the longer time windows offered these averages will still represent the wind direction correctly. For those not already familiar with how RRDs work to generate graphs, the following is an example of how to extract the sine and cosine values from the winddir RRD and have it expressed as a direction in degrees on a graph. This is not a complete working example, only four of the required statements. Refer to the rrdtool documentation for further info.

Indoor.rrd and outdoor.rrd contain temperature, humidity, and dewpoint, and outdoor.rrd also adds heat index and wind chill. Barometer.rrd contains the current barometer and SLP readings, and rain.rrd contains rainfall for the past hour, since midnight, current month, and year to date. Each of the rrds are updated every 60 seconds and retain all of the values fed into them from the previous seven days. As time goes by the resolution on the data points drops from 60 seconds (the inital seven days) to five minute averages (day 8 through 30) to one hour averages (days 31 through 60) to 12 hour averages (days 61 through 90) to 24 hour averages (days 91 through 180). The rain.rrd works differently in that it keeps the values for 180 days and does not do any averaging. If you would like to change the behavior of the RRDs, you will need to edit the code prior to the RRDs being created. Thanks to David Gabler for providing a patch that included the initial support for RRDs, though I went a slightly different direction with this implementation.

1.1 Added monitoring for the console battery level.
Added monitoring of indoor temperature, humidity, and dewpoint.
Added sanity checking for values that are obviously out of range.

1.2 Improved sanity checks for out of range values.
Integrated work done by Tim Miller on barometric trend and forecast rules.
Calculate the barometric trend for stations with Rev. A firmware. (auto-detected)
Added monitoring for the various transmitter battery levels for wireless stations.
Modified the wind chill calculation to follow the formula and guidelines from the NWS. (I had left some cruft in the code from the earliest days of the program.)
Added alarm bit processing.
The storm total rainfall and storm start date are now recorded.

2.0 Added updates to APRSWXNET/CWOP.
Some minor bug fixes.
Tracking of rainfall in the past 1 and 24 hours.
Switched to using a vanprod.conf file, changed the behavior of a HUP signal and added handling of USR1 signal.
The daemon no longer sets the heat index and wind chill values to the outdoor temp. If these values should not be defined according to NWS formulas they are set to -- be aware of this if you parse any of the generated files. Also you may need to modify your database specs for those two columns.
Added silent alarm capability.
Added capability to call an external script in response to an alarm.
Added loop ratio to increase accuracy of some calculated values.
Added daily rain amount to dailyobs file.
Added rainfall rate from the console to current obs file.
Improved average wind direction calculation

2.0.1 Some minor tweaks and bug fixes. Mostly in the APRSWXNET/CWOP message formatting.

2.1 Added 1 hour and 24 hour rainfall totals to dailyobs file.
Some tweaks on the barometer trend calculation. The console actually tracks the barometer to a resolution of .001 and vanprod now does the same. The data written to the files is now carried out to .001 but the database value still has a .01 resolution.
Improved the intelligence for rolling over to the next APRSWXNET/CWOP server in the event that one or more of them are down.
Fixed bug where daily rain and max rate values were being set to the previous day's rain total at midnight but correct the rest of the day.
Fixed bug where 1 and 24 hour rain totals would not be completely zeroed out if the rain originally fell in a heavy downpour.

2.3 Calculate the average wind speed using the same method as NWS ASOS stations, added -w switch to avoid this and use average from console.
Automatically calculate and internally update the loop ratio and keep the current value in the configuration file. Changed the behavior of -l so that when that switch is present, the loop ratio is read from the configuration file and never calculated or updated by the daemon.
Changed behaviour of HUP signal and removed USR1 signal.
Withdrew support for cwop tier 2 servers following their abrupt pulling out of the CWOP network. Connections are now made on port 14580 to one of the APRSWXNET/CWOP core servers. You will need to update your vanprod.conf file to include rotate.aprs.net, first.aprs.net, second.aprs.net, and third.aprs.net. The daemon fails over to the next in the list if one is not working or responding correctly.

2.4 Added support for using RRDs. Calculate altimeter setting from station pressure and use this as barometer. Added tracking of Sea Level Pressure reading provided directly from the console. Changed CWOP packet upload to every 10 minutes, user can choose 0-9 for the final digit of the minute to send. Weatherunderground uploads are now done by listing the minutes you wish to have an upload occur. Added support for excluding sensor readings from updates sent to WU and CWOP as well as the recording of those readings in the RRDs.

2.4.2 Bugfix for division by 0 error in average wind speed calculation. Apparently this was caused by not actually closing the stack file in the stack_dump routine. Also corrected value in division statement to compensate for the array counting from 0 instead of 1. No longer require LWP module unless W.U. submissions are enabled. Added some logging to the stack dump and load_value routines. Added -s option for sending sea level pressure to WU instead of altimeter. Added backoff sleep routine that will cause the daemon to exit if too many out of range values are encountered. This way if the daemon loses contact with the console because of a hardware issue or other abnormality such as two instances trying to run at the same time, it will exit instead of filling the log file or worse yet an entire disk/partition with errors. Added logic to prevent WU rapid fire updates at less than 2.5 second intervals. Added logic to ensure loop ratio can be kept > 1.

2.5 Bugfixes and tweaks in barometer reading routine and division by 0 error if humidity is ever reported as 0. Logging tweaks in the CWOP sending section. Also some improved logic for catching a condition where the daemon and console get out of sync causing the daemon to continiously think it is receiving bad data.

This daemon is written to communicate with a Davis Vantage Pro Weather Staion.

It will store the daily extreme values and their time of occurance in a database and update the weather underground and/or APRSWXNET/CWOP at a user configurable interval between once per hour and once per minute, or you can disable this feature altogether.

It will generate 3 comma seperated text files and 5 RRDs as it runs. These files are intended for use by other scripts.

It has the ability to call an external script in response to a user set weather alarm either on the station console or within the conf file settings.

Create a script to start the daemon for you at boot. Modify the vanprod.conf file to suit your preferences and needs.

UPGRADING FROM PREVIOUS VERSIONS

To upgrade from a 0.x or 1.0 version: Beginning with version 1.1, you will need to modify the database table if you have been using that feature in any of the 0.x or 1.0 versions. You will need to add columns for the minimum and maximum indoor temperature, humidity, and dewpoint as well as the time of occurance for each. See the section on the database setup for additional details.

Upgrading from 1.x to 2.0: In addition to the steps above, (if applicable) you will need to obtain the vanprod.conf file along with the daemon itself and modify the settings in that file to suit your needs. You may need to modify your database table from int(3) to char(3) for the wind chill and heat index values.

Upgrading from 2.0 to 2.2 In addition to the steps above, you will need to modify your database table since max_uv, max_uv_time, max_srad, and max_srad_time have been added. A side effect of forcing the barometer to update once per minute required the entire timing of data retrival loop to be slowed. The daemon will now run at about half the speed of previous versions. Be sure to change your loop ratio when you begin using 2.2 and have the daemon calculate a new ratio for you. I recommend that you double your current loop ratio as a starting point.

Upgrading from 2.2 to 2.3 You will need to update your vanprod.conf file to include first.aprs.net, second.aprs.net, and third.aprs.net instead of the previously supported tier2 servers. The tier 2 server ops abruptly decided to pull out from the the APRSWXNET/CWOP network apparently to prove a point following a discussion on the CWOP weather quality mailing list. It is not necessary to use rotate.aprs.net since the software will automatically fail over to the next server should one of them not respond in an appropiate manner.

Upgrading from 2.3 to 2.4.x Support for RRDs has been added. You will need a suitable installation of rrdtool or run with the -r option. A new variable $slp for Sea Level Pressure has been added. This is what is provided by the console when your elevation is set to < > 0. The daemon now calculates the altimeter setting from the station pressure and uses that value as the barometer value. While this is not meterologically correct, it is in keeping with common practices to use the two interchangeably. This will require you to have your elevation set correctly in the console. You should remove num_updates from your vanprod.conf file and add update_wu_min, update_cwop_min and sensor_exclude. See above for details on these variables.

Copyright 2004 - 2010 by Stan Sander, N5KJT. stsander@sblan.net You are welcome to send me any requests for new features or enhancements, and of course bug reports. If you like the software and would like to support my development efforts, please consider a donation via paypal. Even if you are unable or decide not to donate, you are welcome to use the software. Donations are not required as part of the license. Vanprod is free software. You may redistribute it and/or modify it under the terms of the Perl Artistic License available at http://dev.perl.org/licenses/artistic.html

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.