Criticism and/or Comments on my Victron Automation

I do everything in HomeAssistant:

#Set maximum inverter power based on PV generation before sunset and battery full

  • alias: Set Maximum Inverter Power Based on PV Generation before SOC 100 and Sunset
    trigger:
    platform: state
    entity_id: sensor.DC_from_PV
    condition:
    condition: and
    conditions:
    - condition: sun
    before: sunset
    - condition: sun
    after: sunrise
    - condition: template
    value_template: “{{ (states(‘sensor.Battery_SOC’)|int) < 100 }}”
    action:
    service: modbus.write_register
    data_template:
    unit: 100
    value: “{{ states(‘sensor.dc_from_PV’)|int / 10 + states(‘input_number.input_maximum_battery_discharge_after_sunrise_before_battery_full’)|int / 10 }}”
    hub: victron
    address: 2704

#Set to Keep Batteries Charged after SOC 100 and remove inverter maximum cap

  • alias: Set Victron ESS Mode to Keep Batteries Charged after SOC 100 and before Sunset
    trigger:
    platform: time_pattern
    minutes: /1
    condition:
    condition: and
    conditions:
    - condition: sun
    before: sunset
    - condition: sun
    after: sunrise
    - condition: state
    entity_id: sensor.Battery_SOC
    state: ‘100’
    action:
    service: modbus.write_register
    data_template:
    unit: 100
    value: 9
    hub: victron
    address: 2900

  • alias: Remove Inverter Cap after Keep Batteries Charged was set
    trigger:
    #platform: state
    #entity_id: sensor.Battery_SOC
    platform: time_pattern
    minutes: /1
    condition:
    condition: and
    conditions:
    - condition: sun
    before: sunset
    #before_offset: +00:30:00
    - condition: sun
    after: sunrise
    #after_offset: -00:30:00
    - condition: state
    entity_id: sensor.Battery_SOC
    state: ‘100’
    action:
    service: modbus.write_register
    data_template:
    unit: 100
    value: 500
    hub: victron
    address: 2704

#Set ESS Mode to Without Battery Life after Sunset and introduce the after sunset inverter maximum cap

  • alias: Set Victron ESS mode to Without Battery Life after Sunset
    trigger:
    platform: time_pattern
    minutes: /1
    condition:
    condition: and
    conditions:
    - condition: sun
    after: sunset
    action:
    service: modbus.write_register
    data_template:
    unit: 100
    value: 10
    hub: victron
    address: 2900

  • alias: Set Inverter Maximum Cap after Sunset
    trigger:
    platform: time_pattern
    minutes: /1
    condition:
    condition: and
    conditions:
    - condition: sun
    after: sunset
    action:
    service: modbus.write_register
    data_template:
    unit: 100
    value: “{{ states(‘sensor.dc_from_PV’)|int / 10 + states(‘input_number.input_maximum_battery_discharge_after_sunset’)|int / 10 }}”
    hub: victron
    address: 2704

Seems to actually work so far (expected something to break!) and it nicely switched over at sunset, did its thing before sunset. Will now just see how tomorrow goes.

I’m actually quite excited about this, because I just couldn’t find a setting in ESS that allows me to have the following effect:

  1. All available PV first goes to service load, then charge battery
  2. If not enough PV available, take from grid

I’ll still refine it a bit, for example, if I note that the battery early in the day, I don’t need to go to “Keep Batteries Charged until Sunset”, I can actually keep the batteries available for discharge up to a preset amount.

I tried to do that crudely, but I didn’t appreciate that the “ramping up” of solar production is delayed with the ModBus updates (like once every 30 seconds) should the batteries already be full. Because I don’t have a reliable way of knowing how much PV is available when the batteries are already full, I still limit the inverter to DC from PV + X (where X is the max battery discharge I want to allow). So then if it needs to ramp up say 3000W, it will take 3000/X/2 minutes to ramp up. This I just found more frustrating than just putting it on Keep Batteries Charged without any inverter limit. Then it can ramp up as quickly as required.

It would be so nice if there is a way to know what your PV potential is at any point in time… Victron should sell a little panel that you can put on your roof that then integrates with your GX to give you that info… :sweat_smile:

Btw, do you know if it is possible to put two actions in one “automation”? I hate that I have to duplicate it to do two things… Just feels super inefficient having to test the same conditions twice…

1 Like