mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 02:14:26 +01:00
doorlockd.py: Add schnapper support
Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
d17f5c964a
commit
be0ab6b58a
@ -153,9 +153,11 @@ class LogicResponse(Enum):
|
||||
|
||||
class DoorHandler:
|
||||
state = DoorState.Close
|
||||
do_schnapper = False
|
||||
|
||||
CMD_UNLOCK = b'u'
|
||||
CMD_LOCK = b'l'
|
||||
CMD_SCHNAPPER = b's'
|
||||
BUTTON_LOCK_PRESS = b'L'
|
||||
BUTTON_UNLOCK_PRESS = b'U'
|
||||
BUTTON_EMERGENCY_PRESS = b'E'
|
||||
@ -201,10 +203,14 @@ class DoorHandler:
|
||||
|
||||
if self.state == DoorState.Open:
|
||||
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:
|
||||
self.send_command(DoorHandler.CMD_LOCK)
|
||||
|
||||
def open(self):
|
||||
self.do_schnapper = True
|
||||
if self.state == DoorState.Open:
|
||||
return LogicResponse.AlreadyOpen
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user