Switch ESS modes programatically?

Hi all!

Is there a way to set the ESS mode via Modbus? Or remotely (from Home Assistant)?

I’m looking for a way to set the ESS mode to “Keep batteries charged” at a certain point, and then switch it back to Optimized (with BatteryLife) later.

Check out this post

1 Like

Based on what your “certain points” are, Cronjob is a definite option to look at yes.

Home Assistant can use modbus. You can also use MQTT, but I use modbus for some of my stuff.

See here: ESS mode 2 and 3 [Victron Energy]

And here (look for the ESS state): dbus · victronenergy/venus Wiki · GitHub

And look on the Victron website for the document “modbus registers” or something like that, then look for the register that corresponds to /Settings/CGwacs/BatteryLife/State (2900 I believe).

Usually you will write a 1 (optimised with batterylife), 9 (Keep Batteries Charged) or 10 (Optimised without batterylife) to that register.

Thanks plonkster – I do use Home Assistant with modbusTCP but for some or other reason thought that register was not writable. D’oh!

From what I could gather from the long thread (the Charge only from Solar one) and the Cronjob one many users rather tweak the following:

  • MinimumSOC
  • Grid setpoint
  • Inverter On/Off (or max W)
  • Charger On/Off (or max W)

I misunderstood something about the minimum SOC and the state machine and avoided it at first, but after some additional experimentation, I think it might do what I want.

In short – I want to let the sun charge batteries up to 100% and then avoid using batteries during the peak evening hours, but rather start using batteries later at night. The basic aim is to ensure that I have battery power throughout the night (I live in an area that is prone to cable theft or municipal issues) - it should reach my usual minimum SOC of 30% more or less just before the sun starts shining in full force again the next morning.

Of course, always the chance that the sun won’t shine the next morning, and estimating my usage for the night is tricky too, but at least it won’t deplete batteries by 23:00 due to the stove/oven/power-hungry PCs etc. during the early evenings.

Next project: getting my crypto miner going on excess solar power to mine crypto and pay for another PylonTech… :slight_smile:

1 Like

At 4pm:
Scheduled Charging from 16h00 for 6 hours with SOC set to 35%, so no Eskom is used, gets me to 10pm.
This stops discharging, the last rays gets the batteries topped up to above 95%.

At 10pm:
Min SOC set to 40%
Max Inverter power: 700w
This works per season, for if set right, sun takes over before I hit 40%.

At 9am:
Set Inverter back to max power again.
Done so to give the batts a “headstart” from the Min SOC of ±40%, from last nights use.

Only thing left to figure:
To up the Min SOC so that during peak hours, also the hottest time of day, that very little batts are used.
And if there is a weather issue, still don’t want batts to power the big loads below a Min SOc of say 80%.

OK so I tested the Min SOC idea for two days:

  • set min soc at 16:30 to 85%
  • set min soc at 22:00 to 30% (the usual I’m usually running at)

This worked great the first day - batteries reached 100% sometime in the morning, ran from solar the rest of the day, started dipping into batteries until 85% and stopped, then ran from grid until 22:00 and then started going down until more or less 5:30 where it reached 30% and then back to the grid.

Second day
was more cloudy but still reached 100%. Switched to 85% min SOC at 16:30. Used batteries until around 19:00 when SOC reached 85%.

Then used grid until 22:00 - set min to 30% and started using batteries again.

But then it went wrong - reached 80% ± 30 mins later and then went back to grid? This morning I’m still at basically 80% batteries and I see the effective min SOC is 80%.

What am I missing? I assume the battery life algorithm is causing this?

The active Soc can cause this. Try to repeat the test and select “without battery life”

1 Like

Thanks Jaco.

I assume the effect here will be that on cloudy days, where I don’t reach 85% by 16:30, it will effectively charge from the grid until I reach 85%?

Thereby basically forcing a battery charge/discharge cycle every day?

Correct, or you can step it down and back up in increments. More steps will allow it to try and reach the setpoint from pv first and top up a little from the grid at the end of the step if it did not reach the setpoint. Using more steps on a cloudy day will result in the system havesting all the power it can.

For example, raise the setpoint by 5.or 10% every 30min or 1 hour.

I had a lot of fun with similar algorithms in the past.

Thanks will give it a go!

One more thing - if you limit the inverter power.

What happens if the grid disappear? And especially if you were pulling above the limit?

The limit is only active while grid is available. But limiting in daytime will also limit power from the panels. So use limit during night time hours if you can.