Files
battery-charging-optimizer/entity_fix_quick_reference.md
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

6.1 KiB

Entity Fix Quick Reference

Global Search & Replace Operations

1. Fix OpenEMS Entity Names (ALL v2 and v3 files)

# Replace in all YAML files
sensor.openems_ess0_soc              → sensor.esssoc
sensor.openems_ess0_activepower      → sensor.essactivepower
sensor.openems_ess0_capacity         → sensor.esscapacity
sensor.openems_production_activepower → sensor.pv_power
sensor.openems_consumption_activepower → sensor.house_consumption
sensor.openems_grid_activepower      → sensor.gw_netzbezug (or appropriate grid sensor)

2. Fix V3 Input Number Names (V3 dashboards only)

# Replace only in v3/*.yaml files
input_number.battery_min_soc           → input_number.battery_optimizer_min_soc
input_number.battery_max_soc           → input_number.battery_optimizer_max_soc
input_number.battery_charging_power    → input_number.battery_optimizer_max_charge_power
input_number.battery_reserve_capacity  → input_number.battery_optimizer_reserve_capacity
input_number.battery_price_threshold   → input_number.battery_optimizer_price_threshold

3. Fix haStrom Sensor Name (ALL files)

sensor.hastrom_flex_extended_current_price → sensor.hastrom_flex_ext

4. Fix Input Text Name (ALL files)

Option A: Rename the entity in Home Assistant UI:

  • Rename input_text.battery_optimizer_status_2 to input_text.battery_optimizer_status

Option B: Update all config files:

input_text.battery_optimizer_status → input_text.battery_optimizer_status_2

Entities to Create in Home Assistant

1. Create Input Select Helper

Via UI: Settings → Devices & Services → Helpers → Create Helper → Dropdown

Name: Battery Optimizer Strategy Entity ID: input_select.battery_optimizer_strategy Options:

  • Price Optimized
  • Solar Optimized
  • Mixed

Via YAML: Add to configuration.yaml:

input_select:
  battery_optimizer_strategy:
    name: Battery Optimizer Strategy
    options:
      - "Price Optimized"
      - "Solar Optimized"
      - "Mixed"
    initial: "Price Optimized"
    icon: mdi:strategy

Files That Need Updates

OpenEMS Entity Names (8 files)

openems/v2/battery_optimizer_dashboard.yaml
openems/v3/battery_optimizer_dashboard.yaml
openems/v3/battery_optimizer_dashboard_minimal.yaml
openems/v3/battery_optimizer_dashboard_compact.yaml
openems/v3/battery_optimizer_sections_minimal.yaml
openems/v3/battery_optimizer_sections_compact.yaml
openems/v3/battery_optimizer_sections_standard.yaml

V3 Input Number Names (7 files - same as above minus v2)

All v3 dashboard files listed above.

haStrom Sensor Name

Check and update in all files that reference sensor.hastrom_flex_extended_current_price:

openems/v3/*.yaml (all dashboard files)

Quick Verification Commands

Check if entities exist:

# Via Home Assistant REST API
curl -s -X GET "http://192.168.89.4:8123/api/states/sensor.esssoc" \
  -H "Authorization: Bearer YOUR_TOKEN" | jq '.state'

# Check multiple entities
for entity in sensor.esssoc sensor.essactivepower sensor.esscapacity; do
  echo -n "$entity: "
  curl -s -X GET "http://192.168.89.4:8123/api/states/$entity" \
    -H "Authorization: Bearer YOUR_TOKEN" | jq -r '.state'
done

Search for entity references in config files:

# Find all OpenEMS references
grep -r "sensor.openems" openems/

# Find all battery_ input_number references (without optimizer)
grep -r "input_number.battery_[^o]" openems/v3/

# Find haStrom extended price references
grep -r "hastrom_flex_extended" openems/

Current vs Correct Entity Names - Quick Lookup

Current State in HA What Config SHOULD Use What Config INCORRECTLY Uses
sensor.esssoc sensor.esssoc sensor.openems_ess0_soc
sensor.essactivepower sensor.essactivepower sensor.openems_ess0_activepower
sensor.esscapacity sensor.esscapacity sensor.openems_ess0_capacity
sensor.pv_power sensor.pv_power sensor.openems_production_activepower
sensor.house_consumption sensor.house_consumption sensor.openems_consumption_activepower
sensor.hastrom_flex_ext sensor.hastrom_flex_ext sensor.hastrom_flex_extended_current_price
input_number.battery_optimizer_min_soc input_number.battery_optimizer_min_soc input_number.battery_min_soc (v3)
input_number.battery_optimizer_max_soc input_number.battery_optimizer_max_soc input_number.battery_max_soc (v3)
input_number.battery_optimizer_max_charge_power input_number.battery_optimizer_max_charge_power input_number.battery_charging_power (v3)
input_text.battery_optimizer_status_2 input_text.battery_optimizer_status_2 input_text.battery_optimizer_status

All Available ESS Sensors (for reference)

sensor.essactivechargeenergy          # Total charge energy (Wh)
sensor.essactivedischargeenergy       # Total discharge energy (Wh)
sensor.essactivepower                 # Current power (-26 W = charging)
sensor.essactivepowerl1               # L1 power
sensor.essactivepowerl2               # L2 power
sensor.essactivepowerl3               # L3 power
sensor.esscapacity                    # Battery capacity (10000 Wh)
sensor.essdcchargeenergy              # DC charge energy
sensor.essdcchargeenergykwh           # DC charge energy (kWh)
sensor.essdcdischargeenergy           # DC discharge energy
sensor.essdcdischargeenergykwh        # DC discharge energy (kWh)
sensor.essdischargepower              # Discharge power
sensor.essmaxpowersetpoint            # Max power setpoint
sensor.essminpowersetpoint            # Min power setpoint
sensor.essreactivepower               # Reactive power
sensor.esssoc                         # State of charge (%)

Automation Reload After Changes

# Check configuration
ha core check

# Reload specific components (if supported)
ha service call homeassistant.reload_config_entry

# Full restart (safest option)
ha core restart