Fix error action
This commit is contained in:
parent
2d2de33304
commit
7593626e79
@ -85,9 +85,13 @@ class Scene(threading.Thread, mqtt.Client):
|
||||
try:
|
||||
r = futures.result(timeout=0)
|
||||
if r != Action.SUCCESS:
|
||||
self.logger.error("Action error")
|
||||
# empty the futures list to jump on else statement
|
||||
self.logger.error("Action: '%s' error", action.name)
|
||||
self.logger.info('Activating error')
|
||||
self.__executor.join()
|
||||
self.__executor = None
|
||||
self.__activating_r_futures = []
|
||||
self.__state = Scene.STATE_DEACTIVATE
|
||||
self.__send_state()
|
||||
break
|
||||
except concurrent.futures.TimeoutError:
|
||||
break
|
||||
@ -95,6 +99,7 @@ class Scene(threading.Thread, mqtt.Client):
|
||||
self.logger.info('Activating terminate')
|
||||
self.__executor.join()
|
||||
self.__executor = None
|
||||
self.__activating_r_futures = []
|
||||
self.__state = Scene.STATE_ACTIVATE
|
||||
self.__send_state()
|
||||
|
||||
@ -179,6 +184,10 @@ class Action(object):
|
||||
def failed(self):
|
||||
return Action.FAILED
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.__class__.__name__
|
||||
|
||||
class Publish(Action):
|
||||
|
||||
def __init__(self, topic: str):
|
||||
|
Loading…
x
Reference in New Issue
Block a user