Files
battery-charging-optimizer/openems/legacy/v3/battery_optimizer_dashboard.yaml
felix.zoesch 0fa03a566a feat: Major update - Battery Optimizer v3.4.0 with comprehensive fixes
## 🎯 Hauptänderungen

### Version 3.4.0 - SOC-Drift & Charging Capacity
-  Sicherheitspuffer (20-50% konfigurierbar) für untertägige SOC-Schwankungen
-  Monatliche automatische Batterie-Kalibrierung
- 🐛 SOC-Plausibilitäts-Check (filtert 65535% Spikes beim Modus-Wechsel)
- 🐛 Zeitabhängige API-Abfrage (vor/nach 14:00 Uhr)

### Neue Features
- 🔋 **Safety Buffer**: Kompensiert SOC-Drift und Eigenverbrauch
- 🔋 **Auto-Calibration**: Monatlicher Vollzyklus für SOC-Genauigkeit
- 🔋 **Spike Protection**: 4-fach Schutz gegen ungültige SOC-Werte
- 🔋 **Smart API**: Verhindert HTTP 500 Errors bei fehlenden Tomorrow-Preisen

### Dokumentation
- 📚 SOC_CALIBRATION_GUIDE.md - Umfassender Kalibrierungs-Guide
- 📚 FIX_CHARGING_CAPACITY.md - Sicherheitspuffer-Dokumentation
- 📚 FIX_SOC_SPIKE_PROBLEM.md - Spike-Protection-Lösung
- 📚 FIX_API_TIMING.md - Zeitabhängige API-Abfrage
- 📚 DIAGNOSE_LADE_PROBLEM.md - Debug-Guide

### Neue Dateien
- battery_calibration_automation.yaml - 4 Automations für Kalibrierung
- battery_calibration_input_helper.yaml - Input Helper Config
- battery_optimizer_input_helper_safety_buffer.yaml - Puffer Config
- debug_schedule.py - Umfassendes Debug-Script

### Scripts
- battery_charging_optimizer.py v3.4.0
- hastrom_flex_extended.py v1.1.0
- debug_schedule.py v1.0.0

### Fixes
- 🐛 SOC springt auf 65535% beim ESS-Modus-Wechsel → Debounce + Plausibilitäts-Check
- 🐛 API-HTTP-500 vor 14:00 → Zeitabhängige Abfrage
- 🐛 Batterie nicht bis 100% geladen → Sicherheitspuffer
- 🐛 SOC driftet ohne Vollzyklen → Automatische Kalibrierung

## 🚀 Installation

1. Input Helper erstellen (siehe battery_optimizer_input_helper_safety_buffer.yaml)
2. Automations installieren (siehe battery_calibration_automation.yaml)
3. Scripts aktualisieren (battery_charging_optimizer.py v3.4.0)
4. PyScript neu laden

## 📊 Verbesserungen

- Präzisere Ladeplanung durch Sicherheitspuffer
- Robustheit gegen SOC-Drift
- Keine API-Fehler mehr vor 14:00
- Hardware-Stopp bei 100% wird respektiert
- Bessere Batterie-Gesundheit durch regelmäßige Kalibrierung

