Exemplo n.º 1
0
        # if a user is given access via app user 0 and id
        else:
            fingerprint = 0
        # if a user is enrolled in the lock
        if fingerprint < 200:
            current_state = state

            while current_state == state:       
                motor1.run_motor(state)
                state = check_state()
                led('things')
                if loop:
                    db.connect()
                    db.update_message(message_id)
                    db.add_history(fingerprint, 1)
                    db.close()
                    loop = False
                manual = False
                

        # if a user is not allowed in the door
        else:
            led('red')
            result = take_picture()
            image = result[0]
            server_path = result[1]
            sftp(image)
            db.connect()
            db.add_history()
            db.add_image(server_path)