Ein modernes System zur Essensanmeldung fรผr die Feuerwehr, optimiert fรผr den Raspberry Pi mit 3,5" Touchscreen.
- ๐ RFID-Transponder: Automatische Anmeldung per ELATEC TWN4 HID Reader
- ๐ฑ QR-Code: Persรถnlicher QR-Code fรผr jeden User zum Ausdrucken
- ๐ข Personalnummer: Manuelle Eingabe am Touchscreen mit virtueller Tastatur (ausblendbar)
- ๐ฅ Gรคste: Schnelle +/- Buttons fรผr Besucher ohne Account
- ๐ฝ๏ธ Zwei-Menรผ-System: Optional zwei verschiedene Menรผs pro Tag
- ๐ Menรผ-Auswahl: Benutzer wรคhlen bei Anmeldung ihr Wunschmenรผ (RFID + Personalnummer)
- ๐ Getrennte Zรคhlung: Separate Anzeige fรผr Menรผ 1 und Menรผ 2
- โ Farbcodierte Bestรคtigung: Grรผn fรผr Anmeldung, Rot fรผr Abmeldung
- โฐ Anmeldefrist: Konfigurierbarer Deadline-Zeitpunkt (Standard: 19:45)
- ๐ Wochenplanung: 14-Tage-Vorausplanung mit Deadline-Einstellungen pro Tag
- ๐ฑ Touch-Display (3,5" 320x480): Modernes Dark-Theme, optimiert fรผr kleine Displays
- ๐ฝ๏ธ Kรผchenansicht: Live-Statistiken, Menรผ-Eingabe, Druckansicht (Auto-Refresh 5s)
- โ๏ธ Admin-Panel: User-Verwaltung, CSV-Import, Preset-Menรผs, Deadline-Konfiguration
- ๐ Statistiken: 14-Tage-รbersicht, CSV-Export
- ๐ Historie: Top-10-Esser, persรถnliche Statistiken, monatliche รbersicht
- ๐จ๏ธ Druckliste: Gruppiert nach Menรผ mit Checkboxen fรผr die Kรผche
- ๐ Admin-Login: Session-basierte Authentifizierung (Standard-Passwort: feuerwehr2026)
- โก Rate Limiting: Schutz vor API-Missbrauch (200/Tag, 50/Stunde)
- ๐ Logrotate: Automatische Log-Verwaltung (tรคglich, 14 Tage Retention)
- ๐ Webhooks: Benachrichtigungen via Slack, Discord, etc.
- ๐ REST-API: Integration mit externen Systemen
- ๐พ Auto-Backup: Tรคgliches Datenbank-Backup (00:30 Uhr)
- ๐ Auto-Reset: Anmeldungen werden tรคglich gelรถscht (00:00 Uhr)
- โฐ Cronjobs: Vollstรคndig konfigurierte automatische Aufgaben
- ๐จ Modernes Dark-Theme: Gradient-Background (#1e1e1e โ #2d2d2d), rote Akzente (#dc2626)
- ๐ Touch-optimiert: Groรe Buttons, virtuelle Tastatur auf Abruf
- ๐ฑ Responsive: Grid-Layout passt sich an alle Bildschirmgrรถรen an
- โก Live-Updates: Menรผ-Aktualisierung alle 5 Sekunden (Touch + Kรผche)
- ๐ญ Status-Popups: Groรe, farbcodierte Bestรคtigungen mit Icons
Fรผr Production-Deployment auf Raspberry Pi:
# Repository klonen
cd /home/pi
git clone https://github.com/Brunsben/FoodBot
cd FoodBot
# Automatisches Setup (als root)
sudo ./deployment/setup_production.shDas Skript installiert:
- โ Python Virtual Environment + Dependencies
- โ Systemd Service fรผr automatischen Start
- โ Logrotate Konfiguration
- โ Cronjobs fรผr Backup & Reset
- โ Optional: Nginx Reverse Proxy
๐ Ausfรผhrliche Deployment-Anleitung: DEPLOYMENT.md
git clone <repository-url> FoodBot
cd FoodBot
docker-compose up -d# Virtual Environment
python3 -m venv venv
source venv/bin/activate
# Dependencies
pip install -r requirements.txt
# Datenbank initialisieren
python -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()"
# Starten
gunicorn -c deployment/gunicorn.conf.py "app:create_app()"Nach der Installation erreichbar unter:
- Touch-Display:
http://<raspberry-pi>:5001/- Hauptinterface fรผr Anmeldung - Kรผchenansicht:
http://<raspberry-pi>:5001/kitchen- Fรผr Tablet/PC in der Kรผche - Admin-Panel:
http://<raspberry-pi>:5001/admin- Benutzerverwaltung (Login erforderlich) - Statistiken:
http://<raspberry-pi>:5001/stats- Auswertungen (Login erforderlich) - Historie:
http://<raspberry-pi>:5001/history- Essenshistorie & Top-10 (Login erforderlich)
- Passwort:
feuerwehr2026 - รndern via Environment-Variable:
ADMIN_PASSWORD=dein-passwort
Die API ist erreichbar unter /api/ und bietet folgende Endpoints:
GET /api/statusGibt aktuelles Menรผ, Anzahl Anmeldungen und Gรคste zurรผck.
Rate Limit: 30 Requests/Minute
POST /api/register
Content-Type: application/json
{
"personal_number": "12345"
}Rate Limit: 10 Requests/Minute
GET /api/stats?days=7GET /api/usersErstelle eine .env-Datei oder setze die Variablen im System:
# Admin-Passwort (Standard: feuerwehr2026)
ADMIN_PASSWORD=dein-sicheres-passwort
# Secret Key fรผr Sessions (WICHTIG in Production!)
SECRET_KEY=$(python3 -c 'import os; print(os.urandom(24).hex())')
# Flask Environment
FLASK_ENV=production
# RFID-Port (optional, Standard: /dev/ttyUSB0)
RFID_PORT=/dev/ttyUSB0
# Webhook fรผr Benachrichtigungen (optional)
WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL# Status prรผfen
sudo systemctl status foodbot
# Starten/Stoppen/Neustarten
sudo systemctl start foodbot
sudo systemctl stop foodbot
sudo systemctl restart foodbot
# Logs ansehen
journalctl -u foodbot -fBeispiel:
curl http://localhost:5000/api/status
curl -X POST http://localhost:5000/api/register \
-H "Content-Type: application/json" \
-d '{"personal_number": "12345"}'FoodBot/
โโโ app/
โ โโโ __init__.py # Flask App Factory
โ โโโ models.py # Datenbank-Modelle (User, Registration, Menu, AdminLog)
โ โโโ routes.py # Hauptrouten (Touch, Kitchen, Admin)
โ โโโ api.py # REST API mit Rate Limiting
โ โโโ stats.py # Statistik-Routes
โ โโโ history.py # Essenshistorie & Top-10
โ โโโ auth.py # Admin-Authentifizierung
โ โโโ rfid.py # RFID-Reader Integration (optional)
โ โโโ gunicorn_config.py # Gunicorn fรผr Docker
โโโ templates/
โ โโโ touch.html # 3,5" Touch-Interface (modernes Dark-Theme)
โ โโโ kitchen.html # Kรผchenansicht (Card-Layout)
โ โโโ admin.html # Admin-Panel (Drag & Drop CSV-Import)
โ โโโ stats.html # Statistiken
โ โโโ history.html # Historie-รbersicht
โ โโโ history_detail.html # User-Detail-Historie
โ โโโ *_modern.html # Moderne Design-Varianten (Backup)
โ โโโ *_old.html # Legacy-Templates (Backup)
โโโ deployment/
โ โโโ setup_production.sh # Automatisches Production-Setup
โ โโโ setup_cronjobs.sh # Cronjob-Installation
โ โโโ gunicorn.conf.py # Gunicorn Konfiguration
โ โโโ foodbot.service # Systemd Service
โ โโโ nginx-foodbot # Nginx Reverse Proxy Config
โ โโโ logrotate-foodbot # Log-Rotation Config
โ โโโ DISPLAY_SETUP.md # 3,5" Display Konfiguration (LCD-show)
โโโ backup_db.py # Automatisches Datenbank-Backup
โโโ clear_registrations.py # Tรคglich Anmeldungen lรถschen
โโโ docker-compose.yml # Docker Deployment
โโโ Dockerfile # Container-Image
โโโ requirements.txt # Python Dependencies
โโโ README.md # Diese Datei
โโโ DEPLOYMENT.md # Ausfรผhrliche Deployment-Anleitung
Backups werden automatisch tรคglich um 00:30 Uhr erstellt:
- Speicherort:
/home/pi/FoodBot/backups/ - Format:
foodbot_backup_YYYYMMDD_HHMMSS.db - Manuell:
python backup_db.py
# Application Logs
tail -f /var/log/foodbot/error.log
tail -f /var/log/foodbot/access.log
# Systemd Logs
journalctl -u foodbot -f
# Backup/Reset Logs
tail -f /var/log/foodbot/backup.log
tail -f /var/log/foodbot/reset.log# WARNUNG: Lรถscht alle Anmeldungen des heutigen Tages!
python clear_registrations.pycd /home/pi/FoodBot
git pull
source venv/bin/activate
pip install -r requirements.txt
sudo systemctl restart foodbotIm Admin-Panel kรถnnen Benutzer per CSV importiert werden.
Format:
Name,Personalnummer,Karte
Max Mustermann,12345,ABC1234
Erika Musterfrau,23456,XYZ5678Oder englisch:
name,personal_number,card_idDie Karten-ID (RFID) ist optional.
FoodBot kann Webhooks senden (Slack, Discord, Teams):
Konfiguration:
NOTIFICATIONS_ENABLED=true
WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URLEvents:
- โ Neue Anmeldung
โ ๏ธ Niedrige Teilnehmerzahl (< 5)- ๐ฅ Hohe Teilnehmerzahl (> 30)
sudo systemctl status foodbot
journalctl -u foodbot -n 50# Device prรผfen
ls -l /dev/ttyUSB*
# Berechtigungen
sudo usermod -a -G dialout pi
# Neu anmelden!# Service aktiv?
sudo systemctl status foodbot
# Port 5001 lauscht?
sudo netstat -tlnp | grep 5001Mehr Hilfe: DEPLOYMENT.md - Troubleshooting
- Backend: Python 3.11+, Flask 3.1
- Datenbank: SQLite mit SQLAlchemy 2.0
- Server: Gunicorn mit 4 Workern (Production)
- Reverse Proxy: Nginx (optional)
- Hardware: Raspberry Pi 4, ELATEC TWN4 HID RFID Reader, 3,5" ILI9486 Touchscreen (320x480)
- Display: LCD-show Treiber fรผr SPI-basierte Displays
- CSS: CSS Custom Properties (Variablen)
- Layout: CSS Grid & Flexbox
- Theme: Dark Mode (#0f172a Base, #dc2626 Primary, #10b981 Success)
- Typography: System Fonts (-apple-system, BlinkMacSystemFont, Segoe UI)
- Components: Card-basiert, Gradients, Shadow-Effekte
flask- Web Frameworkflask-sqlalchemy- ORMflask-limiter- Rate Limitingpyserial- RFID-Reader Kommunikationqrcode[pil]- QR-Code Generierunggunicorn- WSGI Serverpython-dotenv- Environment Configuration
- โ Session-basierte Admin-Authentifizierung
- โ Rate Limiting auf API-Endpoints
- โ CSRF-Protection (Flask-WTF)
- โ Prepared Statements (SQLAlchemy)
- โ Input Validation
MIT License - Frei verwendbar fรผr private und kommerzielle Projekte.
Pull Requests sind willkommen! Fรผr grรถรere รnderungen bitte zuerst ein Issue รถffnen.
Bei Problemen:
- DEPLOYMENT.md lesen
- Logs prรผfen (siehe Wartung)
- GitHub Issue รถffnen
๐ Entwickelt fรผr die Feuerwehr - Mit โค๏ธ und Python ๐