Files
Eurojackpot-Tipp-Generator/documentation/NOTIFICATIONS_SETUP.md
T
cbazzaandClaude Sonnet 4.5 70e0638dee Initial commit: Eurojackpot analysis and prediction system
This repository contains a comprehensive Eurojackpot lottery analysis and prediction system including:
- Historical data analysis and processing
- ML-based prediction models
- Automated weekly tip generation
- Position and range analysis tools
- Notification system for results

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-16 15:53:01 +01:00

485 lines
11 KiB
Markdown

# 📱 Benachrichtigungen Setup-Guide
Erhalte automatische Benachrichtigungen über:
- 🎲 Neu generierte Tipps (mit bestem Tipp)
- 🎯 Ziehungsergebnisse (deine Treffer)
- ❌ System-Fehler
## 📋 Übersicht
Das System unterstützt **zwei Benachrichtigungskanäle**:
1. **Telegram Bot** (empfohlen) - Push-Benachrichtigungen auf dein Handy
2. **E-Mail (SMTP)** - Klassische E-Mail-Benachrichtigungen
Du kannst beide aktivieren oder nur einen davon nutzen.
---
## 🤖 Telegram Bot Setup (Empfohlen)
### Schritt 1: Bot erstellen
1. Öffne Telegram und suche nach `@BotFather`
2. Sende `/newbot`
3. Gib einen Namen ein (z.B. "Eurojackpot Notifier")
4. Gib einen Username ein (muss auf `bot` enden, z.B. `eurojackpot_tips_bot`)
5. **Kopiere den Bot Token** (Format: `123456789:ABCdefGHIjklMNOpqrsTUVwxyz`)
### Schritt 2: Chat ID ermitteln
#### Option A: Via GetUpdates API (einfach)
1. Sende eine Nachricht an deinen Bot (z.B. "/start")
2. Öffne im Browser:
```
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
```
(Ersetze `<YOUR_BOT_TOKEN>` mit deinem Token)
3. Suche nach `"chat":{"id":` - die Zahl danach ist deine Chat ID (z.B. `123456789`)
#### Option B: Via @userinfobot (noch einfacher)
1. Suche in Telegram nach `@userinfobot`
2. Sende `/start`
3. Der Bot antwortet mit deiner Chat ID
### Schritt 3: Konfiguration
Bearbeite die Datei `config/notifications.json`:
```json
{
"telegram": {
"enabled": true,
"bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"chat_id": "123456789"
},
"email": {
"enabled": false
}
}
```
### Schritt 4: Test
```bash
cd "/Users/sebastianfrohlich/Library/Mobile Documents/com~apple~CloudDocs/Jupyter Notebooks/Eurojackpot"
source venv/bin/activate
python scripts/utils/notifier.py --test
```
Du solltest jetzt eine Test-Nachricht auf Telegram erhalten! ✅
---
## 📧 E-Mail Setup
### Gmail verwenden
#### Schritt 1: App-Passwort erstellen
Gmail erfordert ein **App-Passwort** (nicht dein normales Passwort):
1. Gehe zu https://myaccount.google.com/security
2. Aktiviere **2-Faktor-Authentifizierung** (falls noch nicht aktiv)
3. Suche nach "App-Passwörter"
4. Wähle "Mail" und "Sonstiges Gerät"
5. Gib einen Namen ein (z.B. "Eurojackpot Bot")
6. **Kopiere das 16-stellige Passwort** (Format: `xxxx xxxx xxxx xxxx`)
#### Schritt 2: Konfiguration
Bearbeite `config/notifications.json`:
```json
{
"telegram": {
"enabled": false
},
"email": {
"enabled": true,
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "deine.email@gmail.com",
"smtp_password": "xxxx xxxx xxxx xxxx",
"from_email": "deine.email@gmail.com",
"to_email": "deine.email@gmail.com"
}
}
```
### Andere E-Mail-Provider
#### iCloud Mail
```json
{
"email": {
"enabled": true,
"smtp_server": "smtp.mail.me.com",
"smtp_port": 587,
"smtp_user": "deine.email@icloud.com",
"smtp_password": "app-spezifisches-passwort",
"from_email": "deine.email@icloud.com",
"to_email": "deine.email@icloud.com"
}
}
```
#### Outlook/Hotmail
```json
{
"email": {
"enabled": true,
"smtp_server": "smtp-mail.outlook.com",
"smtp_port": 587,
"smtp_user": "deine.email@outlook.com",
"smtp_password": "dein-passwort",
"from_email": "deine.email@outlook.com",
"to_email": "deine.email@outlook.com"
}
}
```
#### Web.de / GMX
```json
{
"email": {
"enabled": true,
"smtp_server": "smtp.web.de", // oder smtp.gmx.net
"smtp_port": 587,
"smtp_user": "deine.email@web.de",
"smtp_password": "dein-passwort",
"from_email": "deine.email@web.de",
"to_email": "deine.email@web.de"
}
}
```
### Schritt 3: Test
```bash
python scripts/utils/notifier.py --test
```
Prüfe deinen E-Mail-Posteingang! 📧
---
## 🔔 Beide Kanäle aktivieren
Für maximale Zuverlässigkeit:
```json
{
"telegram": {
"enabled": true,
"bot_token": "YOUR_BOT_TOKEN",
"chat_id": "YOUR_CHAT_ID"
},
"email": {
"enabled": true,
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "your.email@gmail.com",
"smtp_password": "YOUR_APP_PASSWORD",
"from_email": "your.email@gmail.com",
"to_email": "your.email@gmail.com"
}
}
```
---
## 📬 Benachrichtigungs-Typen
### 1. Tipps generiert
**Wann:** Nach erfolgreicher Tipp-Generierung
**Telegram/E-Mail:**
```
🎲 NEUE EUROJACKPOT-TIPPS GENERIERT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Anzahl Tipps: 10
⏰ Zeitpunkt: 2025-11-25 09:00
🏆 BESTER TIPP (höchste Confidence):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔢 Hauptzahlen: 3-23-29-32-41
⭐ Eurozahlen: 8-9
📈 Strategie: HYBRID-OPT
💎 Confidence: 39.16%
💡 Alle Tipps findest du in der CSV-Datei!
Viel Glück! 🍀
```
### 2. Ziehung ausgewertet
**Wann:** Nach Verarbeitung einer neuen Ziehung
**Telegram/E-Mail:**
```
🎰 EUROJACKPOT-ZIEHUNG AUSGEWERTET
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📅 Datum: 2025-11-21
🎲 GEZOGENE ZAHLEN:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔢 Hauptzahlen: 5-8-21-37-46
⭐ Eurozahlen: 6-8
🎊 DEINE BESTEN TREFFER:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔢 Hauptzahlen: 3 Treffer
⭐ Eurozahlen: 1 Treffer
🎯 Gesamt: 4 Treffer
📊 Bewertung: Sehr gut!
📈 DURCHSCHNITT ALLER TIPPS:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔢 Main: 1.2 Treffer
⭐ Euro: 0.8 Treffer
💡 Details im Performance-Report!
```
### 3. Fehler-Benachrichtigung
**Wann:** Bei System-Fehlern (nur via Telegram für schnelle Reaktion)
**Telegram:**
```
❌ FEHLER IM EUROJACKPOT-SYSTEM
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📍 Kontext: Tipp-Generierung
🔴 Fehler: Connection timeout
💡 Bitte System-Logs prüfen!
```
---
## 🛠️ Troubleshooting
### Telegram-Bot antwortet nicht
**Problem:** Test-Nachricht kommt nicht an
**Lösung:**
1. Überprüfe Bot Token und Chat ID
2. Stelle sicher, dass du `/start` an deinen Bot gesendet hast
3. Teste manuell:
```bash
curl "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage?chat_id=<YOUR_CHAT_ID>&text=Test"
```
### E-Mail kommt nicht an
**Problem:** Test-E-Mail wird nicht empfangen
**Lösung:**
1. Prüfe Spam-Ordner
2. Bei Gmail: Stelle sicher, dass du ein **App-Passwort** verwendest (nicht dein normales Passwort)
3. Teste SMTP-Verbindung:
```bash
python3 -c "
import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('your@email.com', 'your-app-password')
print('✅ Verbindung erfolgreich!')
server.quit()
"
```
### Gmail: "Username and Password not accepted"
**Ursache:** Du verwendest dein normales Passwort statt App-Passwort
**Lösung:**
1. Aktiviere 2-Faktor-Authentifizierung
2. Erstelle App-Passwort (siehe oben)
3. Verwende das 16-stellige App-Passwort in der Config
### Keine Benachrichtigungen trotz Config
**Mögliche Ursachen:**
1. `enabled: false` in der Config
2. Fehlende oder ungültige Credentials
3. Netzwerkprobleme
**Debug:**
```bash
# Teste direkt
python scripts/utils/notifier.py --test
# Prüfe Config
cat config/notifications.json
```
---
## 🔐 Sicherheit
### Config-Datei schützen
Die `notifications.json` enthält sensible Daten (Bot Token, Passwörter).
**Best Practices:**
1. **Nie committen:**
```bash
# .gitignore
config/notifications.json
```
2. **Permissions setzen:**
```bash
chmod 600 config/notifications.json
```
3. **Backups verschlüsseln:**
```bash
# Backup erstellen
cp config/notifications.json config/notifications.json.backup
# Verschlüsseln (optional)
openssl enc -aes-256-cbc -salt -in config/notifications.json.backup -out config/notifications.json.backup.enc
```
### App-Passwörter verwenden
- **Niemals** dein Haupt-E-Mail-Passwort in Scripts verwenden
- Immer App-spezifische Passwörter erstellen
- Bei Verdacht auf Kompromittierung: App-Passwort sofort widerrufen
---
## 💡 Tipps & Tricks
### Benachrichtigungen nur für wichtige Events
Nur Ziehungsergebnisse (keine Tipp-Generierung):
1. Editiere `scripts/automation/weekly_tip_generator.py`
2. Kommentiere Zeilen 178-194 aus (Benachrichtigungs-Block)
### Mehrere Empfänger (E-Mail)
```json
{
"email": {
"to_email": "empfaenger1@example.com, empfaenger2@example.com"
}
}
```
### Stille Stunden (keine Benachrichtigungen nachts)
Füge in `notifier.py` hinzu:
```python
from datetime import datetime
def _should_send(self):
hour = datetime.now().hour
# Keine Benachrichtigungen zwischen 22:00 und 08:00
if hour >= 22 or hour < 8:
return False
return True
```
### Telegram Gruppen-Chat
Statt persönlicher Chat ID kannst du auch eine Gruppen-ID verwenden:
1. Erstelle Telegram-Gruppe
2. Füge deinen Bot hinzu
3. Sende `/start@your_bot_name` in der Gruppe
4. Hole Gruppen-ID via getUpdates (Format: `-123456789`, negativ!)
---
## 📱 Beispiel-Nachrichten
### Montag 09:00 - Tipps generiert
> 🎲 **NEUE EUROJACKPOT-TIPPS GENERIERT**
>
> 📊 10 Tipps für Dienstag-Ziehung bereit!
>
> 🏆 Bester Tipp: 3-23-29-32-41 + 8-9
> Confidence: 39.16% (HYBRID-OPT)
>
> Viel Glück! 🍀
### Dienstag 21:00 - Ergebnis
> 🎰 **ZIEHUNG VOM 2025-11-25**
>
> Gezogene Zahlen: 5-8-21-37-46 + 6-8
>
> 🎊 Dein bester Tipp: **4 Treffer!**
> (3 Main + 1 Euro)
>
> Sehr gut! 📈
---
## ✅ Checkliste
- [ ] Telegram Bot erstellt (@BotFather)
- [ ] Bot Token kopiert
- [ ] Chat ID ermittelt (via getUpdates oder @userinfobot)
- [ ] `config/notifications.json` erstellt
- [ ] Telegram aktiviert (`enabled: true`)
- [ ] Test-Nachricht erfolgreich (`python scripts/utils/notifier.py --test`)
- [ ] (Optional) E-Mail konfiguriert
- [ ] (Optional) Gmail App-Passwort erstellt
- [ ] (Optional) E-Mail-Test erfolgreich
- [ ] Config-Datei gesichert (`chmod 600`)
- [ ] In `.gitignore` eingetragen
---
## 🆘 Support
Bei Problemen:
1. **Teste manuell:**
```bash
python scripts/utils/notifier.py --test
```
2. **Prüfe Logs:**
```bash
tail -100 logs/tips_generation.log
tail -100 logs/auto_update.log
```
3. **Validiere Config:**
```bash
python3 -c "import json; print(json.load(open('config/notifications.json')))"
```
4. **Telegram API testen:**
```bash
curl "https://api.telegram.org/bot<TOKEN>/getMe"
```
---
**Version:** 1.0
**Erstellt:** 2025-11-25
**Kompatibel mit:** Eurojackpot Automation System V1.0