XBee Smart Plug
From Digi Developer
|Product Name:||XBee Smart Plug ZB|
|Digi Product Page:|||
Digi’s XBee Smart Plug is a intelligent outlet that can measure power usage and provide basic power management to attached appliances via the standard electrical outlet. For more details of safety and usage concerns, please review the Drop-in-Networking Accessories User's Guide at: http://www.digi.com/din/docs
Major Features of the XBee Smart Plug:
- Programmable power relay controlling the integrated outlet
- Current sensor monitoring the power consumption of the integrated outlet
- Light sensor
- XBee network extension
- Built-in mounting tab for U.S. versions.
The XBee Smart Plug uses the XBee ZB protocol. All of Digi's gateway products that use the XBee ZB protocol are compatible with the XBee Smart Plug.
The XBee Smart Plug uses the Router AT function set. The XBee Router AT function set uses the AT commands to query, configure and control the XBee RF module in the XBee Smart Plug.
The AT commands for the XBee Smart Plug's unique features are:
- Light sensor
- D1=2 (Analog input)
- Current sensor
- D3=2 (Analog input)
- Power Relay
- D4=4 (Turns outlet off)
- D4=5 (Turns outlet on)
NOTE: Settings do not take affect without the corresponding apply changes command, which is 'AC'. See the XBee module product manual for more information.
DIA Configuration and Programming Examples
The XBee Smart Plug is supported in the DIA (Digi Device Integration Application), a software component for quick device integration.
The DIA is a python framework designed to gather information from multiple sources, provide programmatic control over the information collecting, and present the data either to a software platform such as the Device Cloud or directly to the user through a variety of methods.
See an example XBee Smart Plug configuration here.
Python Programming Examples
The XBee Smart Plug may also be controlled from a Digi gateway device using the embedded XBee python module's function calls ddo_get_param() and ddo_set_param(). Using these function calls, one can enable the current and light sensors, enable the power relay, and take a sensor reading.
Below is a quick demonstration of how to send such commands. The address (addr argument) used for the XBee Smart Plug varies depending on its 64-bit MAC address.
from xbee import ddo_get_param, ddo_set_param addr = '[00:13:a2:00:40:48:59:95]!' ddo_set_param(addr, 'D1', 2) ## Enabling light sensor ddo_set_param(addr, 'D3', 2) ## Enabling current sensor ddo_set_param(addr, 'D4', 5) ## Turning the power relay on ddo_set_param(addr, 'AC') ## Making sure to apply changes ddo_get_param(addr, 'IS') ## Getting a sensor reading
For a interactive demonstration of the XBee Smart Plug, Smart Plug Interactive Demo provides a means to control the power relay of the XBee Smart Plug while retrieving and interpreting the sensor values into real-world units.