Using Python to configure XBeePro and connected equipment

I am an hardware engineer and have never worked with Python before.

Glancing through Python Manuals I did not seem to find any method to modify my PCs COM port settings or send command to connected XBee modules or equipment connected to remote XBee modules.

Where can I find example code that shows how to use Python to modify XBee settings and/or address remote equipment connected to remote XBee units.

Were you able to find information on Python and Digi products programing?
I need to do some IO programing but information is scarce?


Are you trying to use Python on your PC or Python on a Digi ConnectPort X gateway?

If you are trying to use Python together with Zigbee on your PC there are no Zigbee software extensions available. The Zigbee functions mentioned in the Digi Python Programmers guide are only applicable to Zigbee running on a Digi ConnectPort product.

I thought I would make mention of this to save you some hassle if you were trying to get the XBee’s to work using Python on your PC.

Information is currently scarce. However, one place where there is some useful documentation is in the Digi Python Programming Guide.

Here’s a link:

This is available along with the sample code that it references on the CD that is distributed with the Digi ConnectPort X products.

If there are any specific areas or questions about usage that you have, feel free to ask them on this forum.

Thank you for the quick reply.
I did read the Digi Python Programming Guide and it was indeed helpful. However when I started looking into the sample code “Use DDO to Read Temp…” I could not find the _zigbee module. I also tried to find what parameters to use with ddo_set_param etc. in document 90000866_B but had no luck.
I’m just trying to write python code to manipulate XBee S2 module IOs and am wondering if I’m on the right track.

It certainly sounds like you’re on the right track. The data from 90000866_B in the Command Reference table are the valid arguments to the ddo_set_param call. To change the IOs, you’re probably interested in the D0-D7 commands.

you can see this in action in the “Use DDO to Read Temp…” example because that script sets DIO2 up to be a digital output that is high. On the XBee Sensor product, that enables power to the sensor. It then uses the “AC” command to activate the change.

When you say that you are unable to find the _zigbee module, do you mean that you get an ImportError exception? The _zigbee module is an internal C extension module provided by the system. It is not necessary to have it in the filesystem. I would recommend checking the spelling in the import command.

Great! It is starting to make sense. Will try it later today. Thanks again.

Yes, thank you. I wondered about that after I posted on the forum and, sure enough, that was the issue.
I’ve created a new app and it works as expected. Now I need more information on what’s available in module and what the parameter options are for the different functions available. All I have is the sample code in the Digi Python manual. Does anyone know where I can get that?

The Python zigbee module is built into the firmware of the ConnectPort X family of products.

This functionality is not available (yet) on a PC because ZigBee functionality is implemented as an extension of the network stack of the ConnectPort X family of products. In short, if you are familiar with the standard BSD family of network sockets functions (bind(), recvfrom(), sendto(), select(), etc.) learning how to program for ZigBee networks will be a snap!

Do you have a ConnectPort X device?