Files
battery-charging-optimizer/openems/config/battery_optimizer_config.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

203 lines
5.8 KiB
YAML

# ============================================
# Battery Charging Optimizer - Konfiguration
# ============================================
# Speicherort: /config/packages/battery_optimizer_config.yaml
# oder in configuration.yaml unter entsprechenden Sektionen
# ====================
# Input Boolean
# ====================
input_boolean:
battery_optimizer_enabled:
name: "Batterie-Optimierung aktiviert"
icon: mdi:battery-charging-wireless
battery_optimizer_manual_override:
name: "Manuelle Überschreibung"
icon: mdi:hand-back-right
# ====================
# Input Number
# ====================
input_number:
# Batterie-Parameter
battery_capacity_kwh:
name: "Batterie-Kapazität"
min: 1
max: 50
step: 0.5
unit_of_measurement: "kWh"
icon: mdi:battery
mode: box
initial: 10
battery_optimizer_min_soc:
name: "Minimaler SOC"
min: 0
max: 50
step: 5
unit_of_measurement: "%"
icon: mdi:battery-low
mode: slider
initial: 20
battery_optimizer_max_soc:
name: "Maximaler SOC"
min: 50
max: 100
step: 5
unit_of_measurement: "%"
icon: mdi:battery-high
mode: slider
initial: 100
battery_optimizer_max_charge_power:
name: "Max. Ladeleistung"
min: 1000
max: 10000
step: 500
unit_of_measurement: "W"
icon: mdi:lightning-bolt
mode: box
initial: 5000
# Optimierungs-Parameter
battery_optimizer_price_threshold:
name: "Preis-Schwellwert"
min: 0
max: 50
step: 0.5
unit_of_measurement: "ct/kWh"
icon: mdi:currency-eur
mode: box
initial: 28
battery_optimizer_reserve_capacity:
name: "Reserve-Kapazität (Haushalt)"
min: 0
max: 5
step: 0.5
unit_of_measurement: "kWh"
icon: mdi:home-lightning-bolt
mode: box
initial: 2
battery_optimizer_pv_threshold:
name: "PV-Schwellwert (keine Ladung)"
min: 0
max: 5000
step: 100
unit_of_measurement: "Wh"
icon: mdi:solar-power
mode: box
initial: 500
# ====================
# Input Text
# ====================
input_text:
battery_optimizer_status:
name: "Optimierungs-Status"
max: 255
icon: mdi:information-outline
# ====================
# Input Select
# ====================
input_select:
battery_optimizer_strategy:
name: "Lade-Strategie"
options:
- "Konservativ (nur sehr günstig)"
- "Moderat (unter Durchschnitt)"
- "Aggressiv (mit Arbitrage)"
initial: "Konservativ (nur sehr günstig)"
icon: mdi:strategy
# ====================
# Sensor Templates
# ====================
template:
- sensor:
# Aktueller Ladeplan-Status
- name: "Batterie Ladeplan Status"
unique_id: battery_charging_plan_status
state: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{% set num_charges = schedule | selectattr('action', 'eq', 'charge') | list | count %}
{{ num_charges }} Ladungen geplant
{% else %}
Kein Plan
{% endif %}
icon: mdi:calendar-clock
attributes:
last_update: >
{{ state_attr('pyscript.battery_charging_schedule', 'last_update') }}
total_hours: >
{{ state_attr('pyscript.battery_charging_schedule', 'num_hours') }}
next_charge: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{% set charges = schedule | selectattr('action', 'eq', 'charge') | list %}
{% if charges | count > 0 %}
{{ charges[0].hour }}:00 Uhr ({{ charges[0].price }} ct/kWh)
{% else %}
Keine Ladung geplant
{% endif %}
{% else %}
Kein Plan vorhanden
{% endif %}
# Nächste geplante Aktion
- name: "Batterie Nächste Aktion"
unique_id: battery_next_action
state: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{% set now_hour = now().hour %}
{% set future = schedule | selectattr('hour', 'ge', now_hour) | list %}
{% if future | count > 0 %}
{{ future[0].hour }}:00 - {{ future[0].action }}
{% else %}
Keine weiteren Aktionen heute
{% endif %}
{% else %}
Kein Plan
{% endif %}
icon: mdi:clock-outline
attributes:
power: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{% set now_hour = now().hour %}
{% set future = schedule | selectattr('hour', 'ge', now_hour) | list %}
{% if future | count > 0 %}
{{ future[0].power_w }} W
{% endif %}
{% endif %}
price: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{% set now_hour = now().hour %}
{% set future = schedule | selectattr('hour', 'ge', now_hour) | list %}
{% if future | count > 0 %}
{{ future[0].price }} ct/kWh
{% endif %}
{% endif %}
# Geschätzte Ersparnis
- name: "Batterie Geschätzte Ersparnis"
unique_id: battery_estimated_savings
state: >
{% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %}
{% if schedule %}
{{ state_attr('pyscript.battery_charging_schedule', 'estimated_savings') | float(0) | round(2) }}
{% else %}
0
{% endif %}
unit_of_measurement: "€"
device_class: monetary
icon: mdi:piggy-bank