Summary
Our current access control system was not all that flexible, and we want to switch to a new system.
Architecture
Door scanner
We have an Asia-Teco scanner speaks the wiegand protocol (details can be found here: https://a.aliexpress.com/_EJOtZhl). It has the following pinout on the cable:
VCC (+12V) | Red |
GND | Black |
D0/RX/4R+ | Green |
D1/TX/4R- | White |
LED | Blue |
BEEP | Yellow |
WG26/WG34 | Gray |
An arduino combined with a stepup converter is used to translate the wiegand protocol to a text-based format which is exposed over usb-serial. The code for this can be found here: https://github.com/NURDspace/spacenanny-wiegand-arduino. This is linked together according to the following schematic, using a long piece of cat5 as the cable:
This arduino is connected using USB to spacenanny, and we run the tag scanner software there (https://gitea.vm.nurd.space/NURDspace/tag-scanner).
Tag Scanner
To read out the scanner, we use the tag-scanner software [1]. Once started, it will connect to the serial port on which the scanner is connected and wait for the scanner to send tokens. On reception of a valid token, the token is combined with a seed, and hashed using SHA256. The hashed token is used to perform a lookup in tokens.json, which contains a mapping of token -> username. If a valid match is found, a HTTP call will be made to the door lock api to disengage the door lock. If there is no valid match, a warning will be logged and a message will be posted on mqtt.
For testing purposes, the tag-scanner has a mock class to use in place of the physical tag scanner. This will automaticallty be used if there is no usb serial device available. It will present itself as a prompt which can be used to enter a token.
The following is an example of running the tag-scanner in development mode, authenticating both a valid and an invalid token:
alita [tag-scanner] >> ./tag_scanner.py INFO: Connected to localhost:1883 INFO: Scanner not found, running with a mock scanner >> s 111234 INFO: Authorized access request for r3boot, disengaging door lock INFO: Door lock has been engaged >> s 111235 WARNING: Unknown token scanned: 69747dfa5ace63e857f16a73c268ce37b668a522eb6209a8b4478f3226a5d74e >>