Leeshore Is it possible if you could share the code for your automation to stop clipping?
No problem, here is the full automation. Its obviously custom to my own setup with two inverters and there is some bits that remain disabled, but in essence the sequence was:
If solar forecast is high, stop both inverters from charging in the morning, so export everything
Mid morning start trickle charging one inverter
Midday start trickle charging second inverter and if first isn’t full, set to full charge rate
Set to full charge rate just before dusk in case there are overnight cheap rate slots predbat wants to charge from
There were bits about forcing demand overnight as well to run the batteries down, or force discharge to ensure empty in the morning.
alias: Predbat summer clipping control v2
description: Using predbat_manual_api
triggers:
- trigger: time
at:
entity_id: sensor.sun_next_dawn
offset: "-00:30:00"
id: sunrise
- trigger: time
at:
- "11:00:00"
id: morning-start-G
- trigger: time
at: "13:45:00"
id: midday-start-H
- trigger: time
at:
entity_id: sensor.sun_next_dusk
offset: "-00:20:00"
id: sunset-stop-cross-charging
enabled: true
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
alias: Sunrise
id:
- sunrise
sequence:
- if:
- alias: Today's solar forecast is above 40kWh, clipping will occur
condition: numeric_state
entity_id: sensor.predbat_pv_today
above: 40
then:
- alias: Stop charging, set charge rate to 100W
action: select.select_option
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=100,inverter_limit_charge(1)=0
else:
- action: select.select_option
alias: Set G & H to max charge rate
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=2600,inverter_limit_charge(1)=2600
alias: Stop charging until peak of the day
- conditions:
- condition: trigger
alias: Start trickle charging G
id:
- morning-start-G
sequence:
- alias: Cancel trickle discharge
action: select.select_option
target:
entity_id:
- select.predbat_manual_api
data:
option: >-
inverter_limit_discharge(0)=2600,inverter_limit_discharge(1)=2600
- action: switch.turn_on
target:
entity_id: switch.predbat_set_charge_freeze
data: {}
enabled: false
- if:
- condition: numeric_state
alias: Today's solar forecast is above 30kWh
entity_id: sensor.predbat_pv_today
above: 30
then:
- action: select.select_option
alias: Trickle charge G, set charge rate to 1500W & H to 0W
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=1500,inverter_limit_charge(1)=0
else:
- action: select.select_option
alias: Set G & H to max charge rate
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=2600,inverter_limit_charge(1)=2600
- conditions:
- condition: trigger
alias: Start trickle charging H
id:
- midday-start-H
sequence:
- if:
- condition: numeric_state
alias: If G is not already half full
entity_id: sensor.g_sd2237g182_soc
below: 50
then:
- action: select.select_option
alias: Set G to max charge rate
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=2600
- if:
- condition: numeric_state
alias: Today's solar forecast is above 30kWh
entity_id: sensor.predbat_pv_today
above: 30
then:
- alias: Set H charge rate to 1000W
action: select.select_option
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(1)=1000
else:
- action: select.select_option
alias: Set G & H to max charge rate
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=2600,inverter_limit_charge(1)=2600
- conditions:
- condition: trigger
alias: Stop inverters cross charging after sunset
id:
- sunset-stop-cross-charging
sequence:
- alias: Set H charge rate to 0W to stop cross charging
action: select.select_option
target:
entity_id:
- select.predbat_manual_api
data:
option: inverter_limit_charge(0)=2000,inverter_limit_charge(1)=0
enabled: false
- delay:
seconds: 20
enabled: false
- action: select.select_option
alias: Grid import for 10-11pm evening Cosy period
target:
entity_id:
- select.predbat_manual_freeze_charge
data:
option: 22:00:00,22:30:00
enabled: false
- delay:
seconds: 20
enabled: false
- alias: Run off batteries from 11pm to 6am
action: select.select_option
target:
entity_id:
- select.predbat_manual_demand
data:
option: >-
22:00:00,22:30:00,23:00:00,23:30:00,04:00:00,04:30:00,05:00:00,05:30:00
enabled: false
- action: switch.turn_off
target:
entity_id: switch.predbat_set_charge_freeze
data: {}
enabled: false
- action: select.select_option
metadata: {}
data:
option: Control charge & discharge
target:
entity_id: select.predbat_mode
- conditions:
- condition: trigger
alias: Discharge the batteries after sunrise
id:
- sunrise-discharge
enabled: true
sequence:
- if:
- alias: Today's solar forecast is above 45kWh, clipping will occur
condition: numeric_state
entity_id: sensor.predbat_pv_today
above: 45
then:
- alias: Trickle discharge, set discharge rate to 1400W
action: select.select_option
target:
entity_id:
- select.predbat_manual_api
data:
option: >-
inverter_limit_discharge(0)=1400,inverter_limit_discharge(1)=1400
- alias: Empty the remaining battery power
action: select.select_option
target:
entity_id:
- select.predbat_manual_export
data:
option: >-
05:00:00,05:30:00,06:00:00,06:30:00,07:00:00,07:30:00,08:00:00
enabled: false
trace:
stored_traces: 10
mode: single