Commit 55d52a0b authored by Ralf's avatar Ralf
Browse files

fix init phase

parent b58178f7
......@@ -46,6 +46,8 @@ class PinWatcher():
return False
def state(self):
if self._state is None:
return None
return self._translate(self._state)
class PinsWatcher():
......@@ -77,7 +79,12 @@ class PinsWatcher():
# create return object
pinsState = PinsState()
for name in self._pins.keys():
setattr(pinsState, name, self._pins[name].state())
state = self._pins[name].state()
if state is None:
# a state is missing, don't return anything
pinsState = None
break
setattr(pinsState, name, state)
# send it to state machine
self._sm.callback(StateMachine.CMD_PINS, pinsState)
......
......@@ -179,7 +179,7 @@ class StateMachine():
self.fallback = fallback
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):
if pins is not None:
if self.fallback:
logger.info("StateMachine: Going to StateFallback because running in fallback mode")
return StateMachine.StateFallback(self.state_machine)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment