********************
XBee RPM
********************

.. index:: devices;xbee;smart plug

Overview
====================
Dia Driver for the Digi XBee SmartPlug with Power Management

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

A typical RPM configuration block looks like this::

    - name: rpm0
      driver: devices.xbee.xbee_devices.xbee_rpm:XBeeRPM
      settings:
        xbee_device_manager: <instance name>
        extended_address: <sensor address>

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.

sample_rate_ms (optional, default: 1000)
    The sample rate of the XBee adapter in milliseconds.

default_state (optional, default: On)
    On/Off/Same - The plug will default to the specified state on
    initialization of the driver in Dia.  If `Same` is specified, the
    driver will not change the current state of the plug on startup.

idle_off_seconds: (optional, default: 0)
    Time interval in seconds where if the ``power_state`` has not
    changed in the given time interval, the device will be turned
    off.  The default value of zero means that this will not be
    checked. 

power_on_source (optional) 
    The name of a Boolean ``device.channel`` to be used as the state.
    For example, if set to the name of a channel which changes value
    from False to True, the SmartPlug would change from being off to
    on. When not set, the behavior of the device is solely governed by
    its ``power_on`` channel.

pf_adjustment (optional, default: 1.0)
    Floating point value between 0 and 1, that is used to adjust the
    current output given a known power factor.

    .. note:: The unit cannot determine the power factor,                   
              it is strictly a user-supplied value.          

device_profile (optional)
    String value corresponding to a preset pf_adjustment value.  These
    values are by no means meant to be precise, and are at best
    ballpark estimates. For more accuracy, use the pf_adjustment
    setting above.  

    Possible values include:

    +--------------------+--------------------+
    |fluor-mag           |                 0.4|
    +--------------------+--------------------+
    |fluor-electronic    |                 0.6|
    +--------------------+--------------------+
    |1/3hp-dc-motor      |                 0.6|
    +--------------------+--------------------+
    |laptop              |                0.53|
    +--------------------+--------------------+
    |lcd_monitor         |                0.65|
    +--------------------+--------------------+
    |workstation         |                0.97|
    +--------------------+--------------------+

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

light (Get, type: float, units: brightness)
    Provides a unitless measure of light intensity.  The full range of
    values is from zero to 1200 with a roughly linear proportional
    correspondence from zero to 10,000 lux.  However, the value is not
    calibrated to correspond to any fixed standard.

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

current (Get, type: float, units: A)
    Current being supplied to the device attached to the RPM. The
    current value is derated by the ``pf_adjustment`` factor.

power_on (Get/Set, type: Boolean)
    Current state of power being supplied to the plug.
