# ============================================ # Battery Charging Optimizer - Configuration # ============================================ # Diese Konfiguration zu deiner configuration.yaml hinzufügen # WICHTIG: Kein input_text/input_textarea nötig! # Der Ladeplan wird als Attribut in pyscript.battery_charging_schedule gespeichert # (PyScript kann States mit beliebig großen Attributen erstellen) # Input Numbers für Konfiguration input_number: battery_optimizer_min_soc: name: "Batterie Min SOC" min: 0 max: 100 step: 5 initial: 20 unit_of_measurement: "%" icon: mdi:battery-low battery_optimizer_max_soc: name: "Batterie Max SOC" min: 0 max: 100 step: 5 initial: 100 unit_of_measurement: "%" icon: mdi:battery-high battery_optimizer_price_threshold: name: "Preis-Schwellwert für Laden" min: 0 max: 50 step: 0.5 initial: 28 unit_of_measurement: "ct/kWh" icon: mdi:currency-eur battery_optimizer_max_charge_power: name: "Max Ladeleistung" min: 1000 max: 10000 step: 500 initial: 10000 unit_of_measurement: "W" icon: mdi:lightning-bolt battery_optimizer_reserve_capacity: name: "Reserve für Eigenverbrauch" min: 0 max: 10 step: 0.5 initial: 2 unit_of_measurement: "kWh" icon: mdi:battery-medium # Input Boolean für Steuerung input_boolean: battery_optimizer_enabled: name: "Batterie-Optimierung aktiv" initial: true icon: mdi:robot battery_optimizer_manual_override: name: "Manuelle Steuerung" initial: false icon: mdi:hand-back-right # Input Select für Strategie 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 für Visualisierung template: - sensor: - name: "Nächste Ladestunde" unique_id: next_charging_hour state: > {% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %} {% if schedule %} {% set ns = namespace(next_hour=None) %} {% for hour, data in schedule.items() %} {% if data.action == 'charge' and hour > now().strftime('%Y-%m-%d %H:00:00') %} {% if ns.next_hour is none or hour < ns.next_hour %} {% set ns.next_hour = hour %} {% endif %} {% endif %} {% endfor %} {{ ns.next_hour if ns.next_hour else 'Keine' }} {% else %} Kein Plan erstellt {% endif %} icon: mdi:clock-start - name: "Geplante Ladungen heute" unique_id: planned_charges_today state: > {% set schedule = state_attr('pyscript.battery_charging_schedule', 'schedule') %} {% if schedule %} {% set today = now().strftime('%Y-%m-%d') %} {% set ns = namespace(count=0) %} {% for hour, data in schedule.items() %} {% if data.action == 'charge' and hour.startswith(today) %} {% set ns.count = ns.count + 1 %} {% endif %} {% endfor %} {{ ns.count }} {% else %} 0 {% endif %} unit_of_measurement: "Stunden" icon: mdi:counter - name: "Durchschnittspreis heute" unique_id: average_price_today state: > {% set prices = state_attr('sensor.hastrom_flex_pro', 'prices_today') %} {% if prices %} {{ (prices | sum / prices | count) | round(2) }} {% else %} unknown {% endif %} unit_of_measurement: "ct/kWh" icon: mdi:chart-line device_class: monetary