ModbusTaks with multiple unitIDs


I am trying to implement an ESS for victron. The multiplus 2 offers ESS features out of the box so there is no need to add batteries.
But to gather all relevant information I have to set up different Modbus Tasks with different unit-ids.
Has anybody done this before and can give my some advice?


Hi klinki,

as far as I know the best way to do it is to create a new bundle (or a subpackage within the existing bundle) and create a new OpenEMS component inheriting from AbstractOpenemsModbusComponent. See victron implementation for examples. You could do it analogue to e.g. the victron meter. So for example you may have

  • a modbus bridge with componentId modbus1
  • a batteryinverter with componentId inverter1 referencing modbus bridge modbus1 with modbus unit id 10
  • your new battery package implementation (analogue to the victron meter) with componentId battery1 referencing modbus bridge modbus1 with modbus unit id 11

The modbus bridge will then install at least one read task for modbus unit id 10 and one for modbus unit id 11

We had a similar use-case once here: openems/io.openems.edge.ess.byd.container/src/io/openems/edge/ess/byd/container at develop · OpenEMS/openems · GitHub

That code is a few years old, so I am not sure how much “best practice” it is nowadays.


Good morning,

Thanks to you both for the advice. I think I’ll follow Christian´s path as they’ve already implemented a lot of victron devices and their approach is well structured and I can use many code lines out of the box.

I have already a rudimental ESS function running in combination with ESS cluster.
After my first steps I really do like victron’s products. But there is some kind of overkill in functionality :face_with_peeking_eye:


@stefan.feilmeier: Thanks for pointing to this. Don’ t know that it is relatively easy to handle this case. From time to time we have to implement double chargepoints (german “Doppelstele”. Sometimes they are handled by three modbus unit ids, one for the core, one for the left and one for the right side. This could be the way to go for this kind of devices.

1 Like

Ok, good to know. If these use-cases happen more often, we should support them better in the framework - especially if the Component uses the same bridge with different Unit-IDs.

Digging a bit deeper we will not use one component for a double chargepoint.
This would completely break UI charge point visualisation and also the configuration of a double chargepoint would be different (Felix, Apps,…).