Home > Support > Knowledge Base > Knowledge Base Article

Example DIA Using Timers With XBee Smart Plug and XBee LTH Readings

The following DIA .yml file example uses the Alarm Clock available from the Digi Dia wiki and is placed into the DIA src/devices directory path:

http://www.digi.com/wiki/developer/images/7/7d/2009jun09_alarm_clock_device.zip

This example uses a ConnectPort X4 Coordinator with 2 XBee Smart Plug modules (one to control lights and one to control computer or office equipment).  The Alarm Clock setting for the lights is configured to turn on the lights at 19:00 and turn off the lights at 22:00 everyday.  Whereas, the computer timer is configured to turn on the computer at 06:00 and turn it off at 18:00 hours everyday.  The embedded web presentation is used.

Using the following dia.yml file example, replace the extended_address fields to match those on your paticular XBee nodes. The extended_address can be found for joined devices under the XBee Network menu from the web interface of your unit or the Device Cloud by Etherios.  Once modified for your specific Environment, use Digi ESP to compile/upload the DIA project to your gateway.
 
To compile it directly from the command line/DOS prompt, issue the following within the DIA main directory:

   C:\>  C:\python24\python.exe make.py (path)\dia.yml

Then upload the dia.zip file located in the DIA bin directory to your gateway and either run it from your Gatewy root prompt:

  #>  python dia.py

or add the python file to the Python Auto-Start menu from the web interface or Device Manager and reboot the unit to start the DIA project.

Once the DIA project is started, browse to the embedded web in order to view sensor readings, status and to turn on and off the smart plug devices manually.

http://(IP_address_of_gateway)/idigi_dia

##Device Integration Application Framework Configuration dia.yml File Example## 



devices: - name: lights driver: devices.alarm_clock_device:AlarmClockDevice settings: tick_rate: 60 printf: minute action_list: - event: { 'nam':'lights', 'per':'daily', 'on':'19:00', 'off':'22:00' } - name: computer driver: devices.alarm_clock_device:AlarmClockDevice settings: tick_rate: 60 printf: minute action_list: - event: { 'nam':'computer', 'per':'daily', 'on':'06:00', 'off':'18:00' } - name: xbee_device_manager driver: devices.xbee.xbee_device_manager.xbee_device_manager:XBeeDeviceManager ###Configure XBee LTH Sensor#### - name: lth_sensor driver: devices.xbee.xbee_devices.xbee_sensor:XBeeSensor settings: xbee_device_manager: "xbee_device_manager" extended_address: "00:00:00:00:00:00:00:00!" sleep: True sample_rate_ms: 50000 ###Convert LTH Sensor temperature to fahrenheit##### - name: fahr_sensor driver: devices.transforms_device:TransformsDevice settings: - name: temperature_f unit: F channels: - lth_sensor.temperature expr: (9.0/5.0) * c[0] + 32 # Add Smart Plug Device (computer): - name: computer_office driver: devices.xbee.xbee_devices.xbee_rpm:XBeeRPM settings: xbee_device_manager: "xbee_device_manager" extended_address: "00:00:00:00:00:00:00:00!" sample_rate_ms: 5000 default_state: "On" power_on_source: computer.computer ###Convert Smart Plug Temperature### - name: fahr_computer_office driver: devices.transforms_device:TransformsDevice settings: - name: temperature_f unit: F channels: - computer_office.temperature expr: (9.0/5.0) * c[0] + 32 # Add our Smart Plug Device (lights): - name: light_control driver: devices.xbee.xbee_devices.xbee_rpm:XBeeRPM settings: xbee_device_manager: "xbee_device_manager" extended_address: "00:00:00:00:00:00:00:00!" default_state: "Off" power_on_source: lights.lights
###Convert Smart Plug Temperature###
- name: fahr_light_control driver: devices.transforms_device:TransformsDevice settings: - name: temperature_f unit: F channels: - light_control.temperature expr: (9.0/5.0) * c[0] + 32 presentations: - name: embedded_web driver: presentations.embedded_web.web:Web
Contact a Digi expert and get started today! CONTACT US

Desktop Site