In a photovoltaic system with batteries, the inverter tries to keep the energy balance at zero, as long as there is charge in the batteries and / or sufficient solar radiation.

When the battery reaches a charge level above 80%, if the solar energy is higherr than the loads in the house, the inverter begins to export energy to the grid because the speed of charge can’t be as quick as when the SOC (state of charge) is lower.


The idea here is to start / stop various resistive loads (mainly heaters) to use the energy in the house and not give it away to the power company.
The use of resistive loads facilitates the response of the automations because if, for example, other loads such an oven or the climate system are started, because these resistive loads are stopped immediately by the smart switches with no delay. On the contrary, other kind of loads such ovens, microwaves or climate systems have a load curve more irregular as shown in the figure above, hence more difficult to control.

For that purpose we need several heaters and smart switches and create a couple of automations for each heater, one for start and the other for stop.

All the automations run every 15 seconds. The trigger conditions to switch heaters on/off are as follows:
Heater number/priority | Conditions for switching on | Conditions for switching off |
1 | Inverter state is exporting and Exported power > 100 Watts during 10 seconds | switch1 is on and Battery soc < 90 and Battery state is discharging |
2 | switch1 is on and inverter state is exporting during 5 seconds | switch2 on and Battery soc < 90 and Battery state is discharging |
n | switch (n-1) is on and inverter state is exporting during 5 seconds | switchn is on and Battery soc < 90 and Battery state is discharging |




Day 4: A quite good winter day. Notice how the loads are regulated depending on solar power
Automation configuration YAML’s
----- alias: 1 - ASEO ON description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: state entity_id: sensor.goodwe_grid_in_out_label state: Exporting for: hours: 0 minutes: 0 seconds: 10 - condition: time after: '23:00' before: '21:00' - condition: numeric_state entity_id: sensor.goodwe_pgrid above: '100' action: - type: turn_on device_id: 89d61bd5efd1f26648f999a63ac4a99c entity_id: switch.aseo domain: switch mode: single ----- alias: 1 - ASEO OFF description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: numeric_state entity_id: sensor.goodwe_battery_soc below: '90' - condition: state entity_id: sensor.goodwe_battery_mode_label state: Discharge for: hours: 0 minutes: 0 seconds: 0 - condition: time after: '23:00' before: '21:00' - condition: state entity_id: switch.aseo state: 'on' action: - type: turn_off device_id: 89d61bd5efd1f26648f999a63ac4a99c entity_id: switch.aseo domain: switch mode: single ----- alias: 2 - RED ON description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: state entity_id: sensor.goodwe_grid_in_out_label state: Exporting for: hours: 0 minutes: 0 seconds: 5 - condition: time after: '23:00' before: '21:00' - condition: state entity_id: switch.aseo state: 'on' action: - type: turn_on device_id: 5e5d152c353ced8e64c238621be02e75 entity_id: switch.red_heater domain: switch mode: single ----- alias: 2 -RED OFF description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: state entity_id: switch.red_heater state: 'on' - condition: state entity_id: sensor.goodwe_battery_mode_label state: Discharge for: hours: 0 minutes: 0 seconds: 0 - condition: time after: '23:00' before: '21:00' - condition: numeric_state entity_id: sensor.goodwe_battery_soc below: '90' action: - type: turn_off device_id: 5e5d152c353ced8e64c238621be02e75 entity_id: switch.red_heater domain: switch mode: single ----- alias: 3 - BAÑO AZUL ON description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: state entity_id: sensor.goodwe_grid_in_out_label state: Exporting for: hours: 0 minutes: 0 seconds: 5 - condition: time after: '23:00' before: '21:00' - condition: state entity_id: switch.aseo state: 'on' - condition: state entity_id: switch.red_heater state: 'on' action: - type: turn_on device_id: 04596c16707b6df848988fe285cadba0 entity_id: switch.estufa_bano_azul domain: switch mode: single ----- alias: 3 - BAÑO AZUL OFF description: '' trigger: - platform: time_pattern seconds: /15 condition: - condition: state entity_id: sensor.goodwe_battery_mode_label state: Discharge for: hours: 0 minutes: 0 seconds: 0 - condition: state entity_id: switch.estufa_bano_azul state: 'on' - condition: time after: '23:00' before: '21:00' - condition: numeric_state entity_id: sensor.goodwe_battery_soc below: '90' action: - type: turn_off device_id: 04596c16707b6df848988fe285cadba0 entity_id: switch.estufa_bano_azul domain: switch mode: single
Note: In my own setting, I have an ‘special’ condition, because between 21oo ans 23oo I have free energy from the grid:
after: '23:00' before: '21:00'
SOME OTHER PICTURES




You can find my production/utilisation curves here
Hope it helps!! 🙂