.. _xbee-aio:

********************
XBee Analog Adapter
********************

.. index:: devices;xbee;xbee devices;analog adapter

Overview
====================
A Dia Driver for the XBee Analog I/O Adapter

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

A typical XBee Analog Adapter configuration block looks like this::

    - name: aio0
      driver: devices.xbee.xbee_devices.xbee_aio:XBeeAIO
      settings:
        xbee_device_manager: <instance name>
        extended_address: <sensor address>
        sample_rate_ms: 60000
        power: False
        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.

power (required)
    True/False setting to enable/disable the power output
    on terminal 6 of the adapter.

trace (optional, default: On)
    On/Off; On prints trace line for every sample, Off turns this function off.

raw_value (optional, default: Off)
    On/Off; On makes the output sample raw binary, Off gives a scaled output.

zero_clamp (optional, default: 0)
    The minimum raw binary setting to call zero; if zero, the option is
    disabled, otherwise it forces low values to zero.

channel(1-4)_mode (optional, default: TenV)
    Operating input mode for pin 1 of the adapter.

    Must be a string value comprised of one of the following:

     ``TenV``
         0-10v input available on any channel.

     ``CurrentLoop``
         0-20 mA current loop available on any channel.

     ``Differential``
         +/- 2.4A differential current mode
         enabled on channel 1 and 2 or channel 3 and 4.

awake_time_ms (optional, default: 5000)
    How many milliseconds should the device remain awake after waking
    from sleep.

sample_predelay (optional, default: 1000)
    How long, in milliseconds, to wait after waking up from sleep
    before taking a sample from the inputs.
    
enable_low_battery (optional, default: Off)
    Force an adapter to enable support for battery-monitor pin. 
    It should be enabled only if adapter is using internal batteries.    

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

channel(1-4)_value (Get, type: float, units: V(TenV, Differential) or mA(CurrentLoop))
    The value measured by the device.  The units will depend on the
    configuration of the appropriate ``mode`` setting.

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. 