🤖 Generated with Claude Code (claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 08:04:07 +01:00

326 lines
10 KiB
YAML

# ===================================================================
# Batterie-Optimierung Dashboard
# Übersichtliches Layout mit maximal 4 Spalten
# ===================================================================
title: Batterie-Optimierung
path: battery-optimizer
icon: mdi:battery-charging
badges: []
cards:
# ===================================================================
# SECTION 1: STATUS OVERVIEW (Volle Breite)
# ===================================================================
- type: vertical-stack
cards:
# Haupt-Status-Karte
- type: custom:bubble-card
card_type: pop-up
hash: '#battery-status'
name: Batterie Status
icon: mdi:battery-charging-80
margin_top_mobile: 18px
margin_top_desktop: 74px
width_desktop: 540px
# Power Flow Visualisierung
- type: custom:power-flow-card-plus
entities:
battery:
entity: sensor.ess0_activepower
state_of_charge: sensor.esssoc
display_state: two_way
grid:
entity: sensor.grid_activepower
solar:
entity: sensor.production_activepower
clickable_entities: true
display_zero_state:
transparency: 50
w_decimals: 0
kw_decimals: 2
# ===================================================================
# SECTION 2: STEUERUNG & AKTUELLER PLAN (2+2 Spalten)
# ===================================================================
- type: horizontal-stack
cards:
# LINKE SEITE: Steuerung (2 Spalten)
- type: vertical-stack
cards:
# Optimizer Toggle
- type: custom:bubble-card
card_type: button
button_type: switch
entity: input_boolean.battery_optimizer_enabled
name: Automatische Optimierung
icon: mdi:robot
show_state: true
# Manuelle Steuerung
- type: custom:bubble-card
card_type: button
button_type: switch
entity: input_boolean.goodwe_manual_control
name: Manuelle Steuerung
icon: mdi:hand-back-right
show_state: true
# Wichtige Parameter
- type: entities
title: Parameter
entities:
- entity: input_number.battery_optimizer_min_soc
name: Min. SOC
- entity: input_number.battery_optimizer_max_soc
name: Max. SOC
- entity: input_number.battery_optimizer_max_charge_power
name: Ladeleistung
- entity: input_number.battery_optimizer_reserve_capacity
name: Reserve
- type: divider
- entity: sensor.hastrom_flex_ext
name: Aktueller Preis
icon: mdi:currency-eur
- entity: sensor.esssoc
name: Aktueller SOC
icon: mdi:battery
# RECHTE SEITE: Aktueller Plan (2 Spalten)
- type: vertical-stack
cards:
# Plan Header
- type: custom:bubble-card
card_type: button
entity: sensor.battery_charging_plan_status
name: Ladeplan
icon: mdi:calendar-clock
show_state: true
show_last_changed: true
# Kompakte Plan-Anzeige
- type: markdown
content: |
{% set schedule = state_attr('pyscript.battery_charging_plan', 'schedule') %}
{% set last_updated = state_attr('pyscript.battery_charging_plan', 'last_updated') %}
{% if schedule %}
**Plan erstellt:** {{ last_updated[:16] if last_updated else 'Unbekannt' }}
**Geplante Ladestunden:**
{% for slot in schedule %}
{% if slot.action == 'charge' %}
- **{{ slot.time[:16] }}**
🔋 {{ slot.power }}W · 💶 {{ slot.price }}ct/kWh
*{{ slot.reason }}*
{% endif %}
{% endfor %}
{% else %}
⚠️ Kein Plan verfügbar
{% endif %}
# Nächste Aktion
- type: custom:bubble-card
card_type: button
entity: sensor.battery_next_charge_time
name: Nächste Ladung
icon: mdi:clock-start
show_state: true
# ===================================================================
# SECTION 3: VISUALISIERUNGEN (Volle Breite)
# ===================================================================
- type: vertical-stack
cards:
# Strompreis-Verlauf mit geplanten Ladezeiten
- type: custom:plotly-graph
title: Strompreis & Ladeplanung
hours_to_show: 48
refresh_interval: 10
layout:
height: 300
showlegend: true
xaxis:
title: Zeit
yaxis:
title: Preis (ct/kWh)
side: left
entities:
# Strompreis
- entity: sensor.hastrom_flex_ext
name: Strompreis
line:
color: rgb(255, 152, 0)
width: 2
fill: tozeroy
fillcolor: rgba(255, 152, 0, 0.1)
# Geplante Ladezeiten (als Marker)
- entity: ''
name: Geplante Ladung
internal: true
data_generator: |
return Object.entries(hass.states['pyscript.battery_charging_plan'].attributes.schedule || {})
.filter(([k,v]) => v.action === 'charge')
.map(([k,v]) => ({
x: v.time,
y: parseFloat(v.price),
text: `${v.power}W`
}));
mode: markers
marker:
color: rgb(76, 175, 80)
size: 12
symbol: diamond
# SOC & Batterie-Leistung
- type: custom:plotly-graph
title: Batterie SOC & Leistung
hours_to_show: 24
refresh_interval: 10
layout:
height: 300
showlegend: true
xaxis:
title: Zeit
yaxis:
title: SOC (%)
side: left
range: [0, 100]
yaxis2:
title: Leistung (W)
side: right
overlaying: y
entities:
# SOC
- entity: sensor.esssoc
name: SOC
yaxis: y
line:
color: rgb(33, 150, 243)
width: 3
fill: tozeroy
fillcolor: rgba(33, 150, 243, 0.1)
# Batterie-Leistung
- entity: sensor.ess0_activepower
name: Ladeleistung
yaxis: y2
line:
color: rgb(76, 175, 80)
width: 2
dash: dot
# Energie-Fluss über Zeit
- type: custom:plotly-graph
title: Energie-Flüsse
hours_to_show: 24
refresh_interval: 10
layout:
height: 300
showlegend: true
xaxis:
title: Zeit
yaxis:
title: Leistung (W)
entities:
- entity: sensor.production_activepower
name: PV-Produktion
line:
color: rgb(255, 193, 7)
width: 2
fill: tozeroy
fillcolor: rgba(255, 193, 7, 0.2)
- entity: sensor.grid_activepower
name: Netzbezug
line:
color: rgb(244, 67, 54)
width: 2
- entity: sensor.ess0_activepower
name: Batterie
line:
color: rgb(76, 175, 80)
width: 2
# ===================================================================
# SECTION 4: DETAILLIERTER PLAN (Ausklappbar)
# ===================================================================
- type: custom:bubble-card
card_type: separator
name: Detaillierte Plan-Ansicht
icon: mdi:table
- type: markdown
title: Vollständiger Ladeplan
content: |
{% set schedule = state_attr('pyscript.battery_charging_plan', 'schedule') %}
{% set stats = state_attr('pyscript.battery_charging_plan', 'plan_statistics') %}
{% if schedule and stats %}
### 📊 Plan-Statistiken
| Metrik | Wert |
|--------|------|
| Geplante Ladestunden | {{ stats.total_charging_hours }} |
| Gesamte Energie | {{ stats.total_energy_kwh | round(2) }} kWh |
| Durchschnittspreis | {{ stats.average_price | round(2) }} ct/kWh |
| Günstigster Preis | {{ stats.min_price | round(2) }} ct/kWh |
| Teuerster Preis | {{ stats.max_price | round(2) }} ct/kWh |
---
### 📅 Stunden-Details
| Zeit | Aktion | Leistung | Preis | Grund |
|------|--------|----------|-------|-------|
{% for slot in schedule %}
| {{ slot.time[11:16] }} | {{ '🔋 Laden' if slot.action == 'charge' else '⏸️ Warten' }} | {{ slot.power if slot.power else '-' }}W | {{ slot.price }}ct | {{ slot.reason }} |
{% endfor %}
{% else %}
⚠️ **Kein Ladeplan verfügbar**
Der Plan wird täglich um 14:05 Uhr neu berechnet.
{% endif %}
# ===================================================================
# SECTION 5: SYSTEM-INFOS (Ausklappbar)
# ===================================================================
- type: custom:bubble-card
card_type: separator
name: System-Informationen
icon: mdi:information
- type: entities
title: System-Status
show_header_toggle: false
entities:
- entity: sensor.openems_state
name: OpenEMS Status
- type: divider
- entity: sensor.battery_capacity
name: Batteriekapazität
- entity: sensor.ess0_capacity
name: Installierte Kapazität
- type: divider
- entity: sensor.forecast_solar_energy_today
name: PV-Prognose Heute
- entity: sensor.forecast_solar_energy_tomorrow
name: PV-Prognose Morgen
- type: divider
- entity: automation.battery_charging_schedule_calculation
name: Tägliche Berechnung
- entity: automation.battery_charging_schedule_execution
name: Stündliche Ausführung