Oww output parser
Introduction
A new feature since Oww 0.63 is the output parser. This is used
by Oww to generate log lines and command strings. It works by scanning
the corresponding setup string for recognized tokens, indicated by a pair of $
symbols. For example, $t1$
will be replaced by the temperature of the primary thermometer. To
generate a $
symbol in the output the setup string must contain $$
.
Index values
Tokens for readings from thermometers, RH sensors,
barometers and general-purpose counters (i.e. devices for which there may be
multiple sources), must be followed by the device index. For instance, the
first thermometer value is obtained with $t1$
,. whereas the rain reading is simply $rain$
. Tokens that require an index value are marked # in the summary, below.
Format modifiers
Tokens may be suffixed by a format modifier, with a %
symbol separating the token from the following format modifier. These
are generally passed on to a C printf()
function, so they follow the format for printf()
format strings (without any character to specify the variable type
Oww works this bit out for itself). For example, if you want to
output the temperature in a six-character field, with two decimal places, use $tc1%6.2$
. Time functions use strftime()
format strings. See below. Note that if an index value is required, it
must come before the %
.
Locale Setting
Please note that since version 0.81.4 owwnogui
hoours your locale setting.
Previously only the GUI version of oww
behaved this way.
This is probably what you want most of the time.
However, a side effect is that mysql users may find their parser output is no longer accepted.
To revert to the old behaviour I suggest you set the LC_NUMERIC
environment
variable to C
when you run owwnogui
:
LC_NUMERIC=C owwnogui
Token summary
These are the tokens currently recognized by Oww, with a short
description of the substituted value for each one:
- bar#
- A barometer reading in the current pressure units
- barinhg#
- A barometer reading in inches of mercury
- barmbar#
- A barometer reading in mBar
- barunit
- The current pressure unit
- dailyrain
- The rainfall so far today (by local time) regardless of the reset time, in the current rainfall units.
- dailyrainin
- The rainfall so far today (by local time) regardless of the reset time, in inches.
- dailyrainmm
- The rainfall so far today (by local time) regardless of the reset time, in mm.
- dp#
- Dew point temperature, in current temperature unit
- e.g.
$dp1$
- dpc#
- Dew point temperature, in Celcius
- e.g.
$dpc1$
- dpf#
- Dew point temperature, in Fahrenheit
- e.g.
$dpf1$
- gmtime
- Universal time (UT also known as GMT)
- This must be followed by a strftime() format string
- e.g.
$gmtime%H:%M:%S %d/%m/%y$
- gpc#
- The calibrated general purpose counter increment since the last
reset.
- e.g.
$gpc1$
- gpcdelta#
- The calibrated general purpose counter increment since the last
readout.
- gpcevents#
- Any change of the counter during a sub-interval update
(read every gust interval) is counted as an event.
For example, a burst from a lightning detector will add
many counts, but only result in an increment of 1 or 2 in
gpcevents
.
- gpceventmax#
- This is the maximum counter delta read for an event during the
last logging interval.
- gpcmono#
- The uncalibrated (monotonic) general purpose counter readout ignoring
resets.
- gpcrate#
- The calibrated general purpose counter increment rate, i.e. gpcdelta
/ delta t
- heatindex
- Either the Heat Index or Canadian Humidex,
depending on the
hitype
setup, in the current temperature units.
- heatindexc
- Heat index in °C
- heatindexf
- Heat index in °F
- iadc#
- ADC current
- localtime
- Local time
- This must be followed by a strftime() format string
- e.g.
$localtime%H:%M:%S %d/%m/%y$
- mysqltime
- Convenience tag for producing time in MySQL database format.
- rain
- Rain in the current rain units
- rainin
- Rain in inches
- rainint
- Rainfall during the last 1-hour interval, in the current rain
units
- rainintin
- Rainfall during the last 1-hour interval, in inches
- rainintmm
- Rainfall during the last 1-hour interval, in mm
- rainmm
- Rain in mm
- rainmono
- Raw monotonic (always goes up) counter value from rain gauge
- Mulitply by 0.01" or 0.254 mm
- rainrate
- Rate of rainfall, in the current rain units per hour
- rainratein
- Rate of rainfall, in inches hour
- rainratemm
- Rate of rainfall, in mm per hour
- rainunit
- The current rain unit: "inches" or "mm"
- rh#
- Relative humidity reading
- e.g.
$rh1$
- solar#
- Solar radiation reading, in an arbitrary unit
- e.g.
$solar1$
- t#
- Temperature reading, in current temperature unit
- e.g.
$t1$
- tadc#
- ADC temperature
- tb#
- Temperature reading from a barometer, in current temperature unit
- e.g.
$tb1$
- tc#
- Temperature reading from a barometer, in Celcius
- tf#
- Temperature reading from a barometer, in Fahrenheit
- tc#
- Temperature reading, in Celcius
- tf#
- Temperature reading, in Fahrenheit
- trh#
- Temperature reading from an RH sensor, in current temperature
unit
- e.g.
$trh1$
- trhc#
- Temperature reading from an RH sensor, in Celcius
- trhf#
- Temperature reading from an RH sensor, in Fahrenheit
- tunit
- Current temperature unit: "°C" or "°F"
- unixtime
- Unix time seconds since 00:00:00z 1/1/1970
- uvi#
- UV Index reading from a UVI sensor
- vadc#
- ADC Voltage
- wchill
- Wind chill value (from primary T) in the current temperature
unit
- wchillc
- Wind chill value (from primary T) in Celcius
- wchillf
- Wind chill value (from primary T) in Fahrenheit
- wdrdeg
- Wind direction, in degrees clockwise from north
- wdrname
- Wind direction, compass point name
- wdrpoint
- Wind direction, compass point (0 15)
- wid
- Dallas ID of primary thermometer used to identify the weather
station
- wsp
- Wind speed, in the current speed units
- wspkph
- Wind speed, in kilometres per hour
- wspmax
- Maximum wind speed, in the current speed units
- wspmaxkph
- Maximum wind speed, in kilometres per hour
- wspmaxmph
- Maximum wind speed, in miles per hour
- wspmph
- Wind speed, in miles per hour
- wspunit
- Current wind speed unit: "KPH" or "MPH"
- wundpass
- Setup entry for your Weather Underground password
- wunduser
- Setup entry for your Weather Underground user name
Data sources
When the parser is called, it may fetch it's data from either of three
sources:
- The most recent readout values from the weather station, with no
averaging
- Averaged values recorded during a log interval
- Averaged values recorded during an upload interval
The source for each parsed output is listed below.
Setup entries
The setup entries that currently make use of the parser are listed
below, with the data source.
- httppostcom
- [from upload stats]
- specifies a line to pass to the shell (command line) after Web
updates
- httpprecom
- [from upload stats]
- specifies a line to pass to the shell (command line) before
attempting Web updates
- logform
- [from log stats]
- specifies how a log line is created
- e.g.
logform $localtime%H:%M:%S %d/%m/%y$, $tc1%7.1$
- This would output the time and date, followed by the temperature in
°C
- postupdate
- [from current readout]
- specifies a line to pass to the shell (command line) after each
update
- postlog
- [from log stats]
- specifies a line to pass to the shell (command line) after each log
update
- txtform
- [from current readout]
- Specifies the format of data sent to clients of the text server.
Command execution
RISC OS
On RISC OS generated command lines are passed to the system()
function. This means that Oww (and everything else) will
block until the command has finished execution. To run a program that
would take a significant length of time, consider starting it in a task window
(e.g. taskwindow "<your command>" -wimpslot <your size> -name <your command name>
)
Linux
On Linux it is simple to have a program start several child
processes. This is used for postupdate
, postlog
and httppostcom
commands. So you may run tasks which will take some time to complete,
without halting Oww. httpprecom
uses a normal system()
call. Oww will pause until the command finishes. This is in case
you need the command to finish before Web upload is possible.