thomasw-1 avatar image
thomasw-1 suggested

Power Meter lib for Modbus-RTU-based meters from ABB, Carlo Gavazzi (Victron) and Eastron

Hi All,

I like to share a power meter library supporting following Modbus-RTU-based 3-phase power meters, which are connected by a ModbusTCP-server gateway:

  • ABB B23 (test on B23 212-100) and ABB B24 series
  • Carlo Gavazzi EM24 series (tests only for Victron related devices EM24DINAV53DISX and EM24DINAV93XISX)
  • SDM630-Modbus v2 and v1.
  • SDM72D-Modbus

Only ABB and Carlo Gavazzi meters support multi-phase aggregated power metering as expected in Germany!

For any usage a donation to with an amount of 5 USD/EUR/GBP or equivalent is expected.

Latest Changes:

  • 2022-03-13: Added SDM72D support / replaced Serial# on Eastron libs with Modbus-ID since serial is identical on all SDM630 meters ;-( > that change allows also the usage of several Eastron meters in the same installation


  • unzip TWE Meter Library into directory /opt/victronenergy/dbus-modbus-client.
  • Add in file /opt/victronenergy/dbus-modbus-client/ below the expression "import carlo_gavazzi " for that meter that you want to use the relevant bold marked expression
    • for ABB meters the expression: import TWE_ABB_B2x
    • for Gavazzi (Victron) meters the expression: import TWE_EM24RTU
    • for Eastron meters SDM630v2 the expression: import TWE_Eastron_SDM630v2
    • for Eastron meters SDM630v1 the expression: import TWE_Eastron_SDM630v1
    • for Eastron meters SDM72D the expression: import TWE_Eastron_SDM72D
  • OS versions >=2.80: For updates of this library delete all files with prefix "TWE_" in directory /opt/victronenergy/dbus-modbus-client/__pycache__
  • OS versions <2.80: For updates of this library delete all files with file extension ".pyc" and prefix "TWE_" in directory /opt/victronenergy/dbus-modbus-client/
  • reboot VenusOS
  • Go to "Settings" > "Modbus TCP devices" and perform a "Scan for Devices" or directly add a device via "Devices" > "Add" using relevant IP and ModBus ID and port. Last option is much quicker and also supports non-default unit-IDs.
    A few seconds later the meter should appear in your main menu.

