Skip to content
Snippets Groups Projects
Commit 49db6ac1 authored by jkerdreu's avatar jkerdreu
Browse files

Added debug & test different spawn



git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2535 b32b6428-25c9-4566-ad07-03861ab6144f
parent 7eb4717a
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ def run(func,*args,**kwargs):
#logger.debug("Calling %s " % func)
func(*args,**kwargs)
except Exception as e:
logger.warning(f"{self.bulb} {e}")
logger.warning(f"{self.bulb} {e} calling {func}")
self.lock.release()
@decorator
......@@ -44,7 +44,6 @@ class YeelightDev(object):
self.setup()
self.set_xaal()
logger.info('New device at %s : %s' % (bulb._ip,self.addr))
# It's safer to use a lock to avoid the socket to be used w/ 2 greenlets at the same time.
# This can occurs on the device refresh
self.lock = gevent.lock.BoundedSemaphore(1)
......@@ -83,14 +82,11 @@ class YeelightDev(object):
self.bulb.turn_off()
self._update_properties()
#@spawn
def toggle(self):
#self.bulb.toggle()
if self.dev.attributes['light']:
self.turn_off()
else:
self.turn_on()
#self._update_properties()
@spawn
def get_properties(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment