Changing to 'sidedoor'
This commit is contained in:
parent
f86911a4d2
commit
5feac037c5
3
doorrc
3
doorrc
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
# Name of this Raspberry Pi unit
|
# Name of this Raspberry Pi unit
|
||||||
CONTROLLER="deadbeef01"
|
#CONTROLLER="deadbeef01"
|
||||||
|
CONTROLLER="sidedoor"
|
||||||
|
|
||||||
# Server to send requests to
|
# Server to send requests to
|
||||||
SERVER = "http://openings.workantile.com/access/" + CONTROLLER
|
SERVER = "http://openings.workantile.com/access/" + CONTROLLER
|
||||||
|
|
13
doors.py
13
doors.py
|
@ -99,13 +99,20 @@ import serial
|
||||||
|
|
||||||
RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1)
|
RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1)
|
||||||
|
|
||||||
while True:
|
def read_rfid():
|
||||||
string = RFID_SERIAL.read(12)
|
string = RFID_SERIAL.read(12)
|
||||||
if len(string) == 0:
|
if len(string) == 0:
|
||||||
print("No tag read")
|
print("No tag read")
|
||||||
continue
|
#continue
|
||||||
else:
|
else:
|
||||||
key = string[1:11] #exclude start x0A and stop x0D bytes
|
key = string[1:11].decode() #exclude start x0A and stop x0D bytes
|
||||||
print(key)
|
print(key)
|
||||||
verify_key(key)
|
verify_key(key)
|
||||||
RFID_SERIAL.flushInput() # ignore errors, no data
|
RFID_SERIAL.flushInput() # ignore errors, no data
|
||||||
|
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
read_rfid()
|
||||||
|
except Exception(e):
|
||||||
|
print(e)
|
||||||
|
|
Loading…
Reference in New Issue