Add reset command, require login on open/close commands

This commit is contained in:
Lynn Ochs 2021-08-23 20:43:47 +02:00
parent ac3af2b567
commit 6f7e8eab79

View File

@ -418,14 +418,24 @@ class DoorControl:
self.logger.debug(f"Faking token {args[0]}") self.logger.debug(f"Faking token {args[0]}")
send("Handling token\n") send("Handling token\n")
self.handle_nfc_token(args[0]) self.handle_nfc_token(args[0])
elif cmd == 'reset':
self.logger.info("Resetting")
send("Resetting MCU")
self._send_door_cmd(b'S')
elif cmd == 'open': elif cmd == 'open':
self.logger.debug("Control socket opening door") if len(args) > 0:
send("Opening door") self.logger.info(f"Control socket opening door for {args[0]}")
self.open_door() send("Opening door")
self.open_door()
else:
send("Missing login")
elif cmd == 'close': elif cmd == 'close':
self.logger.debug("Control socket closing door") if len(args) > 0:
send("Closing door") self.logger.info(f"Control socket closing door for {args[0]}")
self.close_door() send("Closing door")
self.close_door()
else:
send("Missing login")
elif cmd == 'rld': elif cmd == 'rld':
self.logger.debug("Reloading tokens") self.logger.debug("Reloading tokens")
send("Reloading tokens") send("Reloading tokens")