Esempio n. 1
0
def onclick_nfc():
    global main_box
    #popup box for nfc
    info(
        "NFC",
        "Please tap OK when ready, then tap your phone to the NFC box above.")
    del_main()
    nfc_subprocess.nfc_beam_recv()
    #get nfc code
    file = open("nfccode.txt", "r")
    nfc_code_get = file.read()
    print(nfc_code_get)
    #check if nfc code is valid
    r = requests.get('https://hizhh.me/api/unlock/1',
                     auth=HTTPBasicAuth(nfc_code_get, 'sdf'),
                     verify=False)
    if (r.text != "Unauthorized Access"):
        open_door()
        print("OPEN SESAME")
        time.sleep(5)
        servo.wait_for_lever()
        #time.sleep(20)
        close_door()
    file.close()
    file = open("nfccode.txt", "w+")
    file.close()
    main_box.destroy()
    nfc_subprocess.stop_stream()
    show_start()
Esempio n. 2
0
def counter():
    if (int(timeout_en.value) == 1
            and time.time() - float(start_time.value) > timeout_val):
        timeout_en.value = 0
        main_box.destroy()
        show_start()
        nfc_subprocess.stop_stream()
Esempio n. 3
0
def onclick_enter():
    global input_text
    global numpad
    global main_box
    enter_text = int(input_text.get())
    #do something with the password
    if (enter_text == password):
        open_door()
        time.sleep(5)
        #wait for lever sensor
        servo.wait_for_lever()
        #sleep(20)
        close_door()

    #example, you could probably add some encryption to this too by calling another file
    f = open("input.txt", "w+")
    f.write(str(enter_text))
    f.close()
    #example end
    main_box.destroy()
    show_start()
    nfc_subprocess.stop_stream()