Reader now beebs when a tag is added or removed

This commit is contained in:
bton 2024-02-22 00:10:29 +01:00
parent 50dbcf504e
commit 66296df433

View file

@ -19,7 +19,7 @@ def onTagSense(tag):
response = requests.post(f"{url}tag_id", data={"id":id}) response = requests.post(f"{url}tag_id", data={"id":id})
print(response.json()) print(response.json())
try: try:
if response.json()["mode"] == "balance": if response.json()["mode"] == "balance" or response.json()["mode"] == "message":
return True return True
except: except:
None None
@ -32,6 +32,7 @@ def start_nfc_normal():
while True: while True:
clf.connect(rdwr={'on-connect': onTagSense, 'beep-on-connect': True }) clf.connect(rdwr={'on-connect': onTagSense, 'beep-on-connect': True })
time.sleep(0.75) time.sleep(0.75)
if __name__ == "__main__": if __name__ == "__main__":
start_nfc_normal() start_nfc_normal()