Home/Support/Support Forum/XBEE in sleep mode from Python app
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

XBEE in sleep mode from Python app

0 votes
Hi all,
I am trying to put XBEE 3.0 module in sleep mode through Python app. However I am getting EALREADY error. I configured XBEE to be end device using XCTU. How can I over come this error and put XBEE module in sleep mode? Thank you for your time.

RGDS
NPS
asked Jun 9, 2021 in Python by Parthasaradhi New to the Community (0 points)

Please log in or register to answer this question.

2 Answers

0 votes
See http://cms.digi.com/resources/documentation/digidocs/90002219/#reference/r_sleep_mp.htm?Highlight=Sleep
answered Jun 21, 2021 by mvut Veteran of the Digi Community (15,156 points)
0 votes
Python sleep() will pause for an hour, day or whatever if given the proper value. It does not allow other processes take place (in same script) however. A better way is to use an event which will create an event on timeout.

Have a look at threading.Timer. It runs your function in a new thread without using sleep().

from threading import Timer

def hello():
print "hello, world"

t = Timer(30.0, hello)
t.start() # after 30 seconds, "hello, world" will be printed

The second method to delay would be using the implicit wait method:

driver.implicitly_wait(5)

The third method is more useful when you have to wait until a particular action is completed or until an element is found:

self.wait.until(EC.presence_of_element_located((By.ID, 'UserName'))

http://net-informations.com/python/pro/sleep.htm
answered May 17 by warrenfelsh New to the Community (1 point)
...