Files
battery-charging-optimizer/openems/dashboards/battery_optimizer_sections_standard.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

412 lines
14 KiB
YAML

# ===================================================================
# Batterie-Optimierung Dashboard - SECTIONS LAYOUT (STANDARD)
# Vollversion mit allen Details und Sections-Layout
# ===================================================================
- type: sections
max_columns: 4
title: Batterie Detail
path: battery-detail
icon: mdi:battery-charging-100
sections:
# ===================================================================
# SECTION 1: ÜBERSICHT & POWER FLOW
# ===================================================================
- type: grid
cards:
- type: heading
heading: Energie-Übersicht
icon: mdi:home-lightning-bolt
- type: custom:power-flow-card-plus
entities:
battery:
entity: sensor.essactivepower
state_of_charge: sensor.esssoc
display_state: two_way
grid:
entity: sensor.gridactivepower
solar:
entity: sensor.productionactivepower
home:
entity: sensor.consumptionactivepower
clickable_entities: true
display_zero_state:
transparency: 50
w_decimals: 0
kw_decimals: 2
# ===================================================================
# SECTION 2: STEUERUNG
# ===================================================================
- type: grid
cards:
- type: heading
heading: Steuerung
icon: mdi:controller
- 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
- 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
- type: entities
title: Wichtige 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
# ===================================================================
# SECTION 3: LADEPLAN-STATUS
# ===================================================================
- type: grid
cards:
- type: heading
heading: Ladeplan
icon: mdi:calendar-clock
- type: custom:bubble-card
card_type: button
entity: pyscript.battery_charging_schedule
name: Plan-Status
icon: mdi:calendar-check
show_state: true
show_last_changed: true
- type: markdown
content: |
{% set attrs = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if attrs %}
**Nächste Ladung:**
{% set ns = namespace(found=false) %}
{% for entry in attrs %}
{% if entry.action == 'charge' and not ns.found %}
🔋 **{{ entry.datetime[11:16] }} Uhr**
{{ entry.price }} ct/kWh · {{ entry.power_w }}W
{% set ns.found = true %}
{% endif %}
{% endfor %}
{% if not ns.found %}
Keine Ladung geplant
{% endif %}
{% else %}
⚠️ Kein Plan
{% endif %}
- type: markdown
content: |
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% set last_updated = state_attr('pyscript.battery_charging_schedule', 'last_update') %}
{% if schedule %}
**Plan erstellt:** {{ last_updated[:16] if last_updated else 'Unbekannt' }}
**Geplante Ladestunden:**
{% for slot in schedule %}
{% if slot.action == 'charge' %}
- **{{ slot.datetime[:16] }}**
🔋 {{ slot.power_w }}W · 💶 {{ slot.price }}ct/kWh
*{{ slot.reason }}*
{% endif %}
{% endfor %}
{% else %}
⚠️ Kein Plan verfügbar
{% endif %}
# ===================================================================
# SECTION 4: STROMPREIS & LADEPLAN
# ===================================================================
- type: grid
cards:
- type: heading
heading: Strompreis & Ladeplanung
icon: mdi:chart-bell-curve-cumulative
- type: custom:plotly-graph
title: Strompreis 48h mit geplanten Ladezeiten
hours_to_show: 48
refresh_interval: 300
layout:
height: 300
showlegend: true
legend:
orientation: h
y: -0.2
margin:
t: 20
b: 50
l: 60
r: 20
xaxis:
title: Zeit
yaxis:
title: Preis (ct/kWh)
entities:
# Strompreis
- entity: sensor.hastrom_flex_ext
name: Strompreis
line:
color: '#FF9800'
width: 2
fill: tozeroy
fillcolor: 'rgba(255, 152, 0, 0.1)'
# Geplante Ladezeiten (als Marker)
- entity: ''
name: Geplante Ladung
internal: true
mode: markers
marker:
color: '#4CAF50'
size: 14
symbol: star
line:
color: '#2E7D32'
width: 2
# ===================================================================
# SECTION 5: BATTERIE SOC & LEISTUNG
# ===================================================================
- type: grid
cards:
- type: heading
heading: Batterie SOC & Leistung
icon: mdi:battery-charging-outline
- type: custom:plotly-graph
title: Batterie-Übersicht 24h
hours_to_show: 24
refresh_interval: 60
layout:
height: 300
showlegend: true
legend:
orientation: h
y: -0.2
margin:
t: 20
b: 50
l: 60
r: 60
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: '#2196F3'
width: 3
fill: tozeroy
fillcolor: 'rgba(33, 150, 243, 0.1)'
# Batterie-Leistung
- entity: sensor.essactivepower
name: Ladeleistung
yaxis: y2
line:
color: '#4CAF50'
width: 2
dash: dot
# ===================================================================
# SECTION 6: ENERGIE-FLÜSSE
# ===================================================================
- type: grid
cards:
- type: heading
heading: Energie-Flüsse
icon: mdi:transmission-tower
- type: custom:plotly-graph
title: PV, Netz & Batterie 24h
hours_to_show: 24
refresh_interval: 60
layout:
height: 300
showlegend: true
legend:
orientation: h
y: -0.2
margin:
t: 20
b: 50
l: 60
r: 20
xaxis:
title: Zeit
yaxis:
title: Leistung (W)
entities:
- entity: sensor.productionactivepower
name: PV-Produktion
line:
color: '#FFC107'
width: 2
fill: tozeroy
fillcolor: 'rgba(255, 193, 7, 0.2)'
- entity: sensor.gridactivepower
name: Netzbezug
line:
color: '#F44336'
width: 2
- entity: sensor.essactivepower
name: Batterie
line:
color: '#4CAF50'
width: 2
# ===================================================================
# SECTION 7: PLAN-STATISTIKEN
# ===================================================================
- type: grid
cards:
- type: heading
heading: Plan-Statistiken
icon: mdi:chart-box
- type: markdown
content: |
{% set attrs = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% set num_charges = state_attr('pyscript.battery_charging_schedule', 'num_charges') or 0 %}
{% set total_energy = state_attr('pyscript.battery_charging_schedule', 'total_energy_kwh') or 0 %}
{% set avg_price = state_attr('pyscript.battery_charging_schedule', 'avg_charge_price') or 0 %}
{% set num_tomorrow = state_attr('pyscript.battery_charging_schedule', 'num_charges_tomorrow') or 0 %}
| Metrik | Wert |
|--------|------|
| 🕐 **Geplante Ladungen** | {{ num_charges }} Stunden |
| ⚡ **Gesamt-Energie** | {{ total_energy | round(1) }} kWh |
| 💶 **Durchschnittspreis** | {{ avg_price | round(2) }} ct/kWh |
| 📅 **Davon Morgen** | {{ num_tomorrow }} Ladungen |
# ===================================================================
# SECTION 8: DETAILLIERTE PLAN-TABELLE
# ===================================================================
- type: grid
cards:
- type: heading
heading: Stunden-Details
icon: mdi:table-large
- type: markdown
title: Vollständiger Ladeplan
content: |
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
| Zeit | Aktion | Leistung | Preis | Grund |
|------|--------|----------|-------|-------|
{% for slot in schedule[:20] %}
| {{ slot.datetime[11:16] }} | {{ '🔋 Laden' if slot.action == 'charge' else '⏸️ Auto' }} | {{ slot.power_w if slot.power_w 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 9: ALLE EINSTELLUNGEN
# ===================================================================
- type: grid
cards:
- type: heading
heading: Alle Einstellungen
icon: mdi:cog-outline
- type: entities
title: Batterie-Parameter
entities:
- entity: input_number.battery_optimizer_min_soc
name: Minimaler SOC (%)
- entity: input_number.battery_optimizer_max_soc
name: Maximaler SOC (%)
- entity: input_number.battery_optimizer_max_charge_power
name: Ladeleistung (W)
- entity: input_number.battery_optimizer_reserve_capacity
name: Reserve-Kapazität (kWh)
- entity: input_number.battery_optimizer_price_threshold
name: Preis-Schwelle (ct/kWh)
# ===================================================================
# SECTION 10: SYSTEM-INFORMATIONEN
# ===================================================================
- type: grid
cards:
- type: heading
heading: System-Status
icon: mdi:information-outline
- type: markdown
content: |
**System-Informationen:**
**Batterie:**
- Kapazität: {{ states('input_number.battery_capacity_kwh') }} kWh
- Aktueller SOC: {{ states('sensor.esssoc') }}%
- Leistung: {{ states('sensor.essactivepower') }}W
**PV-Prognose:**
- Heute Ost: {{ states('sensor.energy_production_today') }} kWh
- Heute West: {{ states('sensor.energy_production_today_2') }} kWh
- Morgen Ost: {{ states('sensor.energy_production_tomorrow') }} kWh
- Morgen West: {{ states('sensor.energy_production_tomorrow_2') }} kWh
**Optimizer Status:**
- Aktiviert: {{ states('input_boolean.battery_optimizer_enabled') }}
- Manueller Modus: {{ states('input_boolean.goodwe_manual_control') }}
- Letztes Update: {{ state_attr('pyscript.battery_charging_schedule', 'last_update')[:16] if state_attr('pyscript.battery_charging_schedule', 'last_update') else 'Unbekannt' }}
**PyScript Trigger:**
- Tägliche Berechnung: 14:05 Uhr
- Stündliche Ausführung: xx:05 Uhr