|
Changing WxService Settings
You can edit configuration properties using the Configuration page on WxMonitor or by directly editing wxservice.properties
in the wxservice directory.
If you make a mistake, you can delete an entry from the Configuration page, and it will revert to the default value when
you click "Apply". Make a backup copy of wxservice.properties if you want to revert to previously saved settings.
Setting Event Logging Levels
The 1-Wire Weather Service for Java uses the extremely flexible java.util.logging.Logger
package. The default logging verbosity is INFO. You modify logging features by editing logging.properties
in the lib directory of your Java Runtime Environment (JRE). The following example sets up the logger to log only SEVERE errors
for the entire service, except for the anemometer task, which overrides the general settings and logs ALL events.
wxservice.level = SEVERE wxservice.AnemometerTask.level = ALL
You can set logging levels individually for any class in the 1-Wire Weather Service for Java; each class has its own
logger name associated with it.
Calibrating the Humidity Sensor If the humidity sensor is reading out of range, first determine, if
possible, how it compares to other sensors in the area. There will be three cases:
Case 1: Offset error -- the humidity range is acceptable, but the average humidity consistently reads
above or below reference instruments. To address this, calculate the theoretical output voltage for the humidity reading reported
by the device, using the formula
Vout = (Slope * SensorRH) + Vzero
using the currently configured values for Slope and Vzero (
hygrometer.task.sensor.slope and hygrometer.task.sensor.zero, respectively, in the WxMonitor Configure panel). Then, substitute
the calculated Vout into this formula
Vzero = Vout - (Slope * ReferenceRH)
where ReferenceRH is the actual humidity from the reference instruments. Enter
the new calculated value for Vzero into hygrometer.task.sensor.zero
and click Apply.
Case 2: Range error -- the humidity range is too wide or too narrow, compared
to reference instruments. To address this, calculate the theoretical output voltage for the humidity reading reported by the
device, using the formula
Vout = (Slope * SensorRH) + Vzero
using the currently configured values for Slope and Vzero (
hygrometer.task.sensor.slope and hygrometer.task.sensor.zero, respectively, in the WxMonitor Configure panel). Then, substitute
the calculated Vout into this formula
Slope = (Vout - Vzero) / ReferenceRH
where ReferenceRH is the actual humidity from the reference instruments. Enter
the new calculated value for Slope into hygrometer.task.sensor.slope
and click Apply.
Case 3: Range and offset error -- a combination of the other two cases. Fix range
and offset separately, as described above. Correct the raw SensorRH data for offset and then plug the new values
for SensorRH, and Vzero from Case 1, into the formulas for Case 2. There may be some interaction between
Case 1 and Case 2, so this might require a few iterations to dial it in.
Note that you can use historical data from
logs to perform the correction as long as SensorRH and ReferenceRH are taken at the same time.
Disambiguating Multiple Devices of the Same 1-Wire Family
If you have more than one sensor from the same 1-Wire family on your 1-Wire network (multiple temperature sensors for
example, or more insidiously, an anemometer and a rain gauge -- they both use the same Dallas DS2423 IC), the device that
gets associated with a given WxService task-name will be arbitrary unless you change the task-name.task.device.address
configuration from "discover" to the 1-Wire address for your particular device. If you don't know the address (sometimes it
is printed on the device), you can use the 1-Wire Viewer utility to find the device address.
Routing Devices on the 1-Wire Network WxService can route alternate devices to various displays or
formatters. For example, the TAI8540A Humidity Sensor Module is built around a Dallas DS2438 Smart Battery Monitor IC, which
contains a temperature sensor that is normally used for hygrometer temperature compensation and dew point calculations. However,
you can also use the hygrometer's temperature sensor instead of the one provided in the TAI8515 1-Wire Weather Instrument
Kit (which is adversely affected by solar heating) by changing the settings
wxmonitor.temperature.task=thermometer.task csv.formatter.temperature.task=thermometer.task
wunderground.formatter.temperature.task=thermometer.task
to
wxmonitor.temperature.task=hygrometer.task csv.formatter.temperature.task=hygrometer.task
wunderground.formatter.temperature.task=hygrometer.task
This does not affect any of the hygrometer functionality, it simply makes WxMonitor and the formatters use the temperature
information that the humidity module is transmitting. Similarly, you can route other devices as well.
Using Multiple Devices of the Same 1-Wire Family You might have multiple devices from the same 1-Wire
familiy on your 1-Wire network, e.g., indoor and outdoor thermometers. You can use these devices simultaneously, with WxService.
This tech note describes how to use multiple thermometers, but the same principles apply to other devices as well. You
need to create a new task for your second (or third, or n-th) thermometer. You need to add the following properties to the
WxService configuration:
thermometer1.task.classname=wxservice.sensor.task.Thermometer thermometer1.task.device.address=discover thermometer1.task.device.offset=0.0 thermometer1.task.device.scale=1.0 thermometer1.task.sampling.interval=60000
This creates a task called "thermometer1.task". The name isn't important. You could name it "indoor.task" or "outdoor.task"
if you want. You can add the properties with the Add... button on the WxMonitor Configuration page, or you can paste them
into wxservice.properties anywhere in the file. Don't forget to change thermometer1.task.device.address=discover to the actual
device address if you need to disambiguate the devices.
Then, add thermometer1.task to the other tasks in the WxService task list:
wxservice.sensor.task.names=...;thermometer.task;thermometer1.task;
Notice that you now have a thermometer.task and a thermometer1.task, so you really have two thermometer tasks at this point.
Finally, change settings for the various formatters and WxMonitor to use the thermometer.task or the thermometer1.task
as described above in the tech note "Routing Devices on the 1-Wire Network".
Using the WxService as a Web Service WxService is implemented as a web service. This tech note documents
the web service operations, and how to use them.
WxMonitor is a web service client of WxService, but there is nothing special about that. You can write other clients by
importing the WxService Web Service Description Language (WSDL) and the schema into any software development tool that is capable of consuming web services. SoapUI is a good tool to use to experiment with the web service and explore the XML documents used to exchange data between WxService
and its clients. See the WxService JavaDocs (included in the WxService zip file, available for download) for more information about how WxService works.
getSensorData -- Returns sensor data since the specified time (in milliseconds since January 1, 1970 UTC).
WxService has a short history buffer (approximately 10 minutes, to cover for temporary network interruptions). Normally, you
would specify the time of the last sensor data received from the last getSensorData invocation. When first starting up, specify
a time of zero. This causes WxService to send the minimum and maximum data and time (since local midnight) for each sensor,
plus all data in the history buffer.
Sample XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Header/> <soapenv:Body> <urn:getSensorData>
<time>1195791936109</time> </urn:getSensorData> </soapenv:Body> </soapenv:Envelope>
Sample XML Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Body> <ns1:getSensorDataResponse>
<sensorData> <name>windvane.task.direction</name>
<value>14</value> <time>1195865915156</time>
</sensorData> ...
<sensorData> <name>anemometer.task.speed</name>
<value>10</value> <time>1195866138109</time>
</sensorData> </ns1:getSensorDataResponse> </soapenv:Body> </soapenv:Envelope>
getFileNames -- Returns a comma-delimited list of files and file creation times (in milliseconds since
January 1, 1970 UTC) of log files and CSV history files stored on the weather server. File names selected from this list can
be used to get file data. Use only the file name portion of the response as an input parameter to getFileData.
Sample XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Header/> <soapenv:Body> <urn:getFileNames/>
</soapenv:Body> </soapenv:Envelope>
Sample XML Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Body> <ns1:getFileNamesResponse>
<fileName>2005-08-23.csv,1124866200031</fileName> ...
<fileName>2007-11-23.txt,1195864819734</fileName> </ns1:getFileNamesResponse>
</soapenv:Body> </soapenv:Envelope>
getFileData -- Returns data from the specified file (log file or CSV history data). The file name is obtained
from the method getFileNames.
Sample XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Header/> <soapenv:Body> <urn:getFileData>
<fileName>2007-11-22.csv</fileName> </urn:getFileData>
</soapenv:Body> </soapenv:Envelope>
Sample XML Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Body> <ns1:getFileDataResponse>
<fileData>time, temperature, dew_point, humidity, wind_speed, wind_gust, wind_direction, air_pressure, precip_accum,
precip_rate,</fileData> <fileData>00:00:00,031.3,024.3,075,002,004,022,30.46,0.00,0.00,</fileData>
... <fileData>00:10:00,031.8,023.9,072,002,005,044,30.46,0.00,0.00,</fileData>
</ns1:getFileDataResponse> </soapenv:Body> </soapenv:Envelope>
getConfiguration -- Returns a list of name/value pairs that represents the current WxService configuration.
Sample XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Header/> <soapenv:Body> <urn:getConfiguration/>
</soapenv:Body> </soapenv:Envelope>
Sample XML Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Body> <ns1:getConfigurationResponse>
<config> <key>wxmonitor.wind.direction.task</key>
<value>windvane.task</value> </config>
...
<config> <key>thermometer.task.sampling.interval</key>
<value>60000</value> </config>
</ns1:getConfigurationResponse> </soapenv:Body> </soapenv:Envelope>
setConfiguration -- Sets zero or more specified name/value pairs on WxService and restarts the service.
Sample XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Header/> <soapenv:Body> <urn:setConfiguration>
<config> <key>wxmonitor.wind.direction.task</key>
<value>windvane.task</value> </config>
...
<config> <key>thermometer.task.sampling.interval</key>
<value>60000</value> </config>
</urn:setConfiguration> </soapenv:Body> </soapenv:Envelope>
Sample XML Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:xmlns:uppiano-karl:wxservice">
<soapenv:Body> <ns1:setConfigurationResponse/> </soapenv:Body> </soapenv:Envelope>
|