README
IoT Platform
Lynxari Tipping Bucket Rain Gauge device driver
This device driver is specifically designed to be used with the Agilatech® Lynxari IoT Platform. Please see agilatech.com to download a copy of the system.
Install
Tipping Bucket Rain Gauge device driver for use in the Agilatech Lynxari system
<script type="module">
import agilatechLynxariRainDevice from 'https://cdn.skypack.dev/@agilatech/lynxari-rain-device';
</script>
IoT Platform
This device driver is specifically designed to be used with the Agilatech® Lynxari IoT Platform. Please see agilatech.com to download a copy of the system.
gt; npm install @agilatech/lynxari-rain-device
This device driver is designed to keep track of the total amount of rainfall during a 24-hour period beginning at midnight local time. It is meant to be used with an analog-style tipping bucket guage, in which a tipping bucket momentarily closes a switch which privides the pulse to register a tip event. In this type of device, a small bucket collects rainfall, and tips and empties when a predetermined volume has been reached. In this manner, individual tip events can be tallied and used to total rainfall.
This driver is programmed to reset at midnight local time. A side effect of this reset is that a data event will be initiated. All data events with an amount value of 0 can therefore be safely ignored.
This device driver is designed to be consumed by the Agilatech® Lynxari IoT system. As such, it is not really applicable or useful in other environments.
To use it with Lynxari, insert its object definition as an element in the devices array in the devlist.json file.
{
"name": "RAIN",
"module": "@agilatech/lynxari-rain-device",
"options": {
"devicePoll": 3600000,
"streamPeriod": 0
}
}
The device config object is an element in the devlist.json device configuration file, which is located in the Lynxari root directory. It is used to tell the Lynxari system to load the device, as well as several operational parameters.
name is simply the name given to the device. This name can be used in queries and for other identifcation purposes.
module is the name of the npm module. The module is expected to exist in this directory under the node_modules directory. If the module is not strictly an npm module, it must still be found under the node_modules directory.
options is an object within the device config object which defines all other operational parameters. In general, any parameters may be defined in this options object, and most modules will have many several. The three which are a part of every Lynxari device are 'devicePoll', 'streamPeriod', and 'deltaPercent'. The deviceName options also can define the gpio pin number and the amount of rain per bucket tip.
"devicePoll":<period>
Period in milliseconds in which device will be polled
"streamPeriod":<period>
Period in milliseconds for broadcast of streaming values
"gpio":<I/O pin number>
The pin interface to which the tip switch is connected
"tipAmount":<mm rain>
The amount of rain in mm per bucket tip
These config have little applicability for an event-based sensor such as this. Since this sensor simply updates the monitored variable each and every time the rain bucket tips, it makes little sense to stream the value or poll the device for a new value. Because of this, it is advisable to set streamPeriod to 0, which disables streaming, and set the devicePoll to some arbitrarily large value. Regardless of the setting of these config, the value amount will be updated whenever a bucket tip event is registered.
Every module released by Agilatech includes configuration in a file named 'config.json' and we encourage any other publishers to follow the same pattern. The parameters in this file are considered defaults, since they are overriden by definitions appearing in the options object of the Lynxari devlist.json file.
The construction of the config.json mirrors that of the options object, which is simply a JSON object with key/value pairs. Here is an example of an 'config.json' file which disables streaming, polls the device every hour, sets the GPIO pin number to 60, and the rain increment per bucket tip to 0.254mm:
{
"streamPeriod":0,
"devicePoll":3600000,
"gpio":60,
"tipAmount":0.254
}
If not specified in the config object, the program uses the following default values:
All drivers contain the following 4 core properties:
In the on state, the driver software for this device monitors three values.
For this device, it is usual to disable streaming. However, if it is not disabled, while in the on state, the driver software continuously streams this value in isochronal fashion with a period defined by streamPeriod. Note that a streamPeriod of 0 disables streaming.
This device driver has a binary state: on or off. When off, no parameter values are streamed or available, and no commands are accepted other than the turn-on transition. When on, the device is operations and accepts all commands. The initial state is off.
turn-on : Sets the device state to on. When on, the device is operational and accepts all commands. Values are streamed, and the device is polled periodically to keep monitored values up to date.
turn-off : Sets the device state to off, When off, no parameter values are streamed or available, and no commands are accepted other than the turn-on transition.
Lynxari will operate on any computer from a small single board computer up to large cloud server, using any of the following operating systems:
Copyright © 2018 Agilatech®. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.