Example that will produce errors


I an running the following example on the ‘‘ConnectPort X4’’. My purpose is to get temperature, humidity battery level from remote sensors.

import zigbee and xbee_sensor modules:

import zigbee
import xbee_sensor

configure known destination:


ensure sensor is powered from adapter:

zigbee.ddo_set_param(DESTINATION, ‘D2’, 5)
zigbee.ddo_set_param(DESTINATION, ‘AC’, ‘’)

get and parse sample:

sample = zigbee.ddo_get_param(DESTINATION, ‘IS’)
xbee_temp = xbee_sensor.XBeeWatchportT()
print “Temperature is: %f degrees Celsius” % (xbee_temp.temperature)

The code is stored on the X4 and executed with the python command, the result is:
Traceback (most recent call last):
File “”, line 7, in ?
File “WEB/python/xbee_sensor.py”, line 65, in ?
from devices.device_base import DeviceBase
ImportError: No module named devices.device_base

Just as a side note - you can’t run Dia modules without Dia running. For example if you look into the dia.py file you see how it splices the ZIP into the OS by the sys.path.insert() and other details. Without this splice you’ll get a ‘no module’ error for every module called.

Your example makes no sense in a Dia context, as you’d NOT be calling ddo_set_param() and so on. Plus assuming your sensors sleep, then you cannot issue DDO to them, nor can you poll them for values.

That is the value of Dia - the complexities it forces on you help solve the fact that (as example) my temperature sensors send me a new value only every 15 minutes. In between those 15 minutes, any attempt to talk to that sleeping sensor just cripples my system for up to 30 seconds. I am forced to just let Dia collect the data for me, and them I have a temperature WITH a time-stamp which shows me what the historical value was.

Is there more to your sample than what you’ve posted? A very naive reading of the code and the error would indicate an attempt to use a component of the iDigi Dia source without building a complete Dia “application” using the Dia make.py script, etc. I would expect the devices module dependence to be made resolved in a dia.zip file, for instance.

Thank 52637p for your reply.
I repeated the procedure using the make.py the result was:

C:\iDigi_Dia>python make.py Vag2.py
Analyzing files…
Compiling files…
Zipping files…
Finished writing archive bin/dia.zip
Adding ‘Vag2.py’ as ‘dia.yml’…

I loader this new dia.zip to X4 and executed the Vag2.py example.

The result was:

Traceback (most recent call last):
File “”, line 7, in ?
ImportError: No module named xbee_sensor

Obviously there is a problem with the library I am using.
Any ideas on how I can run this example?

Oh, it’s not a side note at all. The key is definitely that there is a mixing of terms in the sample. A visit to the resources area on idigi.com may be helpful… there are documents with a few XBee related samples to serve as reference.

Ok I uploaded the xbee_sensor.py file directly to the X4.
The error message that I get I believe is no more library related. It now changed to:

Traceback (most recent call last):
File “”, line 15, in ?
Exception: ddo_get_param: error fetching DDO parameter.

This is an example from the manual!!!

This just means there was no response.

If your sensor is sleeping, you’ll always get that response since a sleeping node doesn’t see requests.

It also happens if the MAC address is unknown or the node is not connected/associated.