Update: Battery Optimizer v3.4.0 mit allen Fixes und Features

This commit is contained in:
felix.zoesch
2025-12-12 08:20:19 +01:00
commit d2a41aad2d
78 changed files with 18053 additions and 0 deletions

View File

@@ -0,0 +1,188 @@
# ============================================
# 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
# ====================
# 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