Pass key from RFID reader to verify_key()
This is better than everybody getting in by using my key :) Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
54ed9e258e
commit
c318e74ea0
12
doors.py
12
doors.py
|
@ -76,9 +76,6 @@ RFID_SERIAL = serial.Serial('/dev/ttyUSB0', 2400, timeout=1)
|
||||||
|
|
||||||
from urllib import request
|
from urllib import request
|
||||||
|
|
||||||
# Anna's key
|
|
||||||
KEY="1F00D0B045"
|
|
||||||
|
|
||||||
# Which door controller are we?
|
# Which door controller are we?
|
||||||
CONTROLLER="deadbeef01"
|
CONTROLLER="deadbeef01"
|
||||||
|
|
||||||
|
@ -93,15 +90,12 @@ def verify_key(key):
|
||||||
RFID_SERIAL.flushInput() # ignore errors, no data
|
RFID_SERIAL.flushInput() # ignore errors, no data
|
||||||
|
|
||||||
|
|
||||||
import sys
|
|
||||||
#sys.exit(0)
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
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:
|
||||||
string = string[1:11] #exclude start x0A and stop x0D bytes
|
key = string[1:11] #exclude start x0A and stop x0D bytes
|
||||||
print(string)
|
print(key)
|
||||||
verify_key(KEY)
|
verify_key(key)
|
||||||
|
|
Loading…
Reference in New Issue