diff --git a/README.md b/README.md index 170932f..61a125d 100644 --- a/README.md +++ b/README.md @@ -5,29 +5,53 @@ Do you use a paper based tally sheet to count your team's coffee consumption? Throw it away and use `coffeebuddy`! -## Usage +## Setup Coffebuddy uses [pdm](https://pdm-project.org/en/latest/) to manage its python dependencies. -1. Install dependencies +Coffeebuddy is designed as a server-clients infrastructure. +I'm using a RaspberryPi 4 as server and multiple RaspberryPis 3 as consumer endpoints. +The endpoints are equipped with a smartcard reader and a touch screen for interaction. - ```sh - pdm sync - ``` +### Server - If `pyscard` fails building you might need to install dependencies. For Debian based distributions this would be +#### Hardware (recommendation) - ```sh - sudo apt install swig libpcsclite-dev - ``` +- RaspberryPi 4 +- External SSD to store database -2. Connect a pcsc smart card reader. - I use a [uTrust 4701f](https://support.identiv.com/4701f/). - Drivers for Ubuntu can be installed for example by +#### Software - ```sh - sudo apt install pcscd pcsc-tools - ``` +The server runs postgresql and uses certificated based authentication on client side. +Details are described in [Setting up postgresql database](./doc/postgresql.md). + +### Client + +#### Hardware (recommendation) + +- RaspberryPi 3 +- 7" touchscreen with 1024x600 pixel resolution +- Identiv uTrust 1401f PCSC cardreader +- 3D printed housing (see [doc/housing.md](./doc/housing.md)) including: + - a PIR for presence detection (see [coffeebuddy/pir.py](./coffeebuddy/pir.py)) + - a multicolor LED for status indication (see [coffeebuddy/illumination.py](./coffeebuddy/illumination.py)) + +#### Software + +1. Install cardreader dependencies + If using a PCSC cardreader and a Debian based distributions: + + ```sh + sudo apt install swig libpcsclite-dev pcscd pcsc-tools + ``` + +2. Install Python dependencies + + ```sh + pip install --user pdm + + pdm sync + ``` 3. Start `production` environment @@ -35,28 +59,29 @@ Coffebuddy uses [pdm](https://pdm-project.org/en/latest/) to manage its python d ./bin/run.py ``` - or `development` environment +##### Debugging - ```sh - FLASK_ENV=development ./bin/run.py - ``` +The `development` environment can be run using + +```sh +FLASK_DEBUG=1 ./bin/run.py +``` ## Tests Run tests with `pytest -v tests` - -## Application +## Troubleshooting The final application uses a Raspberry Pi attached to a 7" touchscreen. Thus, the HTML an CSS is optimized for a display with a resolution of 1024x600. -### Configuration for Raspberry Pi +### Proper configuration for Clients #### Misc At least I had to adjust the following settings: -* Fix screen resolution +- Fix screen resolution ```conf hdmi_group=2 @@ -65,7 +90,7 @@ At least I had to adjust the following settings: hdmi_drive=2 ``` -* If display has to be rotated by 180° adjust `/etc/X11/xorg.conf.d/40-libinput.conf` +- If display has to be rotated by 180° adjust `/etc/X11/xorg.conf.d/40-libinput.conf` ```conf Section "InputClass" @@ -77,7 +102,7 @@ At least I had to adjust the following settings: EndSection ``` -* Disable translation option in chrome +- Disable translation option in chrome #### Card reader diff --git a/bin/run.py b/bin/run.py index da9eac2..7a2cb4d 100755 --- a/bin/run.py +++ b/bin/run.py @@ -25,7 +25,7 @@ raise app.socketio.run( app, - use_reloader=False, + use_reloader=app.debug, host=app.config["HOST"] if "HOST" in app.config else "", ssl_context="adhoc" if app.config["SSL"] else None, allow_unsafe_werkzeug=True,