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

16 KiB

Home Assistant Entity Validation Results

Generated: 2025-11-19 Home Assistant System: http://192.168.89.4:8123 Total Entities in HA: 2,396 Entities Validated: 50


Executive Summary

Validation Results

  • 26 entities EXIST in Home Assistant
  • 24 entities DO NOT EXIST in Home Assistant
  • ⚠️ 2 entities have name mismatches

Key Findings

  1. OpenEMS entities are named differently: Configuration references sensor.openems_* but Home Assistant has sensor.ess* entities
  2. V3 dashboard naming conflicts: V3 dashboards use shortened names (battery_min_soc) that don't exist; should use battery_optimizer_min_soc
  3. Missing template sensors: Several template sensors are not yet created
  4. No PyScript state entities found: PyScript scripts haven't been run yet
  5. Forecast Solar integration not configured: No forecast sensors available

Detailed Validation Results

✓ INPUT BOOLEAN ENTITIES (3/3 exist)

Entity ID Status Current State
input_boolean.battery_optimizer_enabled ✓ EXISTS on
input_boolean.battery_optimizer_manual_override ✓ EXISTS off
input_boolean.goodwe_manual_control ✓ EXISTS off

All input_boolean entities exist!


INPUT NUMBER ENTITIES (9/13 exist)

✓ Entities that EXIST

Entity ID Status Current State
input_number.battery_capacity_kwh ✓ EXISTS 10.0
input_number.battery_optimizer_max_charge_power ✓ EXISTS 5000.0
input_number.battery_optimizer_max_soc ✓ EXISTS 100.0
input_number.battery_optimizer_min_soc ✓ EXISTS 20.0
input_number.battery_optimizer_price_threshold ✓ EXISTS 28.0
input_number.battery_optimizer_pv_threshold ✓ EXISTS 500.0
input_number.battery_optimizer_reserve_capacity ✓ EXISTS 2.0
input_number.charge_power_battery ✓ EXISTS 1000.0

✗ Entities that DO NOT EXIST

Entity ID Status Issue
input_number.battery_charging_power ✗ MISSING V3 dashboards use this - should use battery_optimizer_max_charge_power
input_number.battery_max_soc ✗ MISSING V3 dashboards use this - should use battery_optimizer_max_soc
input_number.battery_min_soc ✗ MISSING V3 dashboards use this - should use battery_optimizer_min_soc
input_number.battery_price_threshold ✗ MISSING V3 dashboards use this - should use battery_optimizer_price_threshold
input_number.battery_reserve_capacity ✗ MISSING V3 dashboards use this - should use battery_optimizer_reserve_capacity

Recommendation: Update V3 dashboards to use the battery_optimizer_* prefix for all input_number entities.


INPUT SELECT ENTITIES (0/1 exist)

Entity ID Status Issue
input_select.battery_optimizer_strategy ✗ MISSING Needs to be created

Action Required: Create this input_select helper in Home Assistant UI or configuration.


INPUT TEXT ENTITIES (0/1 exist - but similar exists)

Entity ID Status Issue
input_text.battery_optimizer_status ⚠️ NAME MISMATCH Home Assistant has input_text.battery_optimizer_status_2 instead

Recommendation: Either:

  1. Rename input_text.battery_optimizer_status_2 to input_text.battery_optimizer_status, OR
  2. Update configuration files to reference input_text.battery_optimizer_status_2

SENSOR ENTITIES (17/30 exist)

✓ Entities that EXIST

Entity ID Status Current State
sensor.battery_power ✓ EXISTS -26 (W)
sensor.battery_state_of_charge ✓ EXISTS 18 (%)
sensor.bought_from_grid_today ✓ EXISTS 19.292 (kWh)
sensor.energy_production_tomorrow ✓ EXISTS 3.522 (kWh)
sensor.energy_production_tomorrow_2 ✓ EXISTS 3.639 (kWh)
sensor.esssoc ✓ EXISTS 18 (%)
sensor.gw_netzbezug ✓ EXISTS 958.0 (W)
sensor.gw_netzeinspeisung ✓ EXISTS 0 (W)
sensor.hastrom_flex_pro ✓ EXISTS 28.73 (ct/kWh)
sensor.house_consumption ✓ EXISTS 932 (W)
sensor.pv_power ✓ EXISTS 0 (W)
sensor.sold_to_grid_today ✓ EXISTS 0.015 (kWh)
sensor.today_battery_charge ✓ EXISTS 0.5 (kWh)
sensor.today_battery_discharge ✓ EXISTS 0.0 (kWh)
sensor.today_s_pv_generation ✓ EXISTS 2.9 (kWh)

⚠️ Entities with NAME MISMATCHES

Config References Home Assistant Has Issue
sensor.hastrom_flex_extended_current_price sensor.hastrom_flex_ext Wrong entity name in config

Recommendation: Update configuration to use sensor.hastrom_flex_ext instead of sensor.hastrom_flex_extended_current_price.

✗ Template Sensors that DO NOT EXIST (need to be created)

