Files
battery-charging-optimizer/openems/legacy/v3/battery_optimizer_sections_compact.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

339 lines
10 KiB
YAML

# ===================================================================
# Batterie-Optimierung Dashboard - SECTIONS LAYOUT (KOMPAKT)
# Modernes Home Assistant Sections-Layout mit max. 4 Spalten
# ===================================================================
type: sections
max_columns: 4
title: Batterie Optimierung
path: battery-optimizer
icon: mdi:battery-charging
sections:
# ===================================================================
# SECTION 1: HAUPTSTATUS & STEUERUNG
# ===================================================================
- type: grid
cards:
- type: heading
heading: Status & Steuerung
icon: mdi:view-dashboard
# 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
home:
entity: sensor.consumption_activepower
clickable_entities: true
display_zero_state:
transparency: 50
w_decimals: 0
kw_decimals: 2
# Steuerung & Quick-Status
- type: grid
cards:
- type: custom:bubble-card
card_type: button
button_type: switch
entity: input_boolean.battery_optimizer_enabled
name: Auto-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: custom:bubble-card
card_type: button
entity: sensor.esssoc
name: Batterie SOC
icon: mdi:battery
show_state: true
- type: custom:bubble-card
card_type: button
entity: sensor.hastrom_flex_ext
name: Strompreis
icon: mdi:currency-eur
show_state: true
# ===================================================================
# SECTION 2: LADEPLAN-ÜBERSICHT
# ===================================================================
- type: grid
cards:
- type: heading
heading: Ladeplanung
icon: mdi:calendar-clock
- type: custom:bubble-card
card_type: button
entity: sensor.battery_charging_plan_status
name: Plan-Status
icon: mdi:calendar-check
show_state: true
show_last_changed: true
- type: custom:bubble-card
card_type: button
entity: sensor.battery_next_charge_time
name: Nächste Ladung
icon: mdi:clock-start
show_state: true
# Kompakte Plan-Anzeige
- type: markdown
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-Übersicht:**
• {{ stats.total_charging_hours }}h Ladung geplant
• {{ stats.total_energy_kwh | round(1) }} kWh Energie
• Ø {{ stats.average_price | round(2) }} ct/kWh
**📅 Nächste Ladungen:**
{% for slot in schedule %}
{% if slot.action == 'charge' %}
• **{{ slot.time[11:16] }}** Uhr - {{ slot.power }}W ({{ slot.price }}ct/kWh)
{% endif %}
{% endfor %}
{% else %}
⚠️ Kein Plan verfügbar
{% endif %}
# ===================================================================
# SECTION 3: STROMPREIS-VISUALISIERUNG
# ===================================================================
- type: grid
cards:
- type: heading
heading: Strompreis & Planung
icon: mdi:chart-line
- type: custom:plotly-graph
title: Strompreis 48h mit Ladeplan
hours_to_show: 48
refresh_interval: 300
layout:
height: 280
showlegend: true
legend:
orientation: h
y: -0.15
margin:
t: 10
b: 40
l: 50
r: 20
xaxis:
title: ''
yaxis:
title: ct/kWh
entities:
# Strompreis-Linie
- entity: sensor.hastrom_flex_ext
name: Strompreis
line:
color: '#FF9800'
width: 2
fill: tozeroy
fillcolor: 'rgba(255, 152, 0, 0.15)'
# Geplante Ladungen als Marker
- entity: ''
internal: true
name: Geplante Ladung
mode: markers
marker:
color: '#4CAF50'
size: 14
symbol: star
line:
color: '#2E7D32'
width: 2
# ===================================================================
# SECTION 4: BATTERIE-ÜBERSICHT
# ===================================================================
- type: grid
cards:
- type: heading
heading: Batterie-Verlauf
icon: mdi:battery-charging
- type: custom:plotly-graph
title: SOC & Leistung 24h
hours_to_show: 24
refresh_interval: 60
layout:
height: 280
showlegend: true
legend:
orientation: h
y: -0.15
margin:
t: 10
b: 40
l: 50
r: 50
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.15)'
# Batterie-Leistung
- entity: sensor.ess0_activepower
name: Leistung
yaxis: y2
line:
color: '#4CAF50'
width: 2
# ===================================================================
# SECTION 5: DETAILLIERTER PLAN
# ===================================================================
- type: grid
cards:
- type: heading
heading: Detaillierter Plan
icon: mdi:format-list-bulleted
# Plan-Statistiken als Bubble Cards
- type: horizontal-stack
cards:
- type: custom:bubble-card
card_type: button
entity: ''
name: |
{{ state_attr('pyscript.battery_charging_plan', 'plan_statistics').total_charging_hours or 0 }}h
sub_button:
- name: Ladedauer
icon: mdi:timer
show_background: false
- type: custom:bubble-card
card_type: button
entity: ''
name: |
{{ state_attr('pyscript.battery_charging_plan', 'plan_statistics').total_energy_kwh | round(1) or 0 }}kWh
sub_button:
- name: Energie
icon: mdi:lightning-bolt
show_background: false
- type: custom:bubble-card
card_type: button
entity: ''
name: |
{{ state_attr('pyscript.battery_charging_plan', 'plan_statistics').average_price | round(2) or 0 }}ct
sub_button:
- name: Ø Preis
icon: mdi:currency-eur
show_background: false
# Vollständige Plan-Tabelle
- type: markdown
content: |
{% set schedule = state_attr('pyscript.battery_charging_plan', 'schedule') %}
{% set stats = state_attr('pyscript.battery_charging_plan', 'plan_statistics') %}
{% if schedule and stats %}
| 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 6: PARAMETER & EINSTELLUNGEN
# ===================================================================
- type: grid
cards:
- type: heading
heading: Einstellungen
icon: mdi:cog
- type: entities
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
- entity: input_number.battery_optimizer_reserve_capacity
name: Reserve-Kapazität
- entity: input_number.battery_optimizer_price_threshold
name: Preis-Schwelle
# ===================================================================
# SECTION 7: SYSTEM-STATUS
# ===================================================================
- type: grid
cards:
- type: heading
heading: System
icon: mdi:information
- type: glance
entities:
- entity: sensor.openems_state
name: OpenEMS
- entity: sensor.battery_capacity
name: Kapazität
- entity: sensor.forecast_solar_energy_today
name: PV Heute
- entity: sensor.forecast_solar_energy_tomorrow
name: PV Morgen
- type: glance
entities:
- entity: automation.battery_charging_schedule_calculation
name: Tägliche Berechnung
- entity: automation.battery_charging_schedule_execution
name: Stündliche Ausführung