Skip to content

Instantly share code, notes, and snippets.

View brett-kimball's full-sized avatar

Brett Kimball brett-kimball

View GitHub Profile
@brett-kimball
brett-kimball / batch_enroll_nfc.py
Last active December 30, 2024 07:41
Unifi Access API - Batch Enroll Bulk NFC Cards
#!/usr/bin/env python3
import os, sys, requests, json, curses, time, signal, urllib3, subprocess, getopt
from filelock import FileLock, Timeout
""" Usage: batch_enroll_nfc.py [-h|-r "Reader Name"|-t ["NFC Cards"|"NFC Keyfobs"]]
This script opens a card enrollment session with the Unifi Access API on a card reader. As cards are
read, they are added to Unifi Access. Multiple cards can be read in a session, each will be assigned
a sequential numeric "display_id" by Access. The cards can then be assigned to users at a later date.
When all cards have been read, press Ctrl+C to terminate the enrollment session.