Door Access Pi

From Leeds Hackspace Wiki
Jump to: navigation, search

The door access Pi interfaces with the Arduino that controls the main entrance door, allowing membership card data to be synced onto it.

Purpose

Store a list of valid membership cards and syncs them onto the door access Arduino (documented in Marvin P Droid).

The intent is that eventually this Pi won't be responsible for storing the membership cards access list, and that it will obtain that list from another server/service.

Usage/maintenance

Only committee members may access the door Pi due to it containing membership data.

It is accessible on the network as the DNS entry door-pi.lan. SSH credentials are known by committee.

Note: there are issues with the DNS; if it fails, for the time being I recommend going to the router webpage (192.168.1.254) and find the current IP for the mac address: b8:27:eb:0c:eb:56 or name 'door-pi' on the connected devices list.

Common Tasks

Edit the list of cards

The cards list is located at /opt/notdoord/cards.dat. Use the text editor of your choice to make changes; be sure to adhere to the file format accurately.

nano /opt/notdoord/cards.dat

sudo systemctl restart notdoord

See if the daemon is running

If the daemon is running, the output of this command will include the text "Active: active (running)"

systemctl status notdoord

Restart the notdoord daemon

Restarting the daemon may fix issues if the door appears to be acting weirdly.

sudo systemctl restart notdoord

View notdoord's logs

Since notdoord runs as a systemd unit, the logs are available in the journal:

sudo journalctl -fu notdoord.service

Update notdoord's code

The codebase is checked out as a git repo, so pulling any changes and restarting the daemon should suffice:

cd /opt/notdoord

git pull

sudo systemctl restart notdoord

Reload systemd after changing the notdoord service definition

This should only be necessary if you modify /etc/systemd/system/notdoord.service; there should be very few reasons why this is necessary.

sudo systemctl daemon-reload

sudo systemctl restart notdoord

Software

The door Pi is running a Python 3 daemon notdoord which interfaces with the door Arduino via a USB-to-serial adapter. See the GitHub repo README for more information on how it works.

Setup

The Pi is running Raspbian Lite based on Debian Jessie, and just runs the notdoord daemon, the code for which is checked out as a git repo at /opt/notdoord.

The daemon is configured to run by a systemd service, called "notdoord", running under the user/group notdoord. The notdoord user has no login shell, a random password, and no other permissions.

The definition of the systemd service is at /etc/systemd/system/notdoord.service.