You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tanner Collin 0428eb8921 Invert relay output 1 year ago
.gitignore Authenticate with portal to get list of cards 4 years ago
LICENSE Initial commit 4 years ago Improve README 1 year ago Invert relay output 1 year ago
requirements.txt Add debug logging, move settings to 1 year ago Add debug logging, move settings to 1 year ago


Door controller for scanning Protospace member cards on the front and back doors.


Install dependencies:

$ sudo apt update
$ sudo apt install python3 python3-pip python3-virtualenv supervisor git

Clone this repo:

$ git clone
$ sudo mv airlock/ /opt/
$ cd /opt/airlock

Hardware Access

Ensure Pi user has read permissions to /dev/ttyACA0 and /dev/watchdog.

Configure /etc/udev/rules.d/local.rules:

ACTION=="add", KERNEL=="dialout", MODE="0666"
ACTION=="add", KERNEL=="ttyACM0", MODE="0666"
ACTION=="add", KERNEL=="ttyAMA0", MODE="0666"
KERNEL=="watchdog", MODE="0666"

Also ensure /boot/cmdline.txt doesn't contain console=serial0,115200.

Then reboot:

$ sudo reboot

Main Script

Create a venv, activate it, and install:

$ virtualenv -p python3 env
$ source env/bin/activate
(env) $ pip install -r requirements.txt

Start an empty card_data.json:

(env) $ echo "{}" > card_data.json

Now you can run the script to test:

(env) $ DEBUG=true python

Copy and edit the settings file:

(env) $ cp
(env) $ vim

Process management

The script is kept alive with supervisor.

Configure /etc/supervisor/conf.d/airlock.conf:

command=/opt/airlock/env/bin/python -u

Script logs to /var/log/airlock.log. Remove -u from the above command when you're done testing.


This program is free and open-source software licensed under the MIT License. Please see the LICENSE file for details.

That means you have the right to study, change, and distribute the software and source code to anyone and for any purpose. You deserve these rights.