Update: Battery Optimizer v3.4.0 mit allen Fixes und Features
This commit is contained in:
172
automations/battery_optimizer_automations.yaml
Normal file
172
automations/battery_optimizer_automations.yaml
Normal file
@@ -0,0 +1,172 @@
|
||||
# ============================================
|
||||
# Battery Charging Optimizer v3 - Automatisierungen
|
||||
# ============================================
|
||||
# Diese Automatisierungen zu deiner automations.yaml hinzufügen
|
||||
# oder über die UI erstellen
|
||||
#
|
||||
# HINWEIS: Die Keep-Alive und ESS-Modus Automations sind NICHT enthalten,
|
||||
# da diese bereits existieren:
|
||||
# - speicher_manuell_laden.yaml (Keep-Alive alle 30s)
|
||||
# - manuelle_speicherbeladung_aktivieren.yaml (ESS → REMOTE)
|
||||
# - manuelle_speicherbeladung_deaktivieren.yaml (ESS → INTERNAL)
|
||||
|
||||
|
||||
# Automatisierung 1: Tägliche Planerstellung um 14:05 Uhr
|
||||
alias: "Batterie Optimierung: Tägliche Planung"
|
||||
description: "Erstellt täglich um 14:05 Uhr den Ladeplan basierend auf Strompreisen"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "14:05:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Neuer Ladeplan erstellt"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 2: Stündliche Ausführung des Plans
|
||||
alias: "Batterie Optimierung: Stündliche Ausführung"
|
||||
description: "Führt jede Stunde zur Minute :05 den Ladeplan aus"
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: "5"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
state: "off"
|
||||
action:
|
||||
- service: pyscript.execute_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 3: Initiale Berechnung nach Neustart
|
||||
alias: "Batterie Optimierung: Start-Berechnung"
|
||||
description: "Erstellt Ladeplan nach Home Assistant Neustart"
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- delay: "00:02:00" # 2 Minuten warten bis alles geladen ist
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: pyscript.execute_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 4: Mitternachts-Neuberechnung
|
||||
alias: "Batterie Optimierung: Mitternachts-Update"
|
||||
description: "Neuberechnung um Mitternacht wenn Tomorrow-Daten im Plan waren"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "00:05:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ state_attr('pyscript.battery_charging_schedule', 'has_tomorrow_data') == true }}
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 5: Preis-Update Trigger
|
||||
alias: "Batterie Optimierung: Bei Preis-Update"
|
||||
description: "Erstellt neuen Plan wenn neue Strompreise verfügbar (nach 14 Uhr)"
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.hastrom_flex_pro_ext
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.to_state.state != trigger.from_state.state and
|
||||
now().hour >= 14 }}
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Neuer Ladeplan nach Preis-Update erstellt"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 6: Notfall-Überprüfung bei niedrigem SOC
|
||||
alias: "Batterie Optimierung: Niedrig-SOC Warnung"
|
||||
description: "Warnt wenn Batterie unter Minimum fällt"
|
||||
trigger:
|
||||
- platform: numeric_state
|
||||
entity_id: sensor.esssoc
|
||||
below: 20
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Warnung"
|
||||
message: "Batterie-SOC ist unter {{ states('input_number.battery_optimizer_min_soc') }}%. Prüfe Ladeplan!"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 7: Manueller Override Reset
|
||||
alias: "Batterie Optimierung: Manueller Override beenden"
|
||||
description: "Deaktiviert manuellen Override nach 4 Stunden"
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
to: "on"
|
||||
for:
|
||||
hours: 4
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Manueller Override automatisch beendet"
|
||||
mode: restart
|
||||
|
||||
# Automatisierung 8: Laden stoppen wenn SOC erreicht
|
||||
alias: "Batterie Optimierung: Stopp bei Max-SOC"
|
||||
description: "Beendet manuelles Laden wenn maximaler SOC erreicht"
|
||||
trigger:
|
||||
- platform: numeric_state
|
||||
entity_id: sensor.esssoc
|
||||
above: 99
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
state: "on"
|
||||
# SOC-Plausibilitäts-Check: Filtert ungültige Werte (z.B. 65535% beim ESS-Modus-Wechsel)
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set soc = states('sensor.esssoc') | float(0) %}
|
||||
{{ soc >= 99 and soc <= 101 }}
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
# ESS-Modus wird durch manuelle_speicherbeladung_deaktivieren gesetzt
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Manuelles Laden beendet - SOC 100% erreicht"
|
||||
mode: single
|
||||
167
automations/battery_optimizer_automations.yaml.backup
Normal file
167
automations/battery_optimizer_automations.yaml.backup
Normal file
@@ -0,0 +1,167 @@
|
||||
# ============================================
|
||||
# Battery Charging Optimizer v3 - Automatisierungen
|
||||
# ============================================
|
||||
# Diese Automatisierungen zu deiner automations.yaml hinzufügen
|
||||
# oder über die UI erstellen
|
||||
#
|
||||
# HINWEIS: Die Keep-Alive und ESS-Modus Automations sind NICHT enthalten,
|
||||
# da diese bereits existieren:
|
||||
# - speicher_manuell_laden.yaml (Keep-Alive alle 30s)
|
||||
# - manuelle_speicherbeladung_aktivieren.yaml (ESS → REMOTE)
|
||||
# - manuelle_speicherbeladung_deaktivieren.yaml (ESS → INTERNAL)
|
||||
|
||||
|
||||
# Automatisierung 1: Tägliche Planerstellung um 14:05 Uhr
|
||||
alias: "Batterie Optimierung: Tägliche Planung"
|
||||
description: "Erstellt täglich um 14:05 Uhr den Ladeplan basierend auf Strompreisen"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "14:05:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Neuer Ladeplan erstellt"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 2: Stündliche Ausführung des Plans
|
||||
alias: "Batterie Optimierung: Stündliche Ausführung"
|
||||
description: "Führt jede Stunde zur Minute :05 den Ladeplan aus"
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: "5"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
state: "off"
|
||||
action:
|
||||
- service: pyscript.execute_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 3: Initiale Berechnung nach Neustart
|
||||
alias: "Batterie Optimierung: Start-Berechnung"
|
||||
description: "Erstellt Ladeplan nach Home Assistant Neustart"
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- delay: "00:02:00" # 2 Minuten warten bis alles geladen ist
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: pyscript.execute_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 4: Mitternachts-Neuberechnung
|
||||
alias: "Batterie Optimierung: Mitternachts-Update"
|
||||
description: "Neuberechnung um Mitternacht wenn Tomorrow-Daten im Plan waren"
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "00:05:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ state_attr('pyscript.battery_charging_schedule', 'has_tomorrow_data') == true }}
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
# Automatisierung 5: Preis-Update Trigger
|
||||
alias: "Batterie Optimierung: Bei Preis-Update"
|
||||
description: "Erstellt neuen Plan wenn neue Strompreise verfügbar (nach 14 Uhr)"
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.hastrom_flex_pro_ext
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.to_state.state != trigger.from_state.state and
|
||||
now().hour >= 14 }}
|
||||
action:
|
||||
- service: pyscript.calculate_charging_schedule
|
||||
data: {}
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Neuer Ladeplan nach Preis-Update erstellt"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 6: Notfall-Überprüfung bei niedrigem SOC
|
||||
alias: "Batterie Optimierung: Niedrig-SOC Warnung"
|
||||
description: "Warnt wenn Batterie unter Minimum fällt"
|
||||
trigger:
|
||||
- platform: numeric_state
|
||||
entity_id: sensor.esssoc
|
||||
below: 20
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.battery_optimizer_enabled
|
||||
state: "on"
|
||||
action:
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Warnung"
|
||||
message: "Batterie-SOC ist unter {{ states('input_number.battery_optimizer_min_soc') }}%. Prüfe Ladeplan!"
|
||||
mode: single
|
||||
|
||||
# Automatisierung 7: Manueller Override Reset
|
||||
alias: "Batterie Optimierung: Manueller Override beenden"
|
||||
description: "Deaktiviert manuellen Override nach 4 Stunden"
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
to: "on"
|
||||
for:
|
||||
hours: 4
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.battery_optimizer_manual_override
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Manueller Override automatisch beendet"
|
||||
mode: restart
|
||||
|
||||
# Automatisierung 8: Laden stoppen wenn SOC erreicht
|
||||
alias: "Batterie Optimierung: Stopp bei Max-SOC"
|
||||
description: "Beendet manuelles Laden wenn maximaler SOC erreicht"
|
||||
trigger:
|
||||
- platform: numeric_state
|
||||
entity_id: sensor.esssoc
|
||||
above: 99
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
state: "on"
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
# ESS-Modus wird durch manuelle_speicherbeladung_deaktivieren gesetzt
|
||||
- service: notify.persistent_notification
|
||||
data:
|
||||
title: "Batterie-Optimierung"
|
||||
message: "Manuelles Laden beendet - SOC 100% erreicht"
|
||||
mode: single
|
||||
19
automations/manuelle_speicherbeladung_aktivieren.yaml
Normal file
19
automations/manuelle_speicherbeladung_aktivieren.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
alias: "Switch: Manuelle Speicherbeladung aktivieren"
|
||||
description: ""
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- input_boolean.goodwe_manual_control
|
||||
from: "off"
|
||||
to: "on"
|
||||
conditions: []
|
||||
actions:
|
||||
- action: rest_command.set_ess_remote_mode
|
||||
data: {}
|
||||
- action: automation.turn_on
|
||||
metadata: {}
|
||||
data: {}
|
||||
target:
|
||||
entity_id: automation.automation_speicher_manuell_laden
|
||||
mode: single
|
||||
|
||||
20
automations/manuelle_speicherbeladung_deaktivieren.yaml
Normal file
20
automations/manuelle_speicherbeladung_deaktivieren.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
alias: "Switch: Manuelle Speicherbeladung deaktivieren"
|
||||
description: ""
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- input_boolean.goodwe_manual_control
|
||||
from: "on"
|
||||
to: "off"
|
||||
conditions: []
|
||||
actions:
|
||||
- action: automation.turn_off
|
||||
metadata: {}
|
||||
data:
|
||||
stop_actions: true
|
||||
target:
|
||||
entity_id: automation.automation_speicher_manuell_laden
|
||||
- action: rest_command.set_ess_internal_mode
|
||||
data: {}
|
||||
mode: single
|
||||
|
||||
24
automations/speicher_manuell_laden.yaml
Normal file
24
automations/speicher_manuell_laden.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
alias: "Automation: Speicher manuell laden"
|
||||
description: "Keep-Alive für manuelles Laden - sendet alle 30s Modbus-Befehl. Mit SOC-Plausibilitäts-Check."
|
||||
triggers:
|
||||
- trigger: time_pattern
|
||||
seconds: /30
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
state: "on"
|
||||
# SOC-Plausibilitäts-Check: Nur laden wenn SOC plausibel (<= 100%)
|
||||
# Filtert ungültige Werte wie 65535% beim ESS-Modus-Wechsel
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set soc = states('sensor.esssoc') | float(50) %}
|
||||
{{ soc <= 100 }}
|
||||
actions:
|
||||
- action: pyscript.ess_set_power
|
||||
metadata: {}
|
||||
data:
|
||||
hub: openEMS
|
||||
slave: 1
|
||||
power_w: "{{ states('input_number.charge_power_battery') | float(0) }}"
|
||||
mode: single
|
||||
|
||||
18
automations/speicher_manuell_laden.yaml.backup
Normal file
18
automations/speicher_manuell_laden.yaml.backup
Normal file
@@ -0,0 +1,18 @@
|
||||
alias: "Automation: Speicher manuell laden"
|
||||
description: ""
|
||||
triggers:
|
||||
- trigger: time_pattern
|
||||
seconds: /30
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.goodwe_manual_control
|
||||
state: "on"
|
||||
actions:
|
||||
- action: pyscript.ess_set_power
|
||||
metadata: {}
|
||||
data:
|
||||
hub: openEMS
|
||||
slave: 1
|
||||
power_w: "{{ states('input_number.charge_power_battery') | float(0) }}"
|
||||
mode: single
|
||||
|
||||
Reference in New Issue
Block a user