1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24:26 +01:00

doorlockd.py: Add schnapper support

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-03-20 00:18:46 +01:00
parent d17f5c964a
commit be0ab6b58a

View File

@ -153,9 +153,11 @@ class LogicResponse(Enum):
class DoorHandler: class DoorHandler:
state = DoorState.Close state = DoorState.Close
do_schnapper = False
CMD_UNLOCK = b'u' CMD_UNLOCK = b'u'
CMD_LOCK = b'l' CMD_LOCK = b'l'
CMD_SCHNAPPER = b's'
BUTTON_LOCK_PRESS = b'L' BUTTON_LOCK_PRESS = b'L'
BUTTON_UNLOCK_PRESS = b'U' BUTTON_UNLOCK_PRESS = b'U'
BUTTON_EMERGENCY_PRESS = b'E' BUTTON_EMERGENCY_PRESS = b'E'
@ -201,10 +203,14 @@ class DoorHandler:
if self.state == DoorState.Open: if self.state == DoorState.Open:
self.send_command(DoorHandler.CMD_UNLOCK) self.send_command(DoorHandler.CMD_UNLOCK)
if self.do_schnapper:
self.send_command(DoorHandler.CMD_SCHNAPPER)
self.do_schnapper = False
elif self.state == DoorState.Close: elif self.state == DoorState.Close:
self.send_command(DoorHandler.CMD_LOCK) self.send_command(DoorHandler.CMD_LOCK)
def open(self): def open(self):
self.do_schnapper = True
if self.state == DoorState.Open: if self.state == DoorState.Open:
return LogicResponse.AlreadyOpen return LogicResponse.AlreadyOpen