Skip to content
/ jvm Public

A smtp server for handling the emails from Wittenborg 9100

Notifications You must be signed in to change notification settings

f-klubben/jvm

Repository files navigation

JVM

Statistics collector and generator for Wittenborg-91XX coffee-machine.

Jinja2 required for running. Black for formatting the code.

Get started:

python3 server.py

Run tests

python3 test.py

Styling

The project uses Black for formatting the code.

black --target-version py36 --line-length 120 --skip-string-normalization *.py

Systemd service

See coffee.service for in-use service. Service runs server.py to periodically handle mails and generate statistics. Generated html is symlinked to /var/www/coffee, which Apache exposes with SSL-cert stapling.

Technical details

Intercepting mails

The project acts as a SMTP server for the coffemachine using the smtplib. The coffeemachine sends a lot of mails to the server. This project then handles each of these mails.

For capturing SMTP mails for later test use:

python3 server.py capture

Emails are then saved under logged_mails/

Updating estimates

The coffeemachine has an internal counter for keeping track of the ingredients in the machine. The levels are being sent out using mails, but it only sends for 3 thresholds: Full, Empty and User Threshold. This complicates the collection of metrics to use in statistics. As such, the project creates estimates based on 2 other mails:

  • DrinkDispensedEvent: A mail sent every time a drink is dispensed. Each of these events has a cost associated with them in the Product-table.
  • MenuParameter: A mail sent every time a menu parameter has been changed. Whenever the coffeemachine has had X amount added to it, this mail will reflect it.

Generation of statistics

Inside generator there is a script which queries the database and creates a HTML report page.

About

A smtp server for handling the emails from Wittenborg 9100

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published