Entity ID Status Issue
sensor.battery_charging_plan_status ✗ MISSING Template sensor defined in config - may show as unavailable until PyScript runs
sensor.battery_estimated_savings ✗ MISSING Template sensor defined in config - may show as unavailable until PyScript runs
sensor.battery_next_action ✗ MISSING Template sensor defined in config - may show as unavailable until PyScript runs
sensor.battery_next_charge_time ✗ MISSING Needs to be created
sensor.battery_capacity ✗ MISSING Needs to be created (or use sensor.esscapacity)

Note: Template sensors sensor.geplante_ladungen_heute and sensor.durchschnittspreis_heute exist but show as "unavailable" - this is expected until PyScript populates the data.

✗ OpenEMS Sensors DO NOT EXIST (but ESS sensors do!)

CRITICAL FINDING: Configuration files reference sensor.openems_* entities, but Home Assistant uses sensor.ess* naming convention!

Config References Home Assistant Has Current State
sensor.openems_ess0_soc sensor.esssoc 18 %
sensor.openems_ess0_activepower sensor.essactivepower -26 W
sensor.openems_ess0_capacity sensor.esscapacity 10000 Wh
sensor.openems_grid_activepower (see below) -
sensor.openems_production_activepower sensor.pv_power 0 W
sensor.openems_consumption_activepower sensor.house_consumption 932 W
sensor.openems_state ✗ MISSING Needs verification

Available ESS Sensors in Home Assistant:

sensor.essactivechargeenergy          44088.00 Wh
sensor.essactivedischargeenergy       214511.00 Wh
sensor.essactivepower                 -26.00 W (negative = charging)
sensor.essactivepowerl1               -8.00 W
sensor.essactivepowerl2               -8.00 W
sensor.essactivepowerl3               -8.00 W
sensor.esscapacity                    10000.00 Wh
sensor.essdcchargeenergy              107649.00 Wh
sensor.essdcchargeenergykwh           107.649 kWh
sensor.essdcdischargeenergy           84416.00 Wh
sensor.essdcdischargeenergykwh        84.416 kWh
sensor.essdischargepower              -26.00 W
sensor.essmaxpowersetpoint            9690.00 W
sensor.essminpowersetpoint            -10000.00 W
sensor.essreactivepower               0.00 VAr
sensor.esssoc                         18 %

Recommendation: Update all configuration files to use sensor.ess* instead of sensor.openems_*.

✗ Forecast Solar Sensors DO NOT EXIST

Entity ID Status Issue
sensor.forecast_solar_energy_today ✗ MISSING Forecast.Solar integration not configured
sensor.forecast_solar_energy_tomorrow ✗ MISSING Forecast.Solar integration not configured

Action Required: Install and configure the Forecast.Solar integration if solar forecasting is needed.


AUTOMATION ENTITIES (0/2 exist)

Entity ID Status Issue
automation.battery_charging_schedule_calculation ✗ MISSING Automation not created yet
automation.battery_charging_schedule_execution ✗ MISSING Automation not created yet

Note: These automations are defined in configuration files but haven't been loaded yet.


PYSCRIPT ENTITIES (0/2 exist)

Entity ID Status Issue
pyscript.battery_charging_schedule ✗ MISSING PyScript hasn't run yet - will be created when script executes
pyscript.battery_charging_plan ✗ MISSING PyScript hasn't run yet - will be created when script executes

Note: PyScript state entities are created dynamically when the PyScript runs. They don't exist until the script is executed at least once.


REST COMMAND ENTITIES (2/2 exist)

Entity ID Status Note
rest_command.set_ess_remote_mode ✓ DEFINED Defined in configuration (not visible in states)
rest_command.set_ess_internal_mode ✓ DEFINED Defined in configuration (not visible in states)

Note: REST commands are defined in configuration files and won't appear in the entity states list.


Integration Status

✓ haStrom Integration - CONFIGURED

Available Entities:

  • sensor.hastrom_flex (29.83 ct/kWh)
  • sensor.hastrom_flex_ext (28.73 ct/kWh)
  • sensor.hastrom_flex_pro (28.73 ct/kWh)
  • sensor.hastrom_flex_pro_ext
  • sensor.hastrom_flex_price_euro_per_mwh
  • automation.hastrom_flex_update

✓ GoodWe Integration - CONFIGURED

Available Entities:

  • sensor.goodwe_control_status (Inaktiv)
  • sensor.gw_batterie_entladeleistung (0 W)
  • sensor.gw_batterie_ladeleistung (26.0 W)
  • sensor.gw_netzbezug (958.0 W)
  • sensor.gw_netzeinspeisung (0 W)
  • input_boolean.goodwe_manual_control (off)
  • automation.goodwe_manuelle_steuerung_sender (on)
  • number.goodwe_shutdown_soc (20.0 %)

⚠️ OpenEMS Integration - CONFIGURED (different naming)

The system has ESS sensors but they use different names than referenced in configuration:

  • Uses sensor.ess* instead of sensor.openems_*
  • All battery functionality is present, just needs entity name updates in config

✗ Forecast.Solar Integration - NOT CONFIGURED

No forecast solar entities found. Installation required if solar forecasting is needed.


Critical Issues & Recommendations

Priority 1: Fix OpenEMS Entity Names

