Controlling Victron ESS Grid Setpoint via Modbus TCP from LOGO! 8

David Krause15 min read
ModbusSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Controlling Victron ESS Grid Setpoint via Modbus TCP from Siemens LOGO! 8

This technical reference describes how to use a Siemens LOGO! 8 (feature set FS4 / LOGO! 8.4) as a Modbus TCP client to write the GridSetpoint register of a Victron Energy Storage System (ESS). The use case is the classic feedback control: when a digital input on the LOGO! is energized, the LOGO! writes a negative power setpoint (e.g. -800 W) to the Victron GX device, causing the MultiPlus-II to export power to the grid. When the input is released, the setpoint is returned to 0 W so that the ESS resumes normal self-consumption behaviour.

The instructions below cover the register map of the Victron GX Modbus TCP server, the LOGO! 8 client configuration, the +1 address offset peculiarity of LOGO!Soft Comfort, the LOGO!Soft Comfort V8.4 program structure, and a verification procedure. The article is written for engineers commissioning a Victron MultiPlus-II / Quattro ESS in combination with a Cerbo GX, a Venus GX, or an Ekrano GX.

1. System Architecture

The complete feedback-control chain consists of four devices:

  1. LOGO! 8 (FS4) — Siemens part numbers 6ED1052-1MD08-0BA2 (LOGO! 8.4 with display, 8 DI / 4 DO, Ethernet) or 6ED1052-2MD08-0BA2 (LOGO! 8.4 pure). The LOGO! acts as the Modbus TCP client (master). It polls one digital input and, depending on the input state, writes the grid setpoint.
  2. Victron Cerbo GX / Venus GX / Ekrano GX — the communication gateway. It runs the Modbus TCP server on TCP port 502 with a default Unit Identifier of 100. See the Venus OS Modbus TCP documentation.
  3. Victron MultiPlus-II 48/3000/35-32 (or Quattro) — the inverter/charger. The GridSetpoint register is mirrored into the MultiPlus via VE.Bus.
  4. Pylontech / BYD / LiFePO4 battery bank — provides the energy that is exported to the grid.

IP addressing used in this reference (replace with the values for your network):

Device IP Address Subnet Mask Port Unit ID
LOGO! 8.4 192.168.2.135 255.255.255.0 502 (out) n/a (client)
Victron Cerbo GX 192.168.2.152 255.255.255.0 502 (listen) 100

2. Prerequisites

  1. LOGO! 8.4 with firmware 1.82.01 or later (the Modbus client functionality is mature in FS4). Earlier FS3 devices (6ED1052-xMD08-0BA0) do not support the analog write to external Modbus servers in the same way. Verify the firmware in LOGO! > Diagnostics > Device Info.
  2. LOGO!Soft Comfort V8.4 (build 1.82.01 or later). The FS4 blocks (purple connector blocks) are not available in older programming software.
  3. Victron Cerbo GX / Venus GX / Ekrano GX with Venus OS v2.90 or later (recommended v3.40+ for stable Modbus TCP performance).
  4. ESS Mode 2 or Mode 3 enabled and correctly commissioned. The GridSetpoint register is only honoured when the ESS is in self-consumption mode. See ESS mode 2 and 3 (Victron Live) and the ESS configuration page.
  5. Network connectivity between the LOGO! and the GX device. Both must be on the same VLAN and the GX device must have the Modbus TCP server enabled (Settings → Services → Modbus TCP → Enabled).
  6. Static or DHCP-reserved IP addresses for both devices — do not rely on DHCP leases when commissioning a control loop.
Important: The Victron Modbus TCP server is not write-protected by default in older Venus OS versions. Disable the Allow writes from Modbus toggle in the Remote Console if the GX is exposed to an untrusted network.

3. Victron ESS GridSetpoint Register Map

The grid setpoint of a Victron ESS is held in a signed 16-bit holding register on the GX device. According to the ESS mode 2 and 3 Modbus-TCP register reference (PDF), the relevant registers are:

Register (decimal) Name Type Scale Direction
37 (legacy) Grid power setpoint int16 1 W Read/Write
40 Grid power setpoint int16 1 W Read/Write
41 Grid power setpoint int16 1 W Read/Write
2700 (extended map) GridSetpoint int16 1 W Read/Write

Sign convention (from the same Victron reference):

  • Positive value → take power from the grid (import).
  • Negative value → feed power to the grid (export).

Therefore a value of -800 (decimal) tells the MultiPlus-II to export 800 W to the grid. Valid range in most firmware builds is -32768 ... +32767, but Victron’s ESS PDF recommends keeping the setpoint within the inverter’s continuous power rating.

