I’m trying to communicate two xbee ZB modules, in API mode, by implementing DIGI’s xbee socket extension (actually, I don’t know if it’s really possible)
So, first part of my python code goes like this:
from socket import*
sd = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)
which obviously fails (error: name ‘AF_ZIGBEE’ is not defined) because I don’t have the socket.AF_ZIGBEE module.
So my question is, how do I install this module?
The code you are working with is designed to run on an XBee gateway. Are you working with an XBee gateway? If not, then you need to take a step back and start by declaring a port.
No, I’m working with two xbee zb s2c modules. I think I’ve made some advances:
1.- I installed zigbee.py module from ftp://ftp1.digi.com/support/sampleapplications/zigbee_py-for-PC.zip
2.- Then I modified the python socket library following the instruction in this post: http://www.digi.com/support/forum/46719/why-do-i-get-a-nameerror-name-af_xbee-is-not-defined
3.- Finally, I managed to send data using the Send “Hello, World!” example in http://www.digi.com/wiki/developer/index.php/XBee_Extensions_to_the_Python_socket_API. I used minicom to read the data.
My main problem now is that I can’t receive the data using the Reading and Writing example of the previous page. The socket doesn’t detect data coming from the serial ports.