Issue: All V2 and V3 configuration files reference sensor.openems_* entities that don't exist.

Solution: Replace all occurrences:

  • sensor.openems_ess0_socsensor.esssoc
  • sensor.openems_ess0_activepowersensor.essactivepower
  • sensor.openems_ess0_capacitysensor.esscapacity
  • sensor.openems_production_activepowersensor.pv_power
  • sensor.openems_consumption_activepowersensor.house_consumption

Files to Update:

  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v2/battery_optimizer_dashboard.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_dashboard.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_dashboard_minimal.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_sections_minimal.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_dashboard_compact.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_sections_compact.yaml
  • /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/battery_optimizer_sections_standard.yaml

Priority 2: Fix V3 Dashboard Naming

Issue: V3 dashboards use shortened entity names that don't exist.

Solution: Update V3 dashboards to use full battery_optimizer_* prefix:

  • input_number.battery_min_socinput_number.battery_optimizer_min_soc
  • input_number.battery_max_socinput_number.battery_optimizer_max_soc
  • input_number.battery_charging_powerinput_number.battery_optimizer_max_charge_power
  • input_number.battery_reserve_capacityinput_number.battery_optimizer_reserve_capacity
  • input_number.battery_price_thresholdinput_number.battery_optimizer_price_threshold

Files to Update:

  • All files in /Users/felix/Nextcloud/AI/projects/homeassistant/openems/v3/

Priority 3: Fix haStrom Sensor Name

Issue: Configuration uses wrong entity name for haStrom extended price.

Solution:

  • Replace sensor.hastrom_flex_extended_current_price with sensor.hastrom_flex_ext

Priority 4: Create Missing Helper Entities

Entities to Create:

  1. input_select.battery_optimizer_strategy

    input_select:
      battery_optimizer_strategy:
        name: Battery Optimizer Strategy
        options:
          - "Price Optimized"
          - "Solar Optimized"
          - "Mixed"
        initial: "Price Optimized"
    
  2. Rename input_text.battery_optimizer_status_2

    • Use Home Assistant UI to rename to battery_optimizer_status
    • Or update config files to use battery_optimizer_status_2

Priority 5: Create Missing Template Sensors

The following template sensors are defined in config but show as "unavailable" - verify they're properly configured:

  • sensor.battery_charging_plan_status
  • sensor.battery_next_action
  • sensor.battery_estimated_savings

Priority 6: Run PyScript

PyScript state entities won't exist until the scripts run at least once:

  • pyscript.battery_charging_schedule
  • pyscript.battery_charging_plan

Action: Trigger the PyScript manually or wait for first scheduled execution.

Priority 7: Load Missing Automations

The following automations are defined but not loaded:

  • automation.battery_charging_schedule_calculation
  • automation.battery_charging_schedule_execution

Action: Ensure automation configuration files are included in configuration.yaml.

Optional: Install Forecast.Solar Integration

If solar forecasting is desired:

  1. Install Forecast.Solar integration via HACS or manually
  2. Configure with your solar panel details
  3. This will provide sensor.forecast_solar_energy_today and sensor.forecast_solar_energy_tomorrow

Entity Mapping Reference

Current State Mappings

What Exists in HA What Config Files Should Use
sensor.esssoc sensor.openems_ess0_soc (needs update)
sensor.essactivepower sensor.openems_ess0_activepower (needs update)
sensor.esscapacity sensor.openems_ess0_capacity (needs update)
sensor.hastrom_flex_ext sensor.hastrom_flex_extended_current_price (needs update)
input_text.battery_optimizer_status_2 input_text.battery_optimizer_status (needs rename)
input_number.battery_optimizer_min_soc input_number.battery_min_soc (V3 needs update)
input_number.battery_optimizer_max_soc input_number.battery_max_soc (V3 needs update)
input_number.battery_optimizer_max_charge_power input_number.battery_charging_power (V3 needs update)

Testing Checklist

  • Update all sensor.openems_* references to sensor.ess*
  • Update V3 dashboard entity names to use battery_optimizer_* prefix
  • Fix sensor.hastrom_flex_extended_current_pricesensor.hastrom_flex_ext
  • Create input_select.battery_optimizer_strategy
  • Rename or update references for input_text.battery_optimizer_status
  • Reload configuration files
  • Check Developer Tools → States for all entities
  • Verify dashboards load without "Entity not available" errors
  • Run PyScript manually to create state entities
  • Verify automations are loaded
  • Check Home Assistant logs for any remaining errors

Summary Statistics

Overall Entity Status

Category Exists Missing Mismatch Total
input_boolean 3 0 0 3
input_number 8 5 0 13
input_select 0 1 0 1
input_text 0 0 1 1
sensor 17 12 1 30
automation 0 2 0 2
TOTAL 28 20 2 50

Files Requiring Updates

  1. V2 Dashboard (1 file) - OpenEMS entity names
  2. V3 Dashboards (7 files) - Both OpenEMS names AND input_number names
  3. All configs using haStrom - Fix sensor name
  4. Configuration.yaml - Add missing input_select, verify template sensors

Next Steps: Would you like me to create corrected versions of the configuration files with all entity names fixed?