The Unit Identifier on the GX device is 100. The TCP port is 502. The function code used to write a single holding register is FC 06 (Preset Single Register). To verify the value written by the LOGO!, poll the same register from any Modbus TCP client (e.g. mbpoll -m tcp -p 502 -a 100 -r 2700 -t 4:int -c 1 192.168.2.152).

4. The LOGO! 8 +1 Address Offset

LOGO!Soft Comfort uses 1-based Modbus addressing, while the Victron Modbus reference uses 0-based addresses. The LOGO! documentation explicitly states that the LOGO! inserts a +1 offset on the wire:

logo_address = victron_address + 1

So, to write to Victron register 2700, the LOGO! configuration must reference address 2701. Forgetting this offset is the most common cause of “silent” write failures — the LOGO! reports a successful transmission, but the value is written to an unused register and the grid setpoint is never updated.

The same rule applies if you use the alternate register numbers 40 or 41 from the ESS PDF. In LOGO! those become 41 and 42 respectively. Pick one register and use it consistently.

5. Configuring the LOGO! 8 as a Modbus TCP Client

5.1 IP Settings on the LOGO!

Open the LOGO! menu Network → IP Address on the device, or configure via LOGO!Soft Comfort Tools → Transfer → Ethernet Network Configuration:

  • IP address: 192.168.2.135
  • Subnet mask: 255.255.255.0
  • Default gateway: 192.168.2.1 (or your router)
  • DNS server: leave blank (not required)

5.2 Adding the Modbus Connection in LOGO!Soft Comfort

In the network editor, right-click the LOGO! and choose Add new connection → Modbus connection. Fill in the dialog:

  • Connection name: e.g. Victron_GX
  • Server IP address: 192.168.2.152
  • Port: 502
  • Slave address (Unit ID): 100
  • Polling interval: 1000 ms (default; lower values add load to the GX)
  • Response timeout: 3000 ms

This creates a purple connector block on the LOGO! that exposes 32 digital inputs, 32 digital outputs, 12 analog inputs, and 6 analog outputs (the exact number depends on the LOGO! 8.4 firmware build). The analog outputs correspond to writeable holding registers on the Modbus server.

5.3 Mapping the GridSetpoint Register

From the LOGO!Soft Comfort toolbox drag an Analog Output block (or, in the network editor, a Network Analog Output block) onto the canvas. In its properties:

  • Connection: Victron_GX
  • Register address: 2701 (Victron register 2700 + LOGO! offset 1)
  • Data type: Signed 16-bit integer
  • Scale factor: 1 (value -800 on the LOGO! is sent as -800 to the GX)

The block output NAO1 now represents the live value sent to the Victron grid setpoint register.

6. LOGO! Program: FBD/Ladder Logic for the Feedback Control

The required behaviour is:

  • When I1 (digital input 1) is 1 → write -800 to NAO1.
  • When I1 is 0 → write 0 to NAO1.

The simplest implementation uses an Analog Mux block (or an Analog Switch in the LOGO! 8.4 toolbox) with a digital selector. The FBD example below is functionally equivalent to the snippet used in the field report.

6.1 Function Block Diagram (FBD) Form

I1 ----[ B001 ]--- SEL --> 0  (release path)
                 |
                 +-- SEL --> -800  (active path)
                              |
                              v
                       [ Analog Mux ]
                              |
                              v
                          NAO1   (= address 2701 on Victron_GX)

In LOGO!Soft Comfort, configure the Analog Mux as follows:

  • Selector input S: I1
  • Input IN1 (S=0): constant 0 (block B002, gain = 1)
  • Input IN2 (S=1): constant -800 (block B003, gain = 1)
  • Output AQ: tied to NAO1 (the network analog output writing register 2701)

6.2 Ladder Logic Equivalent

If you prefer ladder, the equivalent circuit uses two branches in parallel:

---[ I1 ]---( NAO1 := -800 )   ;  when I1 is true, write -800 to NAO1
---[/I1]---( NAO1 :=    0 )   ;  when I1 is false, write 0 to NAO1

Both branches are required because the LOGO! will only push a value when the analog output changes; the falling branch guarantees that releasing I1 actively writes 0 back, rather than leaving the previous -800 in the register.

6.3 Sample ST-Style Snippet for a LOGO! 8.4 User Program (LOGOSOFT V8.4)

LOGO! 8.4 supports structured text in the function-block editor. The equivalent conditional assignment is:

IF I1 = TRUE THEN
    NAO1 := -800;
ELSE
    NAO1 :=    0;
END_IF;

LOGO!Soft Comfort compiles this to the same analog-mux network described above; the ST view is purely a programmer convenience.

7. Step-by-Step Commissioning Procedure

  1. Verify the Victron ESS is operating in Mode 2 or Mode 3 with grid metering installed. Open the Remote Console on the GX device and confirm that the Grid setpoint field under Settings → ESS is visible and reads 0 W.
  2. Enable Modbus TCP on the GX: Settings → Services → Modbus TCP → Enable. Tick Allow control of the inverter/charger (and grid setpoint) via Modbus TCP. This second toggle is required to permit writes to register 2700; without it the write is silently rejected with an illegal-data-value response.
  3. Note the Unit Identifier under Settings → Services → Modbus TCP → Unit ID. The factory default is 100. If your installation uses a non-default Unit ID (e.g. a CCGX with two stacked Modbus servers), update both the GX and the LOGO! client.
  4. Set static IP addresses on both the LOGO! and the GX. A DHCP lease change will break the write every time the router renews an address.
  5. Test connectivity from a laptop using a Modbus test client (e.g. modbus-cli, mbpoll, or the diagslave tool). Poll register 2700 to confirm the value is currently 0: mbpoll -m tcp -p 502 -a 100 -r 2700 -t 4:int -c 5 192.168.2.152. You should see five responses of 0.
  6. Write a test value with the same tool: mbpoll -m tcp -p 502 -a 100 -r 2700 -t 4:int -0 -1 192.168.2.152 (the exact flag set depends on the tool; with modbus-cli use modbus write 192.168.2.152:502/100 2700 -800). The Remote Console on the GX should show the grid setpoint jump to -800 W, and the MultiPlus should start exporting power within a few seconds (limited by the ESS smoothing time constant).
  7. Configure the LOGO! connection in LOGO!Soft Comfort as described in section 5.2. Transfer the program to the LOGO! with Tools → Transfer → PC → LOGO!.
  8. Verify the LOGO! mapping by going online (Tools → Go Online). The NAO1 block should display the value currently being sent. Energise input I1; the value should switch from 0 to -800 within one polling interval.
  9. Confirm at the GX that the grid setpoint reflects the LOGO! value. Use the Modbus read from step 5 to poll register 2700 while toggling I1.
  10. Functional safety check: with the LOGO! in run mode, drop the network cable between the LOGO! and the GX. The LOGO! will report a connection error (orange ! on the connection block). The last value remains in NAO1, so the GX will continue to honour the last setpoint. Add a watchdog — for example, have the LOGO! re-write the setpoint every 60 s even when unchanged, or have the MultiPlus fall back to self-consumption if the Modbus write timestamp is older than a few minutes.

8. Watchdog and Fail-Safe Behaviour

Victron does not implement a session-level timeout for the grid setpoint; the last written value is held indefinitely. For a residential ESS this is usually safe (the setpoint is bounded by the inverter rating), but a stuck -800 W after a network outage will continue to export. Two patterns are common in field installations:

  • Periodic re-write: the LOGO! re-sends the setpoint every 60 s using a clock-pulse block. The Victron side stays current; if the LOGO! loses power, the next re-write does not happen and the MultiPlus holds the previous value, which is acceptable for most self-consumption installations.
  • Heartbeat-driven reset: a separate LOGO! tag (e.g. NAO2 holding a heartbeat counter) is written to a different Victron register (e.g. 2702) every 10 s. A small script on the GX (Node-RED or Venus OS Large) reads the counter and, if it has not incremented for more than 30 s, reverts the grid setpoint to 0 via a manual ESS override.

Both patterns are out of scope for the LOGO! program itself, but the LOGO! must be the active Modbus client for either to work. The Victron side does not poll the LOGO! — it only stores the last value received.

9. Verification Checklist

Step Expected Result How to Check
LOGO! +1 offset applied LOGO! writes register 2701; GX sees write to 2700 mbpoll on register 2700 from a second client
Polarity correct I1 = 1 → -800 W, I1 = 0 → 0 W Remote Console grid setpoint field
MultiPlus follows AC-out power becomes negative (export) Remote Console → MultiPlus tile
Connection error indication Logo!Soft Comfort shows orange “!” on the connection block when the cable is removed Physical cable pull test
Recovery after I1 release Grid setpoint returns to 0 W Toggle I1; observe in Remote Console
Energy meter direction Grid meter shows negative (export) Remote Console → Grid meter

10. Troubleshooting Matrix

