error handler reworked

This commit is contained in:
tkl 2017-01-03 21:04:26 +01:00 committed by Thomas Klaehn
parent 3a6ef57603
commit 129b74377b

View File

@ -32,7 +32,7 @@ POWER_SENSOR_I2C_ADDRESS = 0x40
POWER_CONSECUTIVE_READS = 1000 POWER_CONSECUTIVE_READS = 1000
MAX_ENGINE_POWER = {"up":310, "down":290} MAX_ENGINE_POWER = {"up":310, "down":290}
MAX_GATE_RUNTIME = {"open":300, "close":250} MAX_GATE_RUNTIME = {"open":300, "close":300}
class GateState(object): class GateState(object):
@ -166,10 +166,4 @@ class GateState(object):
self.__gate_handler.stop() self.__gate_handler.stop()
self.__comserver.transmit(MQTT_TOPIC, str(time()) + \ self.__comserver.transmit(MQTT_TOPIC, str(time()) + \
" Error handler!!!") " Error handler!!!")
if self.__error_count >= 5:
self.__update_state(STATE_INIT) self.__update_state(STATE_INIT)
self.__error_count += 1
else:
self.__comserver.transmit(MQTT_TOPIC, str(time()) + \
"Error Handler - couldn't reinitiate " + \
"system. Bye bye...")