Control of Victron Battery Discharge and Grid Power Management via MODBUS

I want to control Victron so that I can decide when Victron is allowed to discharge the batteries at night or instead draw energy from the grid.

As I found out, I can achieve this via MODBUS registers 2704 and 2705.

As soon as I set register 2704 to 0, the system starts drawing from the grid. Additionally, I need to set register 2705 to 0 so that the battery is not charged from the grid.

This works quite well. Unfortunately, the “return” to the original state doesn’t work as smoothly. For that, I would first reset register 2704 to “-1”, and then set register 2705 to “-1”.

In practice, however, this doesn’t work. Register 2705 can be set to -1 via the value 65535 without any issues, but not register 2704. It seems I can only set 2704 to 0, but not to -1.

What am I doing wrong, or which register do I need to address to disable “limit inverter power”?

Please don’t get me wrong, I want to program this cleanly, so no “tricks” like setting register 2704 to 10,000 watts or something like that.

Hi,

Did you ever get a solution to setting register 2704 to -1 and how that is done? I’m trying the same with firmware 3.55 and with a couple of beta version of 3.60.xx and it still doesnt seem to work.

I’m getting

Blockquote dbus -y com.victronenergy.settings /Settings/CGwacs/MaxDischargePower SetValue -1
Usage: dbus [options]
Blockquote dbus: error: no such option: -1

When I’m trying directly in the CLI.

/Kaj

Ping to @mpvader - Has the following setting ever worked?

dbus -y com.victronenergy.settings /Settings/CGwacs/MaxDischargePower SetValue -1

Is it supposed to switch off the switch visually when writing -1 to the register or should something else be written to ‘switch off’ the inverter limiting its output?

Currently on 3.60~66 beta.

/Kaj

First, it is normal that you have to write 65535 to get -1. That is how a -1 is encoded in two’s complement.

Not being able to write a -1 is a bug, but one that is impossible to fix. More specifically, it’s an oversight. The register has a multiplier of 0.1, values you write here are multiplied by 10. That makes it impossible to write anything that isn’t a multiple of ten. You can however get the same effect by setting it to a very large value, a value larger than the capability of the Multi.

I am using both parameters and it works fine. However, I am using MQTT (not Modbus) based on the documentation in the CCGX-Modbus-TCP-register-list (Excel sheet from Victron).

In my setup I can write/publish “-1” to “victron/W/[VRM_id]/settings/0/Settings/CGwacs/MaxDischargePower”.

If I want to disable DVCC system max charge current (register 2705) I write/publish “-1” to “victron/W/[VRM_id]/settings/0/Settings/SystemSetup/MaxChargeCurrent”.

There seems to be a difference in how Modbus and MQTT values are treated.

Also, in the above mentioned documentation there is a discrepancy in naming:
For register 2704 the description states “ESS max discharge current” but the dbus-obj-path is “/Settings/Cgwacs/MaxDischargePower” and the dbus unit is “W”.