add battery charging and hot water algos

This commit is contained in:
Cyryl Płotnicki 2024-06-23 12:11:35 +01:00
parent 1172df42c2
commit 2c8801fe42
2 changed files with 140 additions and 0 deletions

60
charge_battery.yaml Normal file
View file

@ -0,0 +1,60 @@
alias: charge battery
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.very_cheap_electricity
- platform: state
entity_id:
- sensor.octopus_energy_electricity_17l0054650_1100015280504_current_rate
- platform: state
entity_id:
- input_boolean.keep_battery_charged
condition: []
action:
- alias: Charge if very cheap or if we really need it
if:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.very_cheap_electricity
state: "on"
- condition: state
entity_id: input_boolean.keep_battery_charged
state: "on"
alias: very cheap electricity or manual charge forced
then:
- service: script.charge_battery
data: {}
else:
- alias: Charge if cheap-ish and we really need it
if:
- condition: state
entity_id: binary_sensor.octopus_energy_target_cheapest_2h_before_morning
state: "on"
- condition: numeric_state
entity_id: sensor.house_energy_left
below: sensor.average_daily_electricity_consumption
then:
- service: script.charge_battery
data: {}
else:
- alias: continue charging if still relatively cheap or stop
if:
- condition: and
conditions:
- alias: relatively cheap electricity still
condition: numeric_state
entity_id: >-
sensor.octopus_energy_electricity_17l0054650_1100015280504_current_rate
below: 0.1
- condition: numeric_state
entity_id: sensor.growatt_batterystateofcharge
above: 94
then:
- service: script.charge_battery
data: {}
else:
- service: script.go_back_to_normal_battery_charging
data: {}
mode: single

80
hot_water.yaml Normal file
View file

@ -0,0 +1,80 @@
alias: hot water
description: ""
trigger:
- platform: time
at: "07:00:00"
- platform: numeric_state
entity_id: sensor.myenergi_eddi_23473751_temp_tank_1
below: 45
- platform: numeric_state
entity_id: sensor.growatt_inputpower
above: 200
- platform: numeric_state
entity_id:
- sensor.growatt_batterystateofcharge
above: 35
- platform: state
entity_id:
- sensor.myenergi_eddi_23473751_status
from: Boosting
- platform: state
entity_id:
- binary_sensor.very_cheap_electricity
to: "on"
- platform: state
entity_id:
- binary_sensor.taking_a_shower_now
to: "off"
- platform: state
entity_id:
- binary_sensor.octopus_energy_target_cheapest_2h_before_morning
to: "on"
condition:
- condition: state
entity_id: binary_sensor.taking_a_shower_now
state: "off"
enabled: true
- condition: or
conditions:
- alias: Enough energy or cheap power from the grid
condition: or
conditions:
- alias: Enough battery and at least minimal solar
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.growatt_batterystateofcharge
above: 35
- condition: numeric_state
entity_id: sensor.solcast_pv_forecast_power_next_30_mins
above: 200
- condition: numeric_state
entity_id: sensor.growatt_invpowertolocalload
below: 1000
- condition: state
entity_id: binary_sensor.very_cheap_electricity
state: "on"
- condition: and
conditions:
- alias: Low solar or very cold water
condition: or
conditions:
- condition: numeric_state
entity_id: sensor.solcast_pv_forecast_forecast_remaining_today
below: 6
- condition: numeric_state
entity_id: sensor.myenergi_eddi_23473751_temp_tank_1
below: 25
- condition: state
entity_id: binary_sensor.octopus_energy_target_cheapest_2h_before_morning
state: "on"
alias: We really need hot water and electricity is now the cheapest
action:
- service: myenergi.myenergi_eddi_boost
data:
target: Heater 1
time: 29
target:
device_id: 98ed56e9624a0439ce47e66b358e720d
mode: single