encode string

master
Simon Pirkelmann 2021-08-23 21:10:43 +02:00
parent 4307d54505
commit 79b9b69ef8
1 changed files with 4 additions and 4 deletions

View File

@ -92,15 +92,15 @@ class DoorHandle:
if self.nfc_sock is not None:
self.nfc_sock.send(b'rld\n')
def open_door(self, user=b''):
def open_door(self, user=''):
if self.nfc_sock is not None:
self.nfc_sock.send(b'open ' + user + b'\n')
self.nfc_sock.send(b'open ' + user.encode() + b'\n')
else:
raise Exception("No connection to NFC socket. Cannot close door!")
def close_door(self, user=b''):
def close_door(self, user=''):
if self.nfc_sock is not None:
self.nfc_sock.send(b'close ' + user + b'\n')
self.nfc_sock.send(b'close ' + user.encode() + b'\n')
else:
raise Exception("No connection to NFC socket. Cannot close door!")