diff --git a/server/app/worker.py b/server/app/worker.py index d794883..47a6af0 100644 --- a/server/app/worker.py +++ b/server/app/worker.py @@ -822,8 +822,6 @@ def open_the_door(self): GPIO.output(GPIO_LED_GREEN, GPIO.HIGH) def timer_cycle(self): - self.thr = threading.Timer(0.6, BackgroundWorker.timer_cycle, [self]) - self.thr.start() self.requestTimer += 1 @@ -906,8 +904,8 @@ def timer_cycle(self): print "Closing door" GPIO.output(GPIO_RELAY, GPIO.HIGH) self.ledState = self.LED_STATE_CLOSED - else: - GPIO.output(GPIO_RELAY, GPIO.HIGH) + #else: + # GPIO.output(GPIO_RELAY, GPIO.HIGH) self.ledStateTimer += 1 if self.ledStateTimer >= 0: @@ -923,6 +921,9 @@ def timer_cycle(self): db.session.add(logentry) db.session.commit() + # reschedule the timer cycle + self.thr = threading.Timer(0.6, BackgroundWorker.timer_cycle, [self]) + self.thr.start() def cancel(self): if os.environ.get("WERKZEUG_RUN_MAIN") == "true":