Important Notes

  • The installation is not resistant for VenusOS updates. After any Venus OS update the adapter installation has to be repeated.
  • Only EM24 meters from Victron are supported. Tests on other OEM-meters have shown that they have obviously limited capabilities implemented.
  • ABB does obviously not properly support the "current" value on the B23 meter. Only positive values are shown, which are not necessarily compliant with the current power value.
    This constraint however has no impact on general functionality to control Victron solution and VRM measurements (except current values in extended graphs.
  • ABB meters a famous that Modbus-port A and B are used conversely. Consider that for your cabling.
  • For Eastron SDM630v1 devices a connectivity >9600 baud has to be configured on meter and gateway.

Exclusion of liability: Although the module has been tested in depth, I don't take any liability for any potential damage on your installation.

Thanks to Victron for their open platform and especially for the support of Matthijs Vader. Thanks to Michael for his extensive support to check the Victron meter support.

Energy Meterpower meterabb
2 |3000

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

mvader (Victron Energy) avatar image
mvader (Victron Energy) commented

holymoly Thomas, that looks like quite an effort that you did there!

2 |3000

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

jurekz avatar image
jurekz commented

After last bugfixing works perfectly with SDM630 Modbus V2 !!!

2 |3000

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

Hi Jurek,

After my direct support, have you honestly donated already?
The world will appreciate that to you.

Yes, You are right, world will be better with such action.
johnny-brusevold avatar image
johnny-brusevold commented

Hi @ThomasW.

Is it possible to get help reading Eastron SDM120M modbus energy meter.

Has connected sdm120m to a 485 to usr-tcp converter, and can read all the registers from linux command line with a small program written in C

This is a single-phase reader and I think part of the code in the python script can be removed, but since I'm lousy at python it's just experimentation and try to learn some new things.

This meter has a register for meter code, serial and bios as in those in SDM630, but in the manual meter ID is specified in register 464515 as

FC 02 Meter code = 00 20 Length: 2 bytes

Data Format: Hex

gives me at address FC02 the value u32b 2097668

Will this be the same as the other meters? , since I can not find the address and specification for sdm630 'type' address

This is adresses for the main readings

Reg_f32b 0x0000 Voltage V
Reg_f32b 0x0006 Current A
Reg_f32b 0x000c Power W
Reg_f32b 0x0046 Frequency Hz
Reg_f32b 0x0048 Forward kWh
Reg_f32b 0x004a Reverse kWh
2 |3000

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

Hi Johnny,

My experience shows that Eastron does not necessarily stick to the documented values. As you described according to the manual for that device the ID would be 0x0020 what mean 32 in decimal context. In case you have meters with the sames production series, the ID will be identical. With subreleases however the ID can change.

As I see, you extracted 4 instead of 2 bytes. 2 bytes result only in 16 bits.
The Eastron documentation clearly defines 2 bytes.

In case I didn't do any calculation mistake und your extraction was right, the ID value for your device should be 516.

How did I get this value?
Your decimal extraction 2097668 is a hex value of 0x00200204.
The last 2 bytes (green color) result in a decimal value of 516.

I am also not sure, if you extracted as big endian. In the hex-expression (red color) I can also discover the value, which is defined in the Eastron manual. Then the ID would be 32 in decimal.

Thumbs up appreciated and don't forget the donation!

Good Luck

Thank you for your answer @ThomasW.

Have read through what you write several times, but there is something I do not get here. From the linux program I get the same answer as from windows modbus poll. when I read from one of the programs I can from USR-TCP232-304 see in the log that I get sent data in return. I can not see that by communication from dbus-modbus-client. It sends 12 bytes but no response, so I think there is something wrong with the communication here, or something I do not get with me here.

It's the same if I try with 'serial number' or 'meter id' and switch

(0xfc00, models to (0xfc02, models

and['/Serial'] to['/HardwareVersion']


2022-02-05-1.png (189.6 KiB)
thomasw-1 avatar image thomasw-1 johnny-brusevold ·
Hi @Johnny Brusevold ,

In your case value 32 should work fine.

  1. Next step would be that all used registers answer proper values via Modbus poll.
  2. Check that in the lib the right format is used (16-32 bit, signed-unsigned, float)


thanks for your tests with sdm120. I would like to know if it's working fine for you now since i plan to buy a single phase power meter for victron and the sdm would be perfect (bacause it's very small and i don't have much space...).

If not, is there any other meter that works in this form factor with victron ess?



Yes, Eastron SDM-120M Modbus works with venus-os 2.82. Have not tested with newer version.

My SDM-120M config

thomasw-1 avatar image
thomasw-1 commented

Looks promising!
Please consider that the modul won't work, even if only a single register is not properly defined.
First indication about successfulr recognition you can retrieve from /var/log/dbus-modbus-client/current.

If the device as such is recognized, then begin to adapt every single register.

2 |3000

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

Hi @ThomasW.

Thanks for the input! it does not look like I'm cracking this nut. I think I'm starting to understand a bit of that, but .......

Now I have set up a slave simulator with FC00, modified so I only have one register. FC00 / Serial, but venus-os just sends the same query as with all the registers enabled in the py script

Really appreciate if you can help me further.

One thing I think about is RTU over TCP / IP, if there is anything there

Received from venus

Rx:000011-00 01 00 00 00 06 01 03 00 0B 00 01
Rx:000012-00 02 00 00 00 06 01 03 FC 02 00 01
Rx:000013-00 03 00 00 00 06 01 03 13 88 00 01
Rx:000014-00 04 00 00 00 06 01 03 16 20 00 01

Received and respons from other programs

Rx:000028-01 03 FC 00 00 02 F4 5B
Tx:000029-01 03 04 01 4D 31 1D BE 41

I'm giving this up here. Venus-os does not even try to read slave address 1

thomasw-1 avatar image thomasw-1 johnny-brusevold ·
@Johnny Brusevold ,

If a donation to a charity organisation in a range of 30Euro/USD would be worth for you, I would be willing to look into your issue, after you provided a proof for that donation and a VPN access to your Gateway and GX.
I would spend 4 hours in trying to get your issue fixed. A final success however cannot be promised.

Hi @ThomasW.

Now everything seems as expected, but do not know why I have to add one. (dot) to get the decimal values. Possible it is after updates of venus-os?

 Reg_f32b(0x0000 + s, '/Ac/L%d/Voltage' % n,        1., '%.1f V'),

Anyway, thanks for all the work in creating this library.

thomasw-1 avatar image thomasw-1 johnny-brusevold ·

Hi @Johnny Brusevold ,

Thanks for your feedback. I would wonder, if the "dot" was the issue.

  • Recently I adapted that lib for a SDM72 meter using the latest GX-OS. I think the issue would have shown up here as well. I would wonder that the dot was the actual solution.
  • I experienced that using "tab"-characters instead of whitespaces causes the pyhthon files not to work anymore with impacted instruction lines. If you have still a old version, check, if you had a tab-character in.


Have gone through the code and found three tabs that I removed without it making any difference, so (dots) must be allowed to be there :)

Used files from 'Eastron SDM meters'

So there was some difference in v1.3 so used it from this version and also no difference

Hi @ThomasW.

There are a number of things I wonder about choices during setup where I can select 'Grid Meter' 'PV Inverter' 'Generator' 'AC Load'

If I choose one of the first 3, I think it appears correctly, but only 'Wat' appears in the Remote Console tile.

If 'AC Load' is selected, nothing is displayed in the tile. Is there anything I need to add to the qml files to view this correctly?

Another thing is that if I choose a layout then the old one appears as 'Not connected' and the option 'press to remove'

When I press 'press to remove' the Remote Console freezes and has to run 'killall gui'

It's the same with stock venus-os and guimod

Here is the link to the working file for SDM120M


thomasw-1 avatar image thomasw-1 johnny-brusevold ·
Hi Johnny,

it is standard behavour, when you changed the type, that you have to remove the preovius setup in GX.
In terms of missing information I cannot advice you about potential issues, since I have that type not available for test purposes.
There could be potentially an issue that the single phase support is not properly recognized.

muffinoch avatar image
muffinoch commented

Hi guys,
my SDM630v2 will not work correctly.

I only sse the following values

1644573900765.pngHas anyone an idea how to fix this problem?

2 |3000

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

Hi @Muffinoch ,

This can have various reasons. Beginning from physical connection (termination), Gateway configurations and meter release changes. Therefore your question cannot be answered generically.

In your case I would connect modbus poll and see, if you get reliable results.
If any connectivity issue can be excluded, I assume an incompatibility of your used meter.

Hi @ThomasW.
thanks for your support.

I did a test over modbus poll.

I´m not an expert, but for me it looks fine.

I use the Eastron SDM630v2 so I think it should work.


1644668954532.png (22.0 KiB)

Have you configured the meter as "3p4w", "3p3w" or differently?
Could you please export holding register "a" (hex) "10" (dec)?

Hi @ThomasW.

I configured the Enerymeter as 3p4w.

Here is holding register 10


Here my FC00


Thx for your help

1647102464844.png (3.6 KiB)
1647106748734.png (31.5 KiB)

Hi @Muffinoch ,

It seems that you have not configured format "float 32 - big endian" in your export, right?
In that case every second entry would show a hyphen sign.


The FC00 register is ok.

In addition I would recommend to check your stop bit config between meter and ModbusTCP-gateway. Typically standard config is 0 (One stop bit and no parity).

1647112557242.png (9.3 KiB)
sgrigor1 avatar image
sgrigor1 commented

Hi, Can someone share the holding register for Eastron SDM630v2 ? Starting from FC00.

I'm wondering if I can configure the modbus simulator with those values to be recognized by RaspPi Venus OS as SmartMeter. I installed the profile for Eastron SDM630v2 in VenusOS.


2 |3000

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

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.