+ if not self.pins().door_locked:
+ return StateAboutToOpen(self.state_machine)
+ return super().handle_pins_event
+
+ class AbstractUnlockedState(State):
+ '''A state with invariant "The space is unlocked", switching to StateZu when the space becomes locked'''
+ def handle_pins_event(self):
+ if self.pins().door_locked:
+ if self.pins().space_active:
+ # FIXME the same state can be reached by first locking the door, and then activating the space. What to do then?
+ logger.info("StateMachine: door manually locked, but space switch is still on - going to StateZu")
+ play_sound("manual_lock")
+ return StateZu(self.state_machine)
+ return super().handle_pins_event
+
+ class StateStart(State):