TC100 Display Integration
Übersicht
Das Solar Log System integriert das AWTRIX3 TC100 LED Matrix Display für Echtzeit-Benachrichtigungen und Status-Anzeige.
Features
✅ Custom App: Solar-Status
- Persistente Anzeige in der App-Rotation
- Zeigt aktuelle Leistung und Tagesertrag
- Farbcodierte Status-Anzeige:
- 🟢 Grün: Alle Inverter online
- 🟠 Orange: Einige Inverter offline
- 🔴 Rot: Alle Inverter offline
- Automatische Aktualisierung alle 30 Sekunden
✅ Offline-Alarm
- Sofortige Benachrichtigung wenn Inverter offline geht
- RTTTL Warnton (7 schnelle Pieptöne) - keine SD-Karte nötig
- Eindeutige Notification-ID pro Inverter (UUID-basiert)
- Automatisches Löschen alter Notifications
✅ Notification-Lifecycle
- Inverter offline: Rote Warnung mit Alarm-Ton
- Inverter online: Alte Warnung wird gelöscht, grüne Info-Meldung
Konfiguration
.env Einstellungen
TC100 Einstellungen
Lautstärke: Min. 20% empfohlen für RTTTL-Töne
Sound: Muss aktiviert sein (SOUND: true)
SD-Karte: Nicht erforderlich (RTTTL nutzt Buzzer)
API Endpunkte
Custom App: Solar-Status
# Status aktualisieren
POST http://192.168.178.48/api/custom/solarlog
{
"text": "⚡3.2kW | ☀️8.5kWh",
"icon": 4644,
"color": [0, 255, 0],
"pushIcon": 2,
"duration": 10
}
# App entfernen
POST http://192.168.178.48/api/custom/solarlog
{}
Notifications
# Offline-Warnung mit RTTTL-Ton
POST http://192.168.178.48/api/notify
{
"text": "⚠️ WR1 offline!",
"color": [255, 0, 0],
"icon": 4644,
"name": "inverter-uuid-123-offline",
"rtttl": "alarm:d=8,o=6,b=200:c,c,c,p,c,c,c",
"duration": 60,
"hold": true,
"wakeup": true
}
# Notification löschen
GET http://192.168.178.48/api/notify/dismiss?name=inverter-uuid-123-offline
RTTTL Sound-System
Was ist RTTTL?
Ring Tone Text Transfer Language - einfache Text-basierte Melodien für Buzzer/Piezo-Speaker.
Vordefinierte Töne
| Severity | RTTTL | Beschreibung |
|---|---|---|
| info | ok:d=4,o=6,b=200:c |
Einzelner Piepton |
| warning | warn:d=4,o=6,b=180:c,p,c |
Doppel-Piepton |
| critical | alarm:d=8,o=6,b=200:c,c,c,p,c,c,c |
7 schnelle Pieptöne |
RTTTL Format
Beispiel: alarm:d=8,o=6,b=200:c,c,c,p,c,c,c
- d=8: 8tel-Noten als Standard
- o=6: Oktave 6 (hoher Ton)
- b=200: 200 BPM (schnell)
- Noten: c,c,c,p,c,c,c (3x C, Pause, 3x C)
Eigene RTTTL-Töne erstellen
# Kurzer Warnton
rtttl = "beep:d=4,o=6,b=200:c,p,c"
# Sirene (hoch-tief)
rtttl = "siren:d=8,o=5,b=100:c,c6,c,c6,c,c6"
# Aufsteigende Tonleiter
rtttl = "scale:d=4,o=5,b=180:c,d,e,f,g,a,b,c6"
Code-Beispiele
Python: Display Service verwenden
from app.services.display_service import get_display_service
# Display-Service abrufen
display = get_display_service()
# Solar-Status aktualisieren (Custom App)
await display.update_solar_status(
current_power=3200, # 3.2 kW
daily_energy=8.5, # 8.5 kWh
inverters_online=2,
inverters_total=2
)
# Offline-Warnung senden
await display.send_warning(
message="WR1 offline!",
severity="critical", # "info", "warning", "critical"
sound=True, # RTTTL-Ton abspielen
wakeup=True, # Display aufwecken
notification_id="inverter-uuid-123-offline"
)
# Notification löschen
await display.dismiss_notification("inverter-uuid-123-offline")
Display-Bridge: Automatische Verwaltung
from app.services.display_bridge import display_bridge
# Inverter-Status Update (automatisch)
await display_bridge.handle_inverter_update({
'id': 1,
'uuid': 'uuid-123',
'name': 'WR1',
'online': False, # Triggert Offline-Alarm
'enabled': True
}, action='updated')
Custom App vs Notification
| Feature | Custom App | Notification |
|---|---|---|
| Persistenz | ✅ Bleibt in App-Loop | ❌ Verschwindet nach duration |
| Rotation | ✅ Automatisch | ❌ Blockiert andere Apps |
| Update | ✅ Einfaches POST | ❌ Muss neu gesendet werden |
| Use Case | Status-Anzeige | Warnungen, Alerts |
Wann was verwenden?
Custom App (/api/custom/solarlog):
- ✅ Solar-Status (Leistung, Ertrag)
- ✅ Dauerhafte Informationen
- ✅ Regelmäßige Updates
Notification (/api/notify):
- ✅ Offline-Alarm
- ✅ Wichtige Warnungen
- ✅ Temporäre Meldungen mit Sound
Troubleshooting
Kein Ton hörbar
Problem: Notifications erscheinen, aber kein Sound
Lösungen:
1. ✅ Lautstärke prüfen: VOL in /api/settings (min. 20)
2. ✅ Sound aktivieren: SOUND: true in Settings
3. ✅ RTTTL statt sound verwenden (kein DFPlayer/SD nötig)
4. ✅ Alte Notification löschen vor neuer
# Lautstärke erhöhen
curl -X POST "http://192.168.178.48/api/settings" \
-H "Content-Type: application/json" \
-d '{"VOL": 50}'
Alte Notification bleibt sichtbar
Problem: "WR offline" wird nicht gelöscht
Lösung: Notification ohne name-ID kann nicht gelöscht werden
# Alle Notifications löschen
curl -X POST "http://192.168.178.48/api/notify/dismiss"
# Oder: Script verwenden
./scripts/clear_tc100_notifications.sh
Custom App erscheint nicht
Problem: Solar-Status wird nicht angezeigt
Prüfung:
Lösung: Custom App neu erstellen
curl -X POST "http://192.168.178.48/api/custom/solarlog" \
-H "Content-Type: application/json" \
-d '{
"text": "⚡0.0kW | ☀️0.0kWh",
"icon": 4644,
"color": [0, 255, 0]
}'
Weitere Ressourcen
Beispiel: Vollständiger Test
#!/bin/bash
TC100_IP="192.168.178.48"
# 1. Alte Notifications löschen
curl -X POST "http://${TC100_IP}/api/notify/dismiss"
# 2. Solar-Status Custom App erstellen
curl -X POST "http://${TC100_IP}/api/custom/solarlog" \
-H "Content-Type: application/json" \
-d '{
"text": "⚡3.5kW | ☀️12.3kWh",
"icon": 4644,
"color": [0, 255, 0],
"pushIcon": 2
}'
# 3. Offline-Alarm mit RTTTL testen
curl -X POST "http://${TC100_IP}/api/notify" \
-H "Content-Type: application/json" \
-d '{
"text": "🚨 TEST ALARM",
"color": [255, 0, 0],
"icon": 4644,
"rtttl": "alarm:d=8,o=6,b=200:c,c,c,p,c,c,c",
"name": "test-alarm",
"duration": 10,
"wakeup": true
}'
# 4. Nach 5 Sekunden Alarm löschen
sleep 5
curl "http://${TC100_IP}/api/notify/dismiss?name=test-alarm"
echo "✅ Test abgeschlossen!"
Monitoring
Backend Logs prüfen
# Display-relevante Logs anzeigen
docker compose logs -f backend | grep -i "display\|tc100\|notification"
# Beispiel-Ausgabe:
# 🔴 ALARM: WR1 offline - Warnung mit Ton gesendet!
# 🗑️ Offline-Notification für WR1 gelöscht
# ✅ Display: WR1 wieder online