Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeoutException() when sending packet to remote device #82

Open
rell320 opened this issue Aug 2, 2019 · 0 comments
Open

TimeoutException() when sending packet to remote device #82

rell320 opened this issue Aug 2, 2019 · 0 comments

Comments

@rell320
Copy link

rell320 commented Aug 2, 2019

Currently I'm utilizing the XBee ZigBee Mesh modules to send and receive a broadcast message over a network. I have the modules attached to the grove boards that come with the ZigBee Mesh kit connected via USB to a PC. I'm using the Digi Python library for this task. I've configured the devices using XCTU software making sure they're on the same network, in API 1 mode, and that one device is the coordinator and the other is the router. I was able to successfully broadcast a message using the library and receive the message using the XCTU console as instructed in the "Hello World" introductory exercise. Next, I was able to send and receive a message running python from the terminal in Ubuntu. It wasn't until I created .py files for sending and receiving a broadcast packet that I started to have issues. Each time I try running the receive .py file, it gives me a TimeoutException() error. Not quite sure why this is at the moment.

The code used in the broadcast python script is the following:

#Python script to broadcast message over network
from digi.xbee.devices import XBeeDevice

#Instatiate an object and open serial connection to local device
device = XBeeDevice("/dev/ttyUSB1",9600)
device.open()

#Broadcast message over network
device.send_data_broadcast("Hello XBee World!")

device.close()

The code in the receive.py is the following

from digi.xbee.devices import XBeeDevice

#Instatiate an object and open serial connection to local device
device = XBeeDevice("/dev/ttyUSB0",9600)
device.open()

#Receive message over network
xbee_message = device.read_data(10)
print(xbee_message)

#Remote Device that sent the packet, timestamp, data and if it was broadcast
#remote_device = xbee_message.remote_device
data = xbee_message.data
#is_broadcast = xbee_message.is_broadcast
#timestamp= xbee_message.timestamp

print(data)
#print(is_broadcast)
#print(timestamp)
#print(remote_device)

device.close()

The error that I'm getting is the following

traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/digi/xbee/reader.py", line 908, in get
return Queue.get(self, True, timeout)
File "/usr/lib/python3.4/queue.py", line 175, in get
raise Empty
queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Receive.py", line 11, in
xbee_message = device.read_data(10)
File "/usr/local/lib/python3.4/dist-packages/digi/xbee/devices.py", line 1791, in read_data
return self.__read_data_packet(None, timeout, False)
File "/usr/local/lib/python3.4/dist-packages/digi/xbee/devices.py", line 1028, in dec_function
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/digi/xbee/devices.py", line 2285, in __read_data_packet
packet = self.__data_queue.get(timeout=timeout)
File "/usr/local/lib/python3.4/dist-packages/digi/xbee/reader.py", line 910, in get
raise TimeoutException()
digi.xbee.exception.TimeoutException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant