Implemented retry mechanism

This commit is contained in:
Fabio Manganiello 2017-12-11 04:45:55 +01:00
parent ab9e86dc25
commit b4c445ecec

View file

@ -1,4 +1,5 @@
import logging import logging
import time
from phue import Bridge from phue import Bridge
@ -68,6 +69,11 @@ class LightHuePlugin(LightPlugin):
logging.exception(e) logging.exception(e)
# Reset bridge connection # Reset bridge connection
self.bridge = None self.bridge = None
if 'is_retry' not in kwargs:
time.sleep(1)
self._execute(attr, is_retry=True, *args, **kwargs)
return return
lights = []; groups = [] lights = []; groups = []