dp100 Its very much self taught in the month or so of having home assistant setup. Observing what givenergy controls change when initiating charge and discharge on the GE app, then cursing and trial and error trying to get this into YAML code.
The full script controls my inverter on an Octopus power up event, of which there’s one today. It lets the battery charge to 50%, then checking every 10 minutes keeps the SoC at that level. Then at 2pm, the start of the power up event it initiates a force charge at full rate which will fill my battery by 4pm when the power up event finishes and it stops the force charge, returning to Eco mode.
Here’s the full script if its useful to you:
``alias: G182 Inv 1 Octopus Power Up
description: >-
Only let the battery charge to 45-50% in the morning; hold charge at that
level, then force charge 2-4pm in the Octopus Power-Up period
trigger:
- platform: time_pattern
hours: "8"
minutes: /10
id: 10-min-soc-check
- platform: time_pattern
hours: "9"
minutes: /10
id: 10-min-soc-check
- platform: time_pattern
hours: "10"
minutes: /10
id: 10-min-soc-check
- platform: time_pattern
hours: "11"
minutes: /10
id: 10-min-soc-check
- platform: time_pattern
hours: "12"
minutes: /10
id: 10-min-soc-check
- platform: time_pattern
hours: "13"
minutes: /10
id: 10-min-soc-check
- platform: time
at:
- "14:00"
- "14:05"
id: power-up-start
- platform: time
at:
- "15:59:10"
id: power-up-end
condition:
- condition: template
value_template: >-
{{ (now().date()) | string ==
states('input_datetime.octopus_power_up_date') }}
action:
- choose:
- conditions:
- condition: trigger
id:
- 10-min-soc-check
sequence:
- if:
- condition: numeric_state
entity_id: sensor.g_xxxx_soc
above: 49.9
then:
- service: number.set_value
data:
value: "0"
target:
entity_id: number.g_xxxx_battery_charge_rate
else:
- if:
- condition: numeric_state
entity_id: sensor.g_xxxx_soc
below: 45
then:
- service: number.set_value
data:
value: "2600"
target:
entity_id: number.g_xxxx_battery_charge_rate
- conditions:
- condition: trigger
id:
- service: select.select_option
data:
option: Normal
target:
entity_id: select.g_xxxx_temp_pause_charge
- service: select.select_option
data:
option: Eco
target:
entity_id: select.g_xxxx_mode
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- service: number.set_value
data:
value: "2600"
target:
entity_id: number.g_xxxx_battery_charge_rate
- service: select.select_option
data:
option: "120"
target:
entity_id: select.g_xxxx_force_charge
- service: homeassistant.turn_off
data: {}
target:
entity_id: switch.g_xxxx_enable_discharge
- conditions:
- condition: trigger
id:
- service: select.select_option
data:
option: Normal
target:
entity_id: select.g_xxxx_force_charge
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- service: select.select_option
data:
option: Eco
target:
entity_id: select.g_xxxx_mode
- service: select.select_option
data:
option: "00:00:00"
target:
entity_id:
- select.g_xxxx_charge_end_time_slot_1
- select.g_xxxx_charge_start_time_slot_1
- select.g_xxxx_discharge_start_time_slot_1
- select.g_xxxx_discharge_end_time_slot_1
- service: number.set_value
data:
value: "1900"
target:
entity_id: number.g_xxxx_battery_charge_rate
- service: homeassistant.turn_on
data: {}
target:
entity_id: switch.g_xxxx_enable_discharge
mode: single
``