Animation thread wrapped in a try-except to prevent the thread from exiting in case of temporary errors

This commit is contained in:
Fabio Manganiello 2018-07-28 14:05:04 +02:00
parent 61e211ee07
commit 6ebab5de25

View file

@ -502,6 +502,7 @@ class LightHuePlugin(LightPlugin):
(duration and time.time() - animation_start_time > duration):
break
try:
if animation == self.Animation.COLOR_TRANSITION:
for (light, attrs) in lights.items():
self.logger.info('Setting {} to {}'.format(light, attrs))
@ -519,6 +520,9 @@ class LightHuePlugin(LightPlugin):
stop_animation = _should_stop()
if stop_animation: break
except Exception as e:
self.logger.warning(e)
time.sleep(2)
lights = _next_light_attrs(lights)