question

djmaxi avatar image
djmaxi asked

Energy data (kWh) from batteries not supported over CAN.Bus (Modbus/MQTT)

Good day all,

Herewith my setup:

  • MultiPlus II 48/10000/140-100
  • Cerbo GX
  • Lynx Shunt 1000A VE.Can (with Lynx Power In on both sides)
  • SmartSolar MPPT RS 450/200
  • Energy Meter ET112
  • Battery: FreedomWon LiTE 20/16
  • All devises interconnected via CAN

I use Home Assistant to monitor, report and run automations, based on a lot of data from Victron system. I use both Modbus and MQTT to poll data from the Cerbo GX over LAN.

Very close to all of the data points are available from Cerbo, with exception of 2 - Battery Energy (kWh Discharged and Charged). In the Modpus TCP Register from Victron, it states that these two data fields is "Not supported by CAN.Bus BMS Batteries" - see below extract from register:

modbus.png

Is there any way that anyone is aware, of how I can get close to real-time kWh in and out for batteries, using MQTT and/or Modbus? I see VRM is showing some basic Energy stats for battery, but would like to get this directly from Cerbo.

I have used MQTT Explorer and could not find such data for either the FreedomWon battery, or from the Lynx Shunt - I would have hoped that if the battery BMS does not supply this info over CAN, that at least the Lynx Shunt would do so, as this is directly measuring Power and Energy to and from battery.

Look forward to some suggestions, thank you

VE.Can
modbus.png (14.6 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kevgermany avatar image kevgermany ♦♦ commented ·

@DJMAXI

Moved to modifications space.

0 Likes 0 ·
3 Answers
ronski avatar image
ronski answered ·

I have that sussed, well it seems to work, had to calculate it myself. I've attached the flow, hopefully everything is there that you need.

1702143939368.png


1702144607033.png

Flow.zip


1702143939368.png (9.3 KiB)
1702144607033.png (68.0 KiB)
flow.zip (3.1 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bobbarker avatar image
bobbarker answered ·

Are your values accurate and match the ones you see in the VRM Portal?
I have the same value and try to calculate the kWh in /from the pylontech inside Home Assitant with the Riemann-Sum-Helper and a Utility-Meter. This works, but doesnt match the VRM Portal. Here are values from yesterday for example:

The Victrom VRM Portal :

Charge kWh: 6.0 kWh

Discharge kWh: 3.0 kWh


Riemann-Sum (Trapezoidale)

Charge kWh: 6.46 kWh

Discharge kWh: 10.96kWh (yes, ther is a heavy spike at the start)


Riemann-Sum (Left)

Charge kWh: 6.04 kWh

Discharge kWh: 3.74 kWh


Riemann-Sum (Right)

Charge kWh: 6.56 kWh

Discharge kWh: 4.94 kWh

The Trapeziodale works really good, as long as there are no spikes measured, which sadly happens all the time. So at the end, it isnt useable. The other two methods are always up to 10-20% off the values from the VRM.
As I dont have a shunt, I used the "system.battery.power" value (+/- Watt values of the pylontech) to calculate the Riemann-Sum.


So far, I havent found a good approach here...

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

ronski avatar image ronski commented ·

I haven't seen kWh charged/discharged for the batteries in the VRM portal, where are you looking?


I have To Grid, From Grid, Consumption and Solar. The to and from grid are about 5% over actual, I've compared this to my electricity meter. I have no way to know if the other two are accurate.

With regards to the the calculated to and from battery values, I haven't checked how accurate this is, although it appears fairly accurate. Not sure how I'd check to be honest, I thought the Lynx Shunt VE.Can showed the amount of kWh hours in and out, but mine doesn't when I access it via victronconnect/vrm/cerbo/shunt



0 Likes 0 ·
Show more comments
ronski avatar image
ronski answered ·

Found them now thanks.


Battery charged for today shows in the VRM as 23.2, now if I presume that is 5% out as its been charged from the grid, after we deduct 5% we get 22.04 kWh. My calculation in home assistant is reporting 21.45 kWh, so its close.


As for battery discharged, in the VRM it shows 8.9 from the battery, whilst HA is reporting 12.45 kWh, so a big difference there.

Both charged and discharged kWh are calculated the same way, so no idea why the big variance on discharged, although I'm inclined to believe my HA figures more over the VRM


1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

ronski avatar image ronski commented ·
Just to add some further info, between 16:00 and 16:30 today I force export at about 8kW, my export meter shows I exported 3.71kWh, yet the Victron VRM shows only 0.5 kWh form the battery, consumption is also 0.5 kWh, so only showing what the house consumed from the battery, hence why my HA battery discharged figure shows a different amount. If you select grid from the overview option, there is no value for from battery.
0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic