checking pin states is yet to implement
CMD_LOCK = 5
CMD_FALLBACK_ON = 6
CMD_FALLBACK_OFF = 7
CMD_LOCK = 5
CMD_FALLBACK_ON = 6
CMD_FALLBACK_OFF = 7
class State():
def __init__(self, state_machine, nervlist = None):
class State():
def __init__(self, state_machine, nervlist = None):
return StateMachine.StateFallback(self.state_machine)
def handle_cmd_fallback_off_event(self,arg):
arg("412 Precondition Failed: Not in fallback mode!")
return StateMachine.StateFallback(self.state_machine)
def handle_cmd_fallback_off_event(self,arg):
arg("412 Precondition Failed: Not in fallback mode!")
+ def handle_cmd_status_event(self,arg):
+ # TODO use a proper JSON lib
+ arg('200 okay: {state:\"%s\"}' % self.__class__.__name__)
def on_leave(self):
pass
def pins(self):
def on_leave(self):
pass
def pins(self):
return self.handle_cmd_fallback_on_event(arg)
elif ev == StateMachine.CMD_FALLBACK_OFF:
return self.handle_cmd_fallback_off_event(arg)
return self.handle_cmd_fallback_on_event(arg)
elif ev == StateMachine.CMD_FALLBACK_OFF:
return self.handle_cmd_fallback_off_event(arg)
+ elif ev == StateMachine.CMD_STATUS:
+ return self.handle_cmd_status_event(arg)
else:
raise Exception("Unknown command number: %d" % ev)
else:
raise Exception("Unknown command number: %d" % ev)
'who': CmdEntry(whocmd, 'Shows the list of people, who are allowed to control this system'),
'fallback_mode_on': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_on'),'WARNING: This action will be reported to the admins. Use this only in case of Sphinx hardware failure when you need to ignore erroneous sensor input!'), 'Sets the system in a state where it is less dependent on sensoric input. Use it only when sensors are broken.'),
'fallback_mode_off': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_off'),'WARNING: This action will be reported to the admins. Use this only if you have fixed the sensors of the Sphinx or activated fallback mode by accident!'), 'Resets the system to the default state. Use this when you have just repaired the sensors of the Sphinx.'),
'who': CmdEntry(whocmd, 'Shows the list of people, who are allowed to control this system'),
'fallback_mode_on': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_on'),'WARNING: This action will be reported to the admins. Use this only in case of Sphinx hardware failure when you need to ignore erroneous sensor input!'), 'Sets the system in a state where it is less dependent on sensoric input. Use it only when sensors are broken.'),
'fallback_mode_off': CmdEntry(prompt_sure(sendcmd(tuerSock, 'fallback_mode_off'),'WARNING: This action will be reported to the admins. Use this only if you have fixed the sensors of the Sphinx or activated fallback mode by accident!'), 'Resets the system to the default state. Use this when you have just repaired the sensors of the Sphinx.'),
+ 'status': CmdEntry(sendcmd(tuerSock, 'status'), 'Shows internal state and sensor information.'),
},{
# aliases
'open': 'unlock',
},{
# aliases
'open': 'unlock',
b'lock': StateMachine.CMD_LOCK,
b'fallback_mode_on': StateMachine.CMD_FALLBACK_ON,
b'fallback_mode_off': StateMachine.CMD_FALLBACK_OFF,
b'lock': StateMachine.CMD_LOCK,
b'fallback_mode_on': StateMachine.CMD_FALLBACK_ON,
b'fallback_mode_off': StateMachine.CMD_FALLBACK_OFF,
+ b'status': StateMachine.CMD_STATUS,
}
def __init__(self, sm):
}
def __init__(self, sm):