.. _local-dio:

********************
Local Digital
********************

.. index:: devices;xbee;digital adapter

.. warning:: 
    This driver is deprecated in favor of the :ref:`local-io`
    driver and will be removed in a future version of Dia.

Overview
====================
A Dia driver for the digital functionality present locally on the
gateway on some devices.  This driver presents a subset of the
:ref:`xbee-dio` driver options.

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

A typical local digital configuration block looks like this::

    - name: local_aio0
      driver: devices.xbee.xbee_devices.xbee_local_dio:XBeeLocalDIO
      settings:
        xbee_device_manager: <instance name>
        sample_rate_ms: 60000
        channel1_dir: In
        channel2_dir: Out
        channel3_dir: In
        channel4_dir: Out
        channel4_source: dio0.channel1_value

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

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

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

channel(1-4)_dir (required)
    Operating I/O mode for appropriate pin of the adapter.
                  
    Must be a string value comprised of one of the following:

    ``In``
        Pin is configured to be an input.
    ``Out``
        Pin is configured to be an output.

channel(1-4)_source (optional)
    If channel<x>_dir is configured as an output, this option setting
    may be specified to a ``device.channel`` channel name.  The Boolean
    value of this channel will specify to logic state for pin ``x`` on the
    adapter.

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

channel(1-4)_input (Get, type: bool, units: bool)
    The value measured by the device.  The units will depend on the
    configuration of the appropriate ``mode`` setting.

