System app to control the door access
Project description
Laboratory access door system
System service to control access to the Laboratory door. Use supervisor for daemonize and it's resilent to usb disconnections.
Web interface: https://github.com/rodrigodeleonv/door-access-mgm
TODO: PACKAGE THIS RELEASE
Install
Simple installation script.
sudo curl -fsSL https://raw.githubusercontent.com/rodrigodeleonv/lab-door-access/main/installer.sh | bash
- Install the service
- You need to configure:
/opt/rfid/config-reader.yml
- Go to admin (ex https://127.0.0.1/admin/) search or create the API Token
- Configure the correct URL endpoint
- Restart the service:
sudo supervisorctl restart rfid-usb-reader
Optional
- Logs:
tail -f /opt/rfid/app.log
- Verify service:
sudo supervisorctl status
Development
Configure Poetry
# Poetry
#
# test PyPi
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi pypi-YYYYYYYY
poetry publish --build -r test-pypi
#
# production PyPi
poetry config pypi-token.pypi pypi-XXXXXXXX
poetry publish --build
# poetry build
rm -rf dist/*
Debug
sudo $(which python) -m venv /opt/rfid-reader/env
sudo cp requirements-prod.txt /opt/rfid-reader/requirements.txt
sudo cp config-reader.yml /opt/rfid-reader/
# sudo source env/bin/activate
# sudo pip install -r requirements.txt
# How to install dependencies using test-pypi
sudo /opt/rfid-reader/env/bin/pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple lab-door-access
# Supervisor
sudo apt install supervisor -y
sudo cp usb-reader.conf /etc/supervisor/conf.d/
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart rfid-usb-reader
sudo supervisorctl status
# Clean
sudo rm /etc/supervisor/conf.d/usb-reader.conf
sudo supervisorctl reread
sudo supervisorctl update
#
sudo apt remove supervisor
USB RFID Redears
First, you need to identify the device. For example you have a USB RFID reader. It's likely that your RFID reader is functioning as a keyboard emulation device (HID keyboard).
# Use one of the following commands to find device
# 1
$ ls -lh /dev/input/by-id/
total 0
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Dell_Dell_USB_Keyboard-event-kbd -> ../event5
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-event-if01 -> ../event2
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-event-if02 -> ../event4
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-if01-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-if01-mouse -> ../mouse0
lrwxrwxrwx 1 root root 9 Mar 11 00:03 usb-Microsoft_Microsoft®_Nano_Transceiver_v1.0-if02-event-kbd -> ../event3
lrwxrwxrwx 1 root root 9 Apr 8 13:26 usb-Sycreader_RFID_Technology_Co.__Ltd_SYC_ID_IC_USB_Reader_08FF20140315-event-kbd -> ../event8 # <-- This is the Device
# 2: You need python evdev
$ python -m evdev.evtest
ID Device Name Phys Uniq
---------------------------------------------------------------------------------------------------------------------------------
0 /dev/input/event0 Microsoft Microsoft® Nano Transceiver v1.0 usb-0000:01:00.0-1.3/input0
1 /dev/input/event1 Microsoft Microsoft® Nano Transceiver v1.0 Mouse usb-0000:01:00.0-1.3/input1
2 /dev/input/event2 Microsoft Microsoft® Nano Transceiver v1.0 Consumer Control usb-0000:01:00.0-1.3/input1
3 /dev/input/event3 Microsoft Microsoft® Nano Transceiver v1.0 Consumer Control usb-0000:01:00.0-1.3/input2
4 /dev/input/event4 Microsoft Microsoft® Nano Transceiver v1.0 System Control usb-0000:01:00.0-1.3/input2
5 /dev/input/event5 Dell Dell USB Keyboard usb-0000:01:00.0-1.4/input0
6 /dev/input/event6 vc4-hdmi-0 vc4-hdmi-0/input0
7 /dev/input/event7 vc4-hdmi-1 vc4-hdmi-1/input0
8 /dev/input/event8 Sycreader RFID Technology Co., Ltd SYC ID&IC USB Reader usb-0000:01:00.0-1.2/input0 08FF20140315 # <-- This is the Device
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lab_door_access-0.2.0.tar.gz
(8.9 kB
view details)
Built Distribution
File details
Details for the file lab_door_access-0.2.0.tar.gz
.
File metadata
- Download URL: lab_door_access-0.2.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.6.28+rpt-rpi-v8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1d4c6f923323f32df57f3fc71abddea1e2ceb4f01c10c438a2d3e93bf4f65de |
|
MD5 | cf240d643cf899e9d1587e3029b3eccf |
|
BLAKE2b-256 | 8e777ab01dcfb43b63b333632754b8da323247540d9a69cd9f2f68d855523342 |
File details
Details for the file lab_door_access-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: lab_door_access-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.6.28+rpt-rpi-v8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5418e90c75a2cf2dc9b507f9658886b823d4a82226720ea6c3b06dd54e655a0d |
|
MD5 | 5a4874ba08440cc71dd531bc33e89585 |
|
BLAKE2b-256 | 89771b70f2b9d01d5a83a9a36aa25e0708ca668e0f0b0593001b571a1b86fdab |