Symptom Likely Cause Diagnostic Fix
LOGO! reports no connection error but grid setpoint does not change Wrong Unit ID on LOGO! connection (e.g. 0 instead of 100) mbpoll with -a 100 from a laptop Set the LOGO! connection slave to 100
Grid setpoint always reads 0 in the Remote Console Logo! +1 offset forgotten; value written to register 2701, which is unmapped Read register 2700 with mbpoll while toggling I1 Use address 2701 in the LOGO! analog output block
LOGO! reports “Connection refused” on every cycle Modbus TCP disabled on GX, or port 502 blocked by a firewall Try nc -vz 192.168.2.152 502 from a laptop on the same subnet Enable Modbus TCP in the GX Remote Console
Write succeeds but setpoint is clamped to 0 W ESS Mode not set to 2 or 3, or grid metering missing Remote Console → ESS → Mode Configure ESS Mode 2/3 and install an ET112/ET340 meter
MultiPlus ignores the setpoint and stays in self-consumption Modbus TCP Allow control toggle not enabled on the GX Remote Console → Services → Modbus TCP Enable the “Allow control of inverter/charger” option
Setpoint flips between -800 and 0 every cycle Two clients writing simultaneously (e.g. a second LOGO! and a Home Assistant node) mbpoll in a tight loop from a laptop to see writes Centralise the Modbus write; disable the second client
Setpoint written correctly but export power is much smaller than -800 W MultiPlus power limit, or SoC too low to export Check MultiPlus max current and battery SoC Raise inverter limit or wait for SoC > user-defined export threshold
LOGO! drops the connection after a few hours Default LOGO! keep-alive is short; idle connections from a third-party client may be competing LOGO!Soft Comfort online diagnostics → Connection state Increase the polling interval to 5–10 s, or reduce the number of concurrent Modbus TCP clients

11. Notes on Register Versions and Firmware Compatibility

Victron occasionally changes the location of the grid setpoint. The register map in the current Venus OS documentation (v3.40 series) lists the setpoint at the offsets shown in the table in section 3. The legacy register 37, 40, and 41 references from the older ESS mode 2 and 3 PDF still exist as alias registers for backwards compatibility. If a firmware update moves the setpoint to a new address, the LOGO! program will continue to write to the old address silently — the analog output block in LOGO!Soft Comfort has no awareness of the GX firmware version.

Two mitigations are recommended:

  1. After every Victron firmware update, verify the register address with a Modbus read (e.g. mbpoll -m tcp -p 502 -a 100 -r 2700 -t 4:int -c 1 192.168.2.152) before trusting the LOGO! program.
  2. Subscribe to the Venus OS release notes page for register-map changes. Major version bumps (e.g. v2.x → v3.x) have historically moved the setpoint register.

On the LOGO! side, the FS4 firmware is at the time of writing at v1.82.x; LOGO!Soft Comfort V8.4 (build 1.82.01) is the recommended programming environment. LOGO! 8.3 (6ED1052-xMD08-0BA0, FS3) does support Modbus client writes, but the block diagram is different: the purple Network Analog Output block is not present, and writes are performed with the older VM mapping table under Tools → Parameter VM Mapping. If you are migrating a working FS3 program to FS4, expect to recreate the connection rather than copy it.

12. Reference: Key Part Numbers and Documents

Which Victron Modbus register holds the grid setpoint, and what is the Unit ID?

Register 2700 (decimal) on the GX device with Unit ID 100 holds the grid setpoint as a signed 16-bit integer in watts. Positive values import from the grid; negative values export to the grid. The legacy register 37, 40, or 41 from the ESS PDF can be used as alternates.

Why does my LOGO! need to write address 2701 instead of 2700?

LOGO!Soft Comfort uses 1-based Modbus addressing. The LOGO! automatically adds a +1 offset to every address on the wire, so to reach Victron register 2700 the LOGO! must be configured with address 2701. Forgetting this offset is the most common cause of a write that appears successful on the LOGO! but has no effect on the Victron.

What happens if the network connection between the LOGO! and the Cerbo GX is lost?

The last value written to register 2700 remains active indefinitely. The MultiPlus-II will keep exporting at that level until a new value is written. Implement a periodic re-write (every 60 s) or a heartbeat-driven reset in a Node-RED script on the GX to revert to 0 W if the LOGO! stops communicating.

Does the MultiPlus export power as soon as the register is written?

Yes, within the ESS smoothing time constant (typically 1–3 s). The grid setpoint is honoured only when the ESS is in Mode 2 or Mode 3 with a working grid meter (ET112, ET340, or EM540). If the MultiPlus ignores the setpoint, check that Modbus TCP control is enabled on the GX and that a grid meter is reporting in the Remote Console.

Can I write to a different Victron register from the same LOGO! connection?

Yes. Add another analog output block on the same Victron_GX connection, set its address to the new target plus 1 (e.g. 2702 for register 2701), and assign its value to a constant or a LOGO! tag. The connection block supports multiple read and write registers concurrently up to its per-connection limit (12 analog inputs and 6 analog outputs on LOGO! 8.4 FS4).

Back to blog