Home/Support/Support Forum/Xbee socket communication between two ZB modules

Xbee socket communication between two ZB modules

0 votes
Hello everyone,

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:

import xbee
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?

Thanks
asked Aug 8, 2016 in XBee Programmable Development by pabloncho New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
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.
answered Aug 9, 2016 by mvut Veteran of the Digi Community (12,765 points)
0 votes
Hello mvut

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.

Any ideas?
answered Aug 9, 2016 by pabloncho New to the Community (3 points)
...