error handler expanded
This commit is contained in:
parent
24f263f9fb
commit
92080d650f
@ -56,6 +56,7 @@ class GateState(object):
|
|||||||
self.__power_data = DataBuffer(POWER_CONSECUTIVE_READS)
|
self.__power_data = DataBuffer(POWER_CONSECUTIVE_READS)
|
||||||
self.__gate_move_timeout = 0
|
self.__gate_move_timeout = 0
|
||||||
self.__light_read_timeout = 0
|
self.__light_read_timeout = 0
|
||||||
|
self.__error_count = 0
|
||||||
|
|
||||||
def poll(self):
|
def poll(self):
|
||||||
current_time = time()
|
current_time = time()
|
||||||
@ -165,4 +166,10 @@ 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!!!")
|
||||||
self.__update_state(STATE_INIT)
|
if self.__error_count >= 5:
|
||||||
|
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...")
|
||||||
|
Loading…
Reference in New Issue
Block a user