XBEE in sleep mode from Python app

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.


See http://cms.digi.com/resources/documentation/digidocs/90002219/#reference/r_sleep_mp.htm?Highlight=Sleep

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:


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’))


hi guys im new here
thanks for useful answers!