NAME

vanprod - Perl daemon to communicate with a Davis Vantage Pro weather station.


SYNOPSIS

vanprod [ -c <path/to/vanprod.conf> -dlnrstw ]


DESCRIPTION

-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.

-r Do not use round robin databases.

-s Send reduced Sea Level Pressure to Weather Underground instead of altimeter.

-w Use console provided average wind speed. Without this switch, the daemon will calculate it's own average wind speed over a period of 90 seconds.


vanprod.conf file

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.

callsign = CW9999 Your ham callsign or CWOP ID for APRSWXNET/CWOP. Use upper case in the value.

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.56N lon = 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:

  1 = Outdoor Temperature
  2 = Barometer
  4 = Wind Speed
  8 = Wind Direction
 16 = Outdoor Humidity
 32 = Rainfall

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:

   mysql> CREATE TABLE `reports` (
   `date` DATE NOT NULL ,
   `hi_temp` INT( 3 ) ,
   `hi_temp_time` TIME,
   `lo_temp` INT( 3 ) ,
   `lo_temp_time` TIME,
   `peak_wind` INT( 3 ) ,
   `peak_direct` CHAR( 3 ) ,
   `peak_time` TIME,
   `min_wind_chill` CHAR( 3 ) ,
   `wind_chill_time` TIME,
   `year_rain` DECIMAL( 4, 2 ) ,
   `max_rain_rate` DECIMAL( 4, 2 ) ,
   `max_rain_time` TIME,
   `max_barometer` DECIMAL( 4, 2 ) ,
   `max_press_time` TIME,
   `min_barometer` DECIMAL( 4, 2 ) ,
   `min_press_time` TIME,
   `max_humid` INT( 3 ) ,
   `max_humid_time` TIME,
   `min_humid` INT( 3 ) ,
   `min_humid_time` TIME,
   `max_dew` INT( 3 ) ,
   `max_dew_time` TIME,
   `min_dew` INT( 3 ) ,
   `min_dew_time` TIME,
   `max_heat_index` CHAR( 3 ) ,
   `heat_index_time` TIME,
   `daily_rain` DECIMAL( 4, 2 ) ,
   `max_intemp` INT( 3 ) ,
   `max_intemp_time` TIME ,
   `min_intemp` INT( 3 ) ,
   `min_intemp_time` TIME ,
   `max_inhumid` INT( 3 ) ,
   `max_inhumid_time` TIME,
   `min_inhumid` INT( 3 ) ,
   `min_inhumid_time` TIME,
   `max_indew` INT( 3 ) ,
   `max_indew_time` TIME,
   `min_indew` INT( 3 ) ,
   `min_indew_time` TIME,
   `max_uv` CHAR( 3 ) ,
   `max_uv_time` TIME,
   `max_srad` CHAR( 5 ) ,
   `max_srad_time` TIME,
   PRIMARY KEY ( `date` )
   );

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.


Operational Characteristics

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.

currentobs.mm.dd.yyyy This file contains the following values from the most recent sample read from the station. The values are on a single line and comma seperated in the order listed: Hour of the day, minute, and second, barometer reading, outdoor temp, average wind speed, current wind speed, direction, outdoor humidity, outdoor dewpoint, wind chill, heat index, rainfall rate, daily rain, month to date rain, year to date rain, sunrise, sunset, indoor temp, indoor humidity, indoor dewpoint, barometric trend, forecast icon, forecast rule, storm start date, storm total rainfall, previous 24 hours rainfall, previous 1 hour rainfall,rainfall rate on the console, previous 15 minutes rainfall, uv index, solar radiation,SLP from the console.

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.

   0 = "Mostly clear and cooler."
   1 = "Mostly clear with little temperature change."
   2 = "Mostly clear for 12 hours with little temperature change."
   3 = "Mostly clear for 12 to 24 hours and cooler."
   4 = "Mostly clear with little temperature change."
   5 = "Partly cloudy and cooler."
   6 = "Partly cloudy with little temperature change."
   7 = "Partly cloudy with little temperature change."
   8 = "Mostly clear and warmer."
   9 = "Partly cloudy with little temperature change."
  10 = "Partly cloudy with little temperature change."
  11 = "Mostly clear with little temperature change."
  12 = "Increasing clouds and warmer. Precipitation possible within 24 to 48 hours."
  13 = "Partly cloudy with little temperature change."
  14 = "Mostly clear with little temperature change."
  15 = "Increasing clouds with little temperature change. Precipitation possible within 24 hours."
  16 = "Mostly clear with little temperature change."
  17 = "Partly cloudy with little temperature change."
  18 = "Mostly clear with little temperature change."
  19 = "Increasing clouds with little temperature change. Precipitation possible within 12 hours."
  20 = "Mostly clear with little temperature change."
  21 = "Partly cloudy with little temperature change."
  22 = "Mostly clear with little temperature change."
  23 = "Increasing clouds and warmer. Precipitation possible within 24 hours."
  24 = "Mostly clear and warmer. Increasing winds."
  25 = "Partly cloudy with little temperature change."
  26 = "Mostly clear with little temperature change."
  27 = "Increasing clouds and warmer. Precipitation possible within 12 hours. Increasing winds."
  28 = "Mostly clear and warmer. Increasing winds."
  29 = "Increasing clouds and warmer."
  30 = "Partly cloudy with little temperature change."
  31 = "Mostly clear with little temperature change."
  32 = "Increasing clouds and warmer. Precipitation possible within 12 hours. Increasing winds."
  33 = "Mostly clear and warmer. Increasing winds."
  34 = "Increasing clouds and warmer."
  35 = "Partly cloudy with little temperature change."
  36 = "Mostly clear with little temperature change."
  37 = "Increasing clouds and warmer. Precipitation possible within 12 hours. Increasing winds."
  38 = "Partly cloudy with little temperature change."
  39 = "Mostly clear with little temperature change."
  40 = "Mostly clear and warmer. Precipitation possible within 48 hours."
  41 = "Mostly clear and warmer."
  42 = "Partly cloudy with little temperature change."
  43 = "Mostly clear with little temperature change."
  44 = "Increasing clouds with little temperature change. Precipitation possible within 24 to 48 hours."
  45 = "Increasing clouds with little temperature change."
  46 = "Partly cloudy with little temperature change."
  47 = "Mostly clear with little temperature change."
  48 = "Increasing clouds and warmer. Precipitation possible within 12 to 24 hours."
  49 = "Partly cloudy with little temperature change."
  50 = "Mostly clear with little temperature change."
  51 = "Increasing clouds and warmer. Precipitation possible within 12 to 24 hours. Windy."
  52 = "Partly cloudy with little temperature change."
  53 = "Mostly clear with little temperature change."
  54 = "Increasing clouds and warmer. Precipitation possible within 12 to 24 hours. Windy."
  55 = "Partly cloudy with little temperature change."
  56 = "Mostly clear with little temperature change."
  57 = "Increasing clouds and warmer. Precipitation possible within 6 to 12 hours."
  58 = "Partly cloudy with little temperature change."
  59 = "Mostly clear with little temperature change."
  60 = "Increasing clouds and warmer. Precipitation possible within 6 to 12 hours. Windy."
  61 = "Partly cloudy with little temperature change."
  62 = "Mostly clear with little temperature change."
  63 = "Increasing clouds and warmer. Precipitation possible within 12 to 24 hours. Windy."
  64 = "Partly cloudy with little temperature change."
  65 = "Mostly clear with little temperature change."
  66 = "Increasing clouds and warmer. Precipitation possible within 12 hours."
  67 = "Partly cloudy with little temperature change."
  68 = "Mostly clear with little temperature change."
  69 = "Increasing clouds and warmer. Precipitation likley."
  70 = "Clearing and cooler. Precipitation ending within 6 hours."
  71 = "Partly cloudy with little temperature change."
  72 = "Clearing and cooler. Precipitation ending within 6 hours."
  73 = "Mostly clear with little temperature change."
  74 = "Clearing and cooler. Precipitation ending within 6 hours."
  75 = "Partly cloudy and cooler."
  76 = "Partly cloudy with little temperature change."
  77 = "Mostly clear and cooler."
  78 = "Clearing and cooler. Precipitation ending within 6 hours."
  79 = "Mostly clear with little temperature change."
  80 = "Clearing and cooler. Precipitation ending within 6 hours."
  81 = "Mostly clear and cooler."
  82 = "Partly cloudy with little temperature change."
  83 = "Mostly clear with little temperature change."
  84 = "Increasing clouds with little temperature change. Precipitation possible within 24 hours."
  85 = "Mostly cloudy and cooler. Precipitation continuing."
  86 = "Partly cloudy with little temperature change."
  87 = "Mostly clear with little temperature change."
  88 = "Mostly cloudy and cooler. Precipitation likely."
  89 = "Mostly cloudy with little temperature change. Precipitation continuing."
  90 = "Mostly cloudy with little temperature change. Precipitation likely."
  91 = "Partly cloudy with little temperature change."
  92 = "Mostly clear with little temperature change."
  93 = "Increasing clouds and cooler. Precipitation possible and windy within 6 hours."
  94 = "Increasing clouds with little temperature change. Precipitation possible and windy within 6 hours."
  95 = "Mostly cloudy and cooler. Precipitation continuing. Increasing winds."
  96 = "Partly cloudy with little temperature change."
  97 = "Mostly clear with little temperature change."
  98 = "Mostly cloudy and cooler. Precipitation likely. Increasing winds."
  99 = "Mostly cloudy with little temperature change. Precipitation continuing. Increasing winds."
 100 = "Mostly cloudy with little temperature change. Precipitation likely. Increasing winds."
 101 = "Partly cloudy with little temperature change."
 102 = "Mostly clear with little temperature change."
 103 = "Increasing clouds and cooler. Precipitation possible within 12 to 24 hours possible wind shift to the W, NW, or N."
 104 = "Increasing clouds with little temperature change. Precipitation possible within 12 to 24 hours possible wind shift to the W, NW, or N."
 105 = "Partly cloudy with little temperature change."
 106 = "Mostly clear with little temperature change."
 107 = "Increasing clouds and cooler. Precipitation possible within 6 hours possible wind shift to the W, NW, or N."
 108 = "Increasing clouds with little temperature change. Precipitation possible within 6 hours possible wind shift to the W, NW, or N."
 109 = "Mostly cloudy and cooler. Precipitation ending within 12 hours possible wind shift to the W, NW, or N."
 110 = "Mostly cloudy and cooler. Possible wind shift to the W, NW, or N."
 111 = "Mostly cloudy with little temperature change. Precipitation ending within 12 hours possible wind shift to the W, NW, or N."
 112 = "Mostly cloudy with little temperature change. Possible wind shift to the W, NW, or N."
 113 = "Mostly cloudy and cooler. Precipitation ending within 12 hours possible wind shift to the W, NW, or N."
 114 = "Partly cloudy with little temperature change."
 115 = "Mostly clear with little temperature change."
 116 = "Mostly cloudy and cooler. Precipitation possible within 24 hours possible wind shift to the W, NW, or N."
 117 = "Mostly cloudy with little temperature change. Precipitation ending within 12 hours possible wind shift to the W, NW, or N."
 118 = "Mostly cloudy with little temperature change. Precipitation possible within 24 hours possible wind shift to the W, NW, or N."
 119 = "Clearing, cooler and windy. Precipitation ending within 6 hours."
 120 = "Clearing, cooler and windy."
 121 = "Mostly cloudy and cooler. Precipitation ending within 6 hours. Windy with possible wind shift to the W, NW, or N."
 122 = "Mostly cloudy and cooler. Windy with possible wind shift o the W, NW, or N."
 123 = "Clearing, cooler and windy."
 124 = "Partly cloudy with little temperature change."
 125 = "Mostly clear with little temperature change."
 126 = "Mostly cloudy with little temperature change. Precipitation possible within 12 hours. Windy."
 127 = "Partly cloudy with little temperature change."
 128 = "Mostly clear with little temperature change."
 129 = "Increasing clouds and cooler. Precipitation possible within 12 hours, possibly heavy at times. Windy."
 130 = "Mostly cloudy and cooler. Precipitation ending within 6 hours. Windy."
 131 = "Partly cloudy with little temperature change."
 132 = "Mostly clear with little temperature change."
 133 = "Mostly cloudy and cooler. Precipitation possible within 12 hours. Windy."
 134 = "Mostly cloudy and cooler. Precipitation ending in 12 to 24 hours."
 135 = "Mostly cloudy and cooler."
 136 = "Mostly cloudy and cooler. Precipitation continuing, possible heavy at times. Windy."
 137 = "Partly cloudy with little temperature change."
 138 = "Mostly clear with little temperature change."
 139 = "Mostly cloudy and cooler. Precipitation possible within 6 to 12 hours. Windy."
 140 = "Mostly cloudy with little temperature change. Precipitation continuing, possibly heavy at times. Windy."
 141 = "Partly cloudy with little temperature change."
 142 = "Mostly clear with little temperature change."
 143 = "Mostly cloudy with little temperature change. Precipitation possible within 6 to 12 hours. Windy."
 144 = "Partly cloudy with little temperature change."
 145 = "Mostly clear with little temperature change."
 146 = "Increasing clouds with little temperature change. Precipitation possible within 12 hours, possibly heavy at times. Windy."
 147 = "Mostly cloudy and cooler. Windy."
 148 = "Mostly cloudy and cooler. Precipitation continuing, possibly heavy at times. Windy."
 149 = "Partly cloudy with little temperature change."
 150 = "Mostly clear with little temperature change."
 151 = "Mostly cloudy and cooler. Precipitation likely, possibly heavy at times. Windy."
 152 = "Mostly cloudy with little temperature change. Precipitation continuing, possibly heavy at times. Windy."
 153 = "Mostly cloudy with little temperature change. Precipitation likely, possibly heavy at times. Windy."
 154 = "Partly cloudy with little temperature change."
 155 = "Mostly clear with little temperature change."
 156 = "Increasing clouds and cooler. Precipitation possible within 6 hours. Windy."
 157 = "Increasing clouds with little temperature change. Precipitation possible within 6 hours. Windy"
 158 = "Increasing clouds and cooler. Precipitation continuing. Windy with possible wind shift to the W, NW, or N."
 159 = "Partly cloudy with little temperature change."
 160 = "Mostly clear with little temperature change."
 161 = "Mostly cloudy and cooler. Precipitation likely. Windy with possible wind shift to the W, NW, or N."
 162 = "Mostly cloudy with little temperature change. Precipitation continuing. Windy with possible wind shift to the W, NW, or N."
 163 = "Mostly cloudy with little temperature change. Precipitation likely. Windy with possible wind shift to the W, NW, or N."
 164 = "Increasing clouds and cooler. Precipitation possible within 6 hours. Windy with possible wind shift to the W, NW, or N."
 165 = "Partly cloudy with little temperature change."
 166 = "Mostly clear with little temperature change."
 167 = "Increasing clouds and cooler. Precipitation possible within 6 hours possible wind shift to the W, NW, or N."
 168 = "Increasing clouds with little temperature change. Precipitation possible within 6 hours. Windy with possible wind shift to the W, NW, or N."
 169 = "Increasing clouds with little temperature change. Precipitation possible within 6 hours possible wind shift to the W, NW, or N."
 170 = "Partly cloudy with little temperature change."
 171 = "Mostly clear with little temperature change."
 172 = "Increasing clouds and cooler. Precipitation possible within 6 hours. Windy with possible wind shift to the W, NW, or N."
 173 = "Increasing clouds with little temperature change. Precipitation possible within 6 hours. Windy with possible wind shift to the W, NW, or N."
 174 = "Partly cloudy with little temperature change."
 175 = "Mostly clear with little temperature change."
 176 = "Increasing clouds and cooler. Precipitation possible within 12 to 24 hours. Windy with possible wind shift to the W, NW, or N."
 177 = "Increasing clouds with little temperature change. Precipitation possible within 12 to 24 hours. Windy with possible wind shift to the W, NW, or N."
 178 = "Mostly cloudy and cooler. Precipitation possibly heavy at times and ending within 12 hours. Windy with possible wind shift to the W, NW, or N."
 179 = "Partly cloudy with little temperature change."
 180 = "Mostly clear with little temperature change."
 181 = "Mostly cloudy and cooler. Precipitation possible within 6 to 12 hours, possibly heavy at times. Windy with possible wind shift to the W, NW, or N."
 182 = "Mostly cloudy with little temperature change. Precipitation ending within 12 hours. Windy with possible wind shift to the W, NW, or N."
 183 = "Mostly cloudy with little temperature change. Precipitation possible within 6 to 12 hours, possibly heavy at times. Windy with possible wind shift to the W,
 NW, or N."
 184 = "Mostly cloudy and cooler. Precipitation continuing."
 185 = "Partly cloudy with little temperature change."
 186 = "Mostly clear with little temperature change."
 187 = "Mostly cloudy and cooler. Precipitation likely. Windy with possible wind shift to the W, NW, or N."
 188 = "Mostly cloudy with little temperature change. Precipitation continuing."
 189 = "Mostly cloudy with little temperature change. Precipitation likely."
 190 = "Partly cloudy with little temperature change."
 191 = "Mostly clear with little temperature change."
 192 = "Mostly cloudy and cooler. Precipitation possible within 12 hours, possibly heavy at times. Windy."
 193 = "FORECAST REQUIRES 3 HOURS OF RECENT DATA"
 194 = "Mostly clear and cooler."
 195 = "Mostly clear and cooler."
 196 = "Mostly clear and cooler."

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)

  1 - Rain drops
  2 - Cloud
  4 - Part Sun (Small sun -- This never appears by itself)
  8 - Sun (Big bright sun)
 16 - Snow

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.

 DEF:cosine=/path/to/winddir.rrd:cosine:LAST 
 DEF:sine=/path/to/winddir.rrd:sine:LAST
 CDEF:rawdeg=sine,cosine,ATAN2,RAD2DEG
 CDEF:winddir=rawdeg,0,LT,rawdeg,360,+,rawdeg,IF

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.


EXAMPLES

Here are some examples of the contents of the files output by the daemon:

extremes.mm.dd.yy (New lines added for better readability in this example)

30.01,16:59:02,30.12,00:00:02,24.7,07:13:22,53.9,14:45:51,24,WSW,14:53:02,22, 16:03:27,81,06:56:50,15.1,16:03:50,28.1,11:56:22,20.1,07:15:58,--,00:00:00, 0.00,00:00:02,0.00,14.19,67.0,07:00:01,77.7,13:10:02,9,16:24:59,24,01:45:00, 12.0,16:36:59,32.2,13:18:01,0.00,0.00,--,--

currentobs.mm.dd.yyyy

18,46,45,30.021,42.1,6,5,WSW,50,24.8,38.3,--,0.00,0.00,1.81,14.19,06:25,18:12,73.3,14,21.3,ST,8,1,00/00/00,0.00,0.00,0.00,0.00,0.00,--,--,29.743

dailyobs.mm.dd.yyyy

 10,20,29.889,41.6,13,19,239,40,19.1,34.5,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.960
 10,21,29.887,41.5,16,18,241,42,20.1,33.5,--,74.5,26,37.4,0.00,0.00,0.00,0.00,--,--,29.960
 10,22,29.880,41.2,14,17,245,41,19.3,33.7,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.958
 10,23,29.875,41.2,13,17,245,44,21.0,34.0,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.974
 10,24,29.880,41.3,11,12,251,41,19.4,34.9,--,74.5,27,38.4,0.00,0.00,0.00,0.00,--,--,29.969
 10,25,29.885,41.8,9,13,262,41,19.8,36.3,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.974
 10,26,29.887,41.9,10,15,269,39,18.8,36.0,--,74.5,24,35.4,0.00,0.00,0.00,0.00,--,--,29.956
 10,27,29.885,41.8,12,17,249,39,18.7,35.1,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.958
 10,28,29.884,41.8,13,17,252,41,19.8,34.8,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.956
 10,29,29.883,41.6,11,14,237,41,19.7,35.2,--,74.5,23,34.3,0.00,0.00,0.00,0.00,--,--,29.956
 10,30,29.883,41.5,12,18,247,43,20.7,34.7,--,74.5,27,38.4,0.00,0.00,0.00,0.00,--,--,29.954


CHANGES

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.2 Added previous 15 minutes rainfall to current and dailyobs files. Added UV and Solar radiation readings from console. Force console to update barometer every minute. Adjusted timing of CWOP packet transmissions based on coordination with Dick, KB7ZVA. Added support for weather underground rapid fire mode.

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.1 Some minor bigfixes in the CWOP submission code. Added bar_offset variable.

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.

Now for some PAUSE stuff.


README

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.

Example of installation:

   cp vanprod-$VERSION /usr/local/sbin/vanprod
   cp vanprod.conf-$VERSION /etc/vanprod.conf
   pod2man /usr/local/sbin/vanprod /usr/local/man/man1/vanprod.1

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.


PREREQUISITES

The daemon requires the following at a minimum in order to run:

Device::Davis Getopt::Std Sys::Syslog POSIX Date::Calc Date::Manip Socket


COREQUISITES

DBI for database updates. LWP for Weather Underground. rrdtool

any Unix / Linux variant or Mac (only tested with OS X)

Networking Web


SEE ALSO

perl(1) perlfunc(1) Device::Davis(3) POSIX(3) LWP(3) DBI(3) Date::Manip(1) Date::Calc(3) Getopt::Std(3) Sys::Syslog(3) syslog.conf(5) http://www.mysql.com/doc/ http://www.rrdtool.org


COPYRIGHT AND LICENSE

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.