Merge branch 'master' of ralfj.de:saartuer
[saartuer.git] / statemachine.py
index 3a27adaf8c58a5cd384c417283bf82236450e706..a3c4affb860ed23733d41fbef7f4868f22c9889e 100644 (file)
@@ -143,13 +143,14 @@ class StateMachine():
                def handle_pins_event(self):
                        pins = self.pins()
                        if not (pins.door_locked is None or pins.door_closed is None or pins.space_active is None or pins.bell_ringing is None):
-                               logger.info("All sensors got a value, switching to a proper state")
                                if self.fallback:
                                        logger.info("Going to StateFallback because running in fallback mode")
                                        return StateMachine.StateFallback(self.state_machine)
                                if pins.door_locked:
+                                       logger.info("All sensors got a value, switching to a proper state: Space is closed")
                                        return StateMachine.StateZu(self.state_machine)
                                else:
+                                       logger.info("All sensors got a value, switching to a proper state: Space is (about to) open")
                                        return StateMachine.StateAboutToOpen(self.state_machine)
                        return super().handle_pins_event()
        
@@ -176,8 +177,7 @@ class StateMachine():
                                        self.actor().act(Actor.CMD_LOCK)
                                t = threading.Thread(target=_close_after_time)
                                t.start()
-                       # without return because we want to stay in fallback mode
-                       super().handle_pins_event()
+                       # not calling superclass because we want to stay in fallback mode
                def handle_wakeup_event(self):
                        # blink red LED
                        now = time.time()