.. _watchport:

********************
XBee Watchport
********************

.. index:: devices;xbee;watchport

Overview
====================
Dia Drivers for the XBee Watchport Sensor Adapters

The XBee Watchport Sensor Adapter has five optional sensors that
can be used to provide environmental monitoring services.

The following Watchport Sensors are supported:

+---------------------------------------------+------------------------+
|  Watchport Sensor                           |  Dia Driver Name       |
+=============================================+========================+
|  Watchport/T Temperature Sensor             |  XBeeWatchportSensorT  |
+---------------------------------------------+------------------------+
|  Watchport/H Humidity/ Temperature Sensor   |  XBeeWatchportSensorH  |
+---------------------------------------------+------------------------+
|  Watchport/D Distance Sensor                |  XBeeWatchportSensorD  |
+---------------------------------------------+------------------------+
|  Watchport/A Acceleration/Tilt Sensor       |  XBeeWatchportSensorA  |
+---------------------------------------------+------------------------+
|  Watchport/W Water Detector                 |  XBeeWatchportSensorW  |
+---------------------------------------------+------------------------+

.. note::
    Only "-01" revision Watchport Sensors are supported!

    To determine your Watchport sensor revision, look at the back of the
    Sensor for the "PN:" value.
    The PN value will be an 8 digital value, starting with "50".
    After those 8 digits, the revision of the Sensor will be given,
    starting with a "-".

Configuration
====================

A typical watchport sensor configuration block looks like this::

    - name: sensor0
      driver: devices.xbee.xbee_devices.xbee_watchport:XBeeWatchportSensor[T/H/D/A/W]
      settings:
        xbee_device_manager: <instance name>
        extended_address: <sensor address>
        sample_rate_ms: 60000
        enable_low_battery: Off

Settings
--------------------

xbee_device_manager (required)
    The name of an XBeeDeviceManager instance to manage this device.

extended_address (required)
    The extended address of the XBee Sensor device you would like to
    monitor.

sleep (optional, default: False)
    True/False; Setting which determines if the device should sleep
    between samples. 

sample_rate_ms (required)
    The sample rate of the XBee adapter in milliseconds.

awake_time_ms (optional, default: 5000)
    Determines how long (in milliseconds) the device should stay awake after
    waking from sleep.

enable_low_battery (optional, default: Off)
    Force an adapter to enable support for battery-monitor pin. 
    This should be enabled only if the adapter is using internal batteries.    

Channels
====================

Common
--------------------
low_battery (Get, type: bool)
    Low battery indication condition as reported by the adapter.
    It will be only added if adapter is using internal batteries. 
    See enable_low_battery setting. 


XBeeWatchportSensorT
--------------------
temperature (Get, type: float, units: C)
    Temperature as measured by the sensor.

XBeeWatchportSensorH
--------------------
temperature (Get, type: float, units: C)
    Temperature as measured by the sensor.

sensor_rh (Get, type: float, units: %)
    Direct relative humidity reading from sensor.

true_rh (Get, type: float, units: %)
    ``sensor_rh`` value compensated for temperature to give true
    relative humidity.

XBeeWatchportSensorD
--------------------
distance (Get, type: float, units: cm)
    Distance from sensor to sensed object.

XBeeWatchportSensorA
--------------------
xout (Get, type: float)
    X axis sensor reading.
yout (Get, type: float)
    Y axis sensor reading.
pitch (Get, type: float)
    Pitch component of sensor orientation.
roll (Get, type: float)
    Roll component of sensor orientation.

XBeeWatchportSensorW
--------------------
water (Get, type: bool)
    Value indicating if water is being sensed.
