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