Idea

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!

Update:

GX OS version 2.92 uses new libraries, which aren't compatible with previous ones anymore.
Victron embedded ABB meters as default in current GX (even if serial connection is supported right now).

Eastron meters are not really prefessional in terms of version maintenance. In addition they are not suited to cover phase-netting as required for German market.
Therefore I have to balance, if I will apply an additional update on those meters


For any usage a donation to seashepherd.org 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


Installation

  • unzip TWE Meter Library v1.4.zip into directory /opt/victronenergy/dbus-modbus-client.
  • Add in file /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py 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
16 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.

nemon21 avatar image nemon21 commented ·

Hello @ThomasW.

with a small modification I was able to use an local connected SDM72D-Modbus meter (with a USB-RS485 interface).

TWE_Eastron_SDM72D.py

change

probe.add_handler(probe.ModelRegister(0xfc02, models,
                                      methods=['tcp'],
                                      units=[1]))

to

probe.add_handler(probe.ModelRegister(0xfc02, models,
                                      methods=['rtu', 'tcp'],
                                      units=[1]))

Reboot Venus OS. Result:

bildschirmfoto-2022-10-02-um-195419.png

bildschirmfoto-2022-10-02-um-195425.png

bildschirmfoto-2022-10-02-um-195436.png


0 Likes 0 ·
thomasw-1 avatar image thomasw-1 nemon21 commented ·
Hi @nemon21 ,

Recently I performed some tests with an analog configuration.
At that moment however I reallized that not both protocols were supported.
In my constellation I haven't got the TCP connected meter running.
Since you were successful, I should perhaps spend some more time on that ;-)


0 Likes 0 ·
markus1301 avatar image markus1301 nemon21 commented ·

Hi, this is very interesting!!!


I have am SDM630 Modbus V2 with a RS 485 to USB cable and it does not work.

I tried with methods=['rtu', 'tcp'],

in TWE_Eastron_SDM630v2.py, but my SDM620 Modbus V2 is not found. Should it be found by itself, or do I have to search in Modbus TCP?

I have read, that some rs485 to usb converters are crap. Which one do you use for this?


Greetings,

Markus


0 Likes 0 ·
rtrooster avatar image rtrooster markus1301 commented ·

Markus,


I had the same issues as you are having, but found the solution.
The setup as as show above is depending on a gateway setup, the TWE_Eastron_SDM630v2.py has default only the TCP option, with the RTU option you are telling him to search also on the USB to RS485 device.
But adding only the extra "rtu" is not enough.

Please change it to:

probe.add_handler(probe.ModelRegister(0xfc02, models,

methods=['rtu', 'tcp'],

rates=[38400],

units=[10]))

Where rates is the baudrate set on the SDM and units is the unit id set on the SDM.
This makes it working for me.

The only disadvantage for now (so far as I can see) due to the hard setting you can only manage one SDM device. I don't have two SDM devices for testing other options.

0 Likes 0 ·
zolimar avatar image zolimar rtrooster commented ·

Hello,


since 2 weeks I am struggling with a SDM630v2 to make it work on a Cerbo GX with latest release candidate fw but it seems that I do not succeed.

The firmware on the SDM should be the stock one. See attached picture.

IMG_3702 (1).jpeg

The RS485 to USB converter is OK because on the same converter a Carlo Gawazzi meter works just fine at a glance.

I made the modifications indicated in the WE_Eastron_SDM630v2.py file:

methods=['rtu', 'tcp'],

rates=[19200],

I also set the UNIT ID which for me is set to address 1, I checked the communications parameters directly set in the meter: 19200,8N1, with address 1.

I am able to read the meter just fine using Modbus Poll with the same parameter, see attached files. The HW ID is 112, so should be fine, I checked also the logs for DBUS-CGWACS.TTYUSB0 and TTYUSB1 but there is no error, but no discovery of meters whats's so ever. With Carlo Gawazzi I see in the dbus-cgwacs.ttyUSB1.log immidiatly the ID of the meter discovered. See attached the registers.

IMG_3723 (1).jpeg

IMG_3724 (1).jpeg

What am I doing wrong?

Thanks for help, good work by the way with integrating these meters.

Thanks again for the work.

0 Likes 0 ·
img-3702-1.jpeg (502.6 KiB)
img-3723-1.jpeg (579.4 KiB)
img-3724-1.jpeg (534.6 KiB)
Show more comments
Christian Butterweck avatar image Christian Butterweck commented ·

@thomasw-1

If I see the problem correctly, the sum of the register forward and reverse differs minimally compared to the register net 0x018C (which consists of reverse minus forward) with this Eastron meter SDM72D V2.

Unfortunately the VRM portal only accepts the data as valid and displays statistics if these sums match 100% and if you are delivering a matching /Ac/Energy/Net too. So you either have to calculate /Ac/Energy/Net yourself in the driver or you have to use the meters net-register for everything as I'm currently doing it here:
https://community.victronenergy.com/idea-comment/197899/view.html

0 Likes 0 ·
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 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.

thomasw-1 avatar image thomasw-1 commented ·

Hi Jurek,

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


0 Likes 0 ·
jurekz avatar image jurekz thomasw-1 commented ·
Yes, You are right, world will be better with such action.
0 Likes 0 ·
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
6 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.

thomasw-1 avatar image thomasw-1 commented ·

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
Thomas

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold thomasw-1 commented ·

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

self.info['/Serial'] to self.info['/HardwareVersion']

2022-02-05-1.png

0 Likes 0 ·
2022-02-05-1.png (189.6 KiB)
thomasw-1 avatar image thomasw-1 johnny-brusevold commented ·
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)


0 Likes 0 ·
moefreak avatar image moefreak commented ·
Hi,


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?


Best

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold moefreak commented ·

@Moefreak

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

My SDM-120M config

0 Likes 0 ·
marommel avatar image marommel johnny-brusevold commented ·

Hi, to get it run on firmware 2.92 had to modify the last part of that file. Might be unneccessary, but well, it works ;-)

probe.add_handler(probe.ModelRegister(Reg_u16(0xfc02), models,
                                      methods=['rtu', 'tcp'],
                                      rates=[9600],
                                      units=[1]

Then everything runs smooth. Thanks a lot!

0 Likes 0 ·
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.

8 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.

johnny-brusevold avatar image johnny-brusevold commented ·

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
0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold johnny-brusevold commented ·

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

0 Likes 0 ·
thomasw-1 avatar image thomasw-1 johnny-brusevold commented ·
@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.

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold thomasw-1 commented ·

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.

0 Likes 0 ·
thomasw-1 avatar image thomasw-1 johnny-brusevold commented ·

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.


0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold thomasw-1 commented ·

@ThomasW.

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 v1.2.zip'

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

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold thomasw-1 commented ·

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

SDM120M

0 Likes 0 ·
thomasw-1 avatar image thomasw-1 johnny-brusevold commented ·
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.


0 Likes 0 ·
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?

5 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.

thomasw-1 avatar image thomasw-1 commented ·
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.

0 Likes 0 ·
muffinoch avatar image muffinoch thomasw-1 commented ·

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


0 Likes 0 ·
1644668954532.png (22.0 KiB)
thomasw-1 avatar image thomasw-1 muffinoch commented ·

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



0 Likes 0 ·
muffinoch avatar image muffinoch thomasw-1 commented ·

Hi @ThomasW.

I configured the Enerymeter as 3p4w.


Here is holding register 10

1647106748734.png


Here my FC00


1647102464844.png


Thx for your help

0 Likes 0 ·
1647102464844.png (3.6 KiB)
1647106748734.png (31.5 KiB)
thomasw-1 avatar image thomasw-1 muffinoch commented ·

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.

1647112557242.png

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).

0 Likes 0 ·
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.

Thanks

2 |3000

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

maspe avatar image
maspe commented

Hi everybody,
my SDM630v2 is not recognized by CerboGX.
With ModbusPoll I can get some values from input registers:modbuspoll-inputregister.pngAnd also some from holding registers:modbuspoll-holding0000.pngBut NOT from FC00 or FC02:
modbuspoll-holding-fc00.pngGuess this is the reason CerboGX is not showing / finding the meter?
Does anybody has any hint what I can do here? Would like to avoid buying a new meter as it is working fine (reading via Modbus from ESP8266 with EspEasy since many months).
Hope someone can help me.
Thanks,

5 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.

thomasw-1 avatar image thomasw-1 commented ·
Hi @maspe, could it be that your SDM630 is not a v2, but a v1 device?

Please check register holding register 1c and export the value as unassigned.


0 Likes 0 ·
maspe avatar image maspe thomasw-1 commented ·

Hi @thomasw-1, thanks for your reply.
SDM label shows definitvely v2 (maybe fake :-) )
sdm630.png1c holding:
holding-1c.pngWill try now Cerbo with version1
Thanks, Martin

0 Likes 0 ·
sdm630.png (226.2 KiB)
holding-1c.png (8.0 KiB)
thomasw-1 avatar image thomasw-1 maspe commented ·

You have not the ordinary Eastron meter, but the "BG e-Tech" one.

Relevant modbus-manual does not mention any holding register for that device. Maybe you contact the supplier and try to clarify, where to extract the device type.

I would not exclude that it got another firmware applied.


0 Likes 0 ·
maspe avatar image maspe thomasw-1 commented ·

Got a very general answer from GB e-tech:
"during production process it is always possible that firmware is changing, new features are only available on new devices, firmware update is not possible"
So I am lost, my meter is too old :-(
Maybe a stupid question, I'm not a software/Python specialist:
Wouldn't it be possible to change the python script to not ask register FC02 but write directly 112 hard coded in it? Shouln't it be possible that VenusOS is then getting the other (power, current,..) values from meter?

Otherwise I must purchase another meter.

Thanks, Martin

0 Likes 0 ·
Alexander Seufert avatar image Alexander Seufert maspe commented ·
Hello Martin, I buy also a SDM630-V2 from Amazon which got delivered today and have got the same problem.. there seem to be a lot of devices out there, with an old fimware....
0 Likes 0 ·
alexander-christian avatar image
alexander-christian commented

According to the source code, FC02 should contain the HardwareVersion.... No idea why your's is showing 0.

My citron setup is not yet available (not yet ordered), but I have same meter (SDM630v2). Will check if mine is giving me all required information in all used registers.

2 |3000

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

gesiima avatar image
gesiima commented

Hello, great work!
I am using a Janitza UMG604
Modbus table for download https://www.janitza.de/betriebsanleitungen.html?file=files/download/manuals/current/UMG604-PRO/janitza-mal-umg604pro-en.pdf
It will be nice if some one can tell me how to begin try to connect this to Venus OS.
I have already connect it to iobroker. To readout the data it was necessary to add 1 to value from that list to get the messured value. Is this normal for modbus?
I am just a user with only that bit of experance in modbus or programming but I am able to understand wat I can see in other profiles.
I tryed out to import and enable all that new profiles and make a autoscan, but as expected, nothing is working.

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.

thomasw-1 avatar image thomasw-1 commented ·

Hi gesiima,

in order to implement it into VenusOS you have to write a library that supports that device.
What I can see from its manual, it should be possible, however it the devopment is more than difficult without having the device.

0 Likes 0 ·
skyme avatar image skyme commented ·

Hi gesiima & all others with a Janitza UMG 604,


I have a Janitza UMG 604 , too. Yesterday I took the time and made it working:

janitza-venus.jpg

The currents are a bit odd - it's the apparent current L1..L3 and the vector sum of it. But I think the currents are not needed anyways, so I won't spend time searching better registers for them in the Janitza. I changed energy numbers to two decimal digits and left the power as whole numbers - better to read for me.

I attach the file for anyone who is interested. Just follow the instructions from Thomas, just add the line

import JanitzaUmg604

in the file dbus-modbus-client.py . Check the unit number of your Janitza, either with the gridvis software or via the builtin web page, newer versions list the unit number there. My File searches for unit number 1 and 5, but I had better results when I manually added the modbus device.

JanitzaUmg604.zip

Cheers everybody,

Manfred



0 Likes 0 ·
janitza-venus.jpg (67.0 KiB)
janitzaumg604.zip (1.0 KiB)
alexander-christian avatar image
alexander-christian commented

Just installed VenusOS on an old Pi and tried to setup a connecting to my working SDM630 ModBus v2 with help of an rs485 ethernet gateway (PE11).

I have another software that is able to read data from the meter. But VenusOS with this lib does not do anything. At least it seems so...

/var/log/dbus-modbus-client/current just shows nothing special. If I do the search, I get:

@4000000062a2120c257370c4 INFO     Starting background scan
@4000000062a2120c273d24a4 INFO     Scanning 192.168.200.113/24
@4000000062a2127d310391bc INFO     Scan complete

But that's it. Even if I configure an modbus tcp device by hand (correct IP and port used), the logs shows nothing, and VenusOS also shows nothing. No device, no measurement, nothing. Just like ti's not configured/setup at all.


My Ethernet-RS485 gateway just tells me, that there is an open connection, but it seems that no data is transferred.

How can I further debug this?


[update]

Checked: FC02 contains "112"


[update2]

My Protos PE11 RS485->Ethernet converter has a setting for serial communication protocol. My existing application (java based, self developed) works only, if I select "none". To my understanding, "Mosbus Poll" works similar to Venus OS MOdbus TCP... And to get "Modbus Poll" to work, I need to switch from "none" to "modbus". But all in all, I have no idea what the difference is. The serial communicationelectrically RS485, and the protocol that is used to send and read data is Modbus.
So I don't see a reason why I can select the protocol on RS485->Ethernet converter. In any case, the application processing the data needs to use the correct protocol. Okay, anyhow.. If I select "modbus", the Modbus POll application seems to work and I can read data.

But in both cases, VenusOS does not do anything. Right now, I'm completely lost :-(

[update3]

Ok, getting used to it ... read some date via modpoll

0xfc02 --> 112 (matching v2 model)
0xfc03 --> 0
0x000a --> 3 (3 phase)
0x0014 --> 1 (modbus id)

tested also the single input registers for each phase:

Seems to work for all ... getting a lot of data that updates rapidly. I can read V, A, W, and both kWh (forward/reverse). Also W, A, Hz and the other two kWh can be read...

So, all registers are readable and give me plausible values.

Why is VenusOS not doing anything? Maybe I need to use wireshark to spy my own network to see whats happening.

5 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.

thomasw-1 avatar image thomasw-1 commented ·
Hi @alexander-christian, in case register FC02 does only show 0 for your device, then the device simply cannot be discovered. Before you spend any additional time with VenusOS, I recommend to check your connectivity with a Modbus-tool first by testing other common registers of the SDM.

I assume that your rs485-gateway does potentially not work as expected. Any SDM630 meter, which I tested so far, delivered also a model type on that register.


0 Likes 0 ·
alexander-christian avatar image alexander-christian thomasw-1 commented ·

> in case register FC02 does only show 0 for your device, then the device simply cannot be discovered

That's simply not the case. Check my update above. All registers, except FC03 (whoch gives me 0) deliver proper values.

The SDM630 is working with this gateway fine for over 18months now.

For further testing, I added a modbus proxy (https://pypi.org/project/modbus-proxy/) between the client and the gateway to see what's happening.

What I can see: VenusOS is repeatingly opening connections .. So some communication is not working. Agt the same time (the proxy is able to handle multiple modbus connections at a time), Modbus Poll is working fine.

0 Likes 0 ·
alexander-christian avatar image alexander-christian thomasw-1 commented ·

Tried line by line to add log comments and enable/disable ...


If I do this:

    def __init__(self, *args):
        super(Eastron_SDM630v2, self).__init__(*args)
        log.info('SDM630v2 info regs START')
        self.info_regs = [
            Reg_u16(0xfc02, '/HardwareVersion'),
            Reg_u16(0xfc03, '/FirmwareVersion'),
#            Reg_f32b(0x000a, '/PhaseConfig', text=phase_configs, write=(0, 3)),
            Reg_u32b(0x0014, '/Serial'),
         ] 
        log.info('SDM630v2 info regs END')        

I added log-output to the init method at start, and at end...

If I follow the log files, I only see the "END" log output, If I disable the line with reading the phase-config.

No idea why. 0x000a is readable and contains value "3" ...
I also tried to dig into "Regf_f32b" ... But I'm not that familiar with python, so I have no idea where to look into. I also grepped the other files for this function name, but nothing...

So I guess it's something with this line or the register... Any hints on that?


[update]

If I simply disable the above mentioned line and further con the code do this to hard-code the value to 3:

##        phases = nr_phases[int(self.info['/PhaseConfig'])]
        phases = 3

it almost works... I can see a new device in the UI, and for a short time see also the product ID and firmweare version (0xB023), but a second later it's again gone. "unconnected" and "unknown". A few seconds later it starts from the beginning.

Something is still wrong.


[update]


I think I found the issue for the not working Reg_f32b ... in register.py are classes exactly for this things. And there is no Reg_f32b ... Only Reg_f32l ... Think I need to update VenusOS or so ...

Will report back any findings...

0 Likes 0 ·
alexander-christian avatar image alexander-christian thomasw-1 commented ·

I updated now to 2.66 on my RaspberryPi.
What am I doing wrong if there is no "Reg_f32b" in register.py, which will then of course fail to execute all float-32bit-bigendian modbus reads...


Need to check how to switch to 2.87 ... because there is no image for this.


[update]

Updated to 2.87 ... and the damn class is still missing. wtf?
Is this not working on a Raspberry Pi?


[update2]
I don't get it... even the latest register.py from github https://github.com/victronenergy/dbus-modbus-client/blob/master/register.py does not contain "Reg_f32b" ... ?!

0 Likes 0 ·
thomasw-1 avatar image thomasw-1 alexander-christian commented ·

Hi Alex,
Do you have also the "BG eTech" verison as "maspe" (see above comments) in use?
Would explain your restriction.

0 Likes 0 ·
alexander-christian avatar image
alexander-christian commented

OK, starting a new "answer thread" as my last was to messy :-)

I had problems getting SDM630v2 to work with multiple version of VenusOS on my older Raspberry Pi 2.
I debugged a lot and finally think I found the reason:

TWE_Eastron_SDM630v2.py makes use of a class called "Reg_f32b", used to read 32bit float values in BigEndian order. Interestingly, the class was not present/implemented in registry.py ...
Also github with it's latest source (https://github.com/victronenergy/dbus-modbus-client/blob/master/register.py) does not contain anything like this. It only contains "Reg_f32l", the little-endian version.

I added this

# added by Alexander Christian        
class Reg_f32b(Reg_num):
    def __init__(self, base, *args, **kwargs):
        super(Reg_f32b, self).__init__(base, 2, *args, **kwargs)
        self.coding = ('>f', '>2H')
        self.scale = float(self.scale)        

just below the Reg_f32l definition in registrer.py, cleared all .pyc files in cache and rebooted. And .... tada ... My meter works as expected.

Why the hell is this class/definition missing? Am I the only one? Has this been tested before? Has anyone any clue on this?

P.S. I filed a PullRequest on GitHub: https://github.com/victronenergy/dbus-modbus-client/pull/1

3 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.

thomasw-1 avatar image thomasw-1 commented ·

"Reg_f32b" is defined in "TWE_Eastron_device.py", which is imported by "TWE_Eastron_SDM630v2.py", since this method is not available in standard libs. In addition this method is only used to read production parameters, but not those for model identification.

I think you are looking currently into a wrong direction. I strongly assume a support issue of your meter (see my comment before).

In case you are willing to donate 20EUR to charitable organisation, I would be willing to log onto your system trying to locate the route cause after my return on 24.06.

0 Likes 0 ·
alexander-christian avatar image alexander-christian thomasw-1 commented ·

Hi Thomas,

as a software engineer, I want 1st to investigate myself.

I check TWE_Eastron_device.py... It does not contain a String like "f32b". So I don't see how this is defined in there?!
If I remove my Reg_f32b implementation from register.py, Reg_f32b must come from somewhere else...

Assuming that your TWE_Eastron_device.py that you're refering to is not the one that comes in your twe-meter-library-v14.zip, the missing class Reg_f32b must be added.

To get this to work, I added the class and needed to extend one import. Here's the diff:

15c15
< from register import Reg
---
> from register import Reg, Reg_num
19a20,25
> class Reg_f32b(Reg_num):
>     def __init__(self, base, *args, **kwargs):
>         super(Reg_f32b, self).__init__(base, 2, *args, **kwargs)
>         self.coding = ('>f', '>2H')
>         self.scale = float(self.scale)  
> 
438c444
< ]
\ Kein Zeilenumbruch am Dateiende.
---
> ]

I'll attach both files (zipped). The one that comes with the ZIP, and the one that I modified:
TWE_Eastron_device-Diff.zip

I changed nothing else (I of course reverted the changes in register.py).

There's no need to remotely visit my system. Just continue the discussion and explain where else the Reg_f32b should be where I don't find it :-)

And yes, saving the ocean is important. Check my donation ...1655028917891.png
Best regards,
Alex


P.S. maybe it would be a good idea to host the source on a github/gitlab project? And I'm sure there are ways to solve the "all ins gone in case of venusos update". See: https://www.victronenergy.com/live/ccgx:root_access#hooks_to_install_run_own_code_at_boot

0 Likes 0 ·
alexander-christian avatar image alexander-christian alexander-christian commented ·

Oh, grepped a bit more... Reg_f32b class is not in TWE_Eastron_devide.py, but in TWE_Eastron_SDM630v2.py ... But somehow it is not recognized?! Without my modification, script will crash/stop/not work as soon as "Reg_f32b" used/accessed (without any further exception or so).


That is really strange. How can the implementation in TWE_Eastron_SDM630v2.py not see/work with the implementation of Ref_f32b class?! Very confusing.
And even more confusing: My added code in TWE_Eastron_devide.py matches the Reg_f32b in TWE_Eastron_SDM630v2.py ... but mine is working?!

0 Likes 0 ·
gllowa avatar image
gllowa commented

Hi
I bought an SDM72D-Mv2
I connected through the rs485 converter to my raspberry. I executed the script "TWE Meter Library v1.4.zip" as in the manual. It scans and doesn't find my device. Please help



2 |3000

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

gllowa avatar image
gllowa commented
Hi
I bought an SDM72D-Mv2
I connected through the rs485 converter to my raspberry. I executed the script "TWE Meter Library v1.4.zip" as in the manual. It scans and doesn't find my device. Please help
 
              
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.

rohlande avatar image rohlande commented ·
Dem schließe ich mich an.. Habe versucht den SDM72 anzubinden aber dieser wird nicht gefunden. Dazu muss ich aber auch sagen, dass ich eine alte FW auf dem Multiplus verwende und diese leider nicht geupdatet werden kann. Es handelt sich dabei um die Version: v2.60. Der SDM72 läuft an einem PE11 RS485 to ETH Interface. Im IOBroker habe ich damit keine Probleme und kann die gewünschten Register abfragen. Es kommt zwar ab und an zu einem Timeout aber den kann ich ignorieren. Können Sie mir evtl. sagen ob und wie ich auf dem Victron Debugger kann? Kann es sein, das evtl. verschiedene Python Versionen auf dem Victron OS ein Problem sind? Vielen Dank vorab! VG Denny @thomasw1: Übrigens ist die Empfehlung für diese Modul durch Michael entstanden. Ich denke Sie wissen wen ich meine.
0 Likes 0 ·
Juha Tuomala avatar image
Juha Tuomala commented

Can't find ABB B23 212-100, but there is a 212-200 version and URL https://new.abb.com/products/2CMA100804R1000/b23-212-100 that redirects 212-200.

2 |3000

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

matthiasdirlinger avatar image
matthiasdirlinger commented

Is there a way to implement ET340 via Modbus Gateway?

Tryed to modify EM24 code but cannot get it working

2 |3000

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

steigman230 avatar image
steigman230 commented

Guten Abend zusammen,

ich würde gerne ein Eastron_SDM630v2 mit Hilfe eines Victron Energy RS485 zu USB Adapters am GX auslesen. Konfigdateien sind soweit alle eingespielt, jedoch stellt sich mir die Frage, wie die Verkabelung (Ausgang zur Kabelfarbe) vom SDM630 an den Victron Energy RS485 zu USB Adapters zu sein hat. Danke für die Hilfe und Grüße, Patrick

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.

Alexander Seufert avatar image Alexander Seufert commented ·

Hallo, wenn du das Original Victron Kabel hast, gilt die folgende Farbzuordnung an den Klememn des SD630-Modbus-V2

SDM630 B- : gelb

SDM630 A+ : orange

SDM630 G: schwarz

nachdem du das Kabel angeschlossen hast, kannst du die USB-Stecker Seite in den PC stecken und mit dem folgenden Windows Programm die korrekte Verbindung testen: https://xn--stromzhler-v5a.eu/media/archive/5c/e4/0b/EEM_MeterSet.zip

Das Ergebnis sollte dann so aussehen:

1665606792791.png


0 Likes 0 ·
1665606792791.png (59.2 KiB)
markus1301 avatar image
markus1301 commented

Hello everyone,

I am an absolute Viktron beginner. My starting point is: A RaspberryPI with Venus OS Version 2.91 and an Eastron SDM 630 Modbus V2. There is also an RS485 to USB cable from Amazon with the CT2102 chipset.


The Multiplus II has arrived in the meantime. I haven't connected it yet because I'm not sure if that's possible without a battery - which is still on the way. I've read on some "China Inverters" that they can be damaged without a battery so I'm unsure/cautious.


I want to describe my wrong turns here, so that a beginner - like me - finds it a little easier and doesn't make all the same mistakes. I would be happy about any answer to my questions / help.


One reads here very often about the Vikron meter EM24, which is quite expensive. I now know from a friend that the cheaper ET340 can also be used. At least on his Cerbo GX.


You can connect these counters via RS485 to USB.


My first mistake: I thought this would describe how to use the cheaper Eastron via RS485 to USB cable. So I bought Eastron SDM 630 Modbus V2.


It was not clear to me that instead of the RS485 to USB cable I would need an RS 485 to LAN adapter, which is even more expensive than the Viktron cable.


VenusOS didn't find the electricity meter in my setup, so I ordered the original Viktron cable, with the 5m cable.


In the meantime I installed the Modbus Poll program on a PC and was able to retrieve data from the Eastron via the Amazon cable.


However, the correct USB driver had to be installed on the PC first. So I came to the conclusion that maybe the chipset plays a role.


Now the original Viktron cable had come and I thought the Eastron would be recognized out of the box. Especially since nemon21 wrote above that he could with the change …


probe.add_handler(probe.ModelRegister(0xfc02, models, methods=['rtu', 'tcp'], units=[1]))


... by adding 'rtu', cause its - attention, different model - Eastron SDM72D to be found.


That wasn't the case for me! No energy meter found!


My next mistake: I was always in the menu Settings => Modbus TCP Devices. What I completely overlooked: Under Services there is Modbus TCP. This was initially disabled.

I enabled it and also MQTT on LAN (SSL) and MQTT on LAN (plain text).


However, I don't know exactly what MQTT is or does, and whether this setting makes sense.


Same result. No counter.


Then I found the project https://github.com/3cky/mbusd on GitHub:

"mbusd is open-source Modbus TCP to Modbus RTU (RS-232/485) gateway."


The next problem: This is source code and there isn't even git on VenusOS. So I pulled that under Rasbian, compiled it and then transferred the binary to VenusOS. Now I can do it with...

./mbus.git/build/mbusd -L/tmp/mbusd.log -p /dev/ttyUSB0 -s 9600 -A 192.168.1.40 -P 503 -d -v9


Attention: Normally it seems to be port 502. But the program says that it is already occupied. So I use Port 503


192.168.1.40 is the IP of my Raspi.


Now I have entered devices under Modbus TCP: 192.168.1.40 port 503 and unit 1.


Eureka, my Eastron is found and displays the voltages.


I don't have any consumers yet, that's still a flying construction.


But: Shortly thereafter, the connection to the Eastron is gone again.


Then it is there again for a very short time, then gone again for a long time.


In Modbus Tcp devices, it indicates that it was found at 192.168.1.40 and not under Modbus RTU ttyusb1:1 as with nemon21


Then I tried: The addition of Alexaner Christian in register.py

# added by Alexander Christian

class Reg_f32b(Reg_num): def __init__(self, base, *args, **kwargs): super(Reg_f32b, self).__init__(base, 2, *args, **kwargs) self.coding = ('>f', '>2H') self.scale = float(self.scale)


But here too: After a short time it says Eastron SDM630-Modbus v2 Not connected.


In the log of mbus, if I somehow look for errors, I find:

...

12 Oct 2022 13:45:45 tty: read 1 bytes 12 Oct 2022 13:45:45 tty: read 150 bytes of 157, offset 0 12 Oct 2022 13:45:45 conn_loop(): select(): max_sd = 4, t_out = 000000:426271  12 Oct 2022 13:45:45 conn_loop(): select() returns 0  12 Oct 2022 13:45:45 tty: response read (total 150 bytes, offset 0 bytes) 12 Oct 2022 13:45:45 tty: response is incorrect: [01][04][98][43][6f][8a][8f][43][6f][91][04][43][6f][94][7f][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][e0][fa][02][06][04][e8][02][06][04][e8][02][03][04][04][08][08][10][10][20][20][40][40][80][80][00][00][43][6f][90][07][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][3f][80][00][00][00][00][00][00][00][00][00][00][00][00][00][00][42][48][13][64][00][00][00][00][00][00][00][00][1a][08] 12 Oct 2022 13:45:45 tty: attempt to retry request (3 of 3) 12 Oct 2022 13:45:45 tty: state now is TTY_RQST 12 Oct 2022 13:45:45 tty: written 8 bytes 12 Oct 2022 13:45:45 tty: request written (total 8 bytes) 12 Oct 2022 13:45:45 tty: state now is TTY_RESP 12 Oct 2022 13:45:45 tty: estimated 157 bytes, waiting 671874 usec 12 Oct 2022 13:45:45 conn_loop(): select(): max_sd = 4, t_out = 000000:671874  12 Oct 2022 13:45:46 conn_loop(): select() returns 0 

...


That means nothing to me. What should I do? Buy the ET340 and hope that it will be recognized out of the box and is stable (!), or does anyone have any other ideas?


Greetings,

Markus

2 |3000

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

wawibu avatar image
wawibu commented

I plan to use Victron Devices and was therefore testing if my existing SDM630v2 and my SMA WR will work. Therefore I installed the latest VenusOS Image on a Pi3 and added this extension. And it work great for me at 99%.

VenusOS is showing me the total and phase related information for Grid, Load and PV

venusos-sdm630.png

On VRM Online I'm missing the total for Grid. In the tabular view of my installations, I can see the total values for Solar, Load and Grid. But when I go into the installation, I see on AC Input only the individual values of each phase but not the total AC Input. The graph on AC Input is working and shows the total on hovering.

vrm-online-sdm630.png


Does anybody knows why the AC Input card isn't showing the total value and always a dash instead?

Thanks,

Torsten

2 |3000

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

johan-pol avatar image
johan-pol commented

We are looking for an energy meter for use in a 3-phase Ess system with CerboGX

The mains grid connection is 3x80amp.
can we use the ABB B24 (2CMA100180R1000)
with 3x ABB CT PRO XT 80 SE (2CSG225875R1101)
Of are there better solutions for this system?

6 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.

rgerber avatar image rgerber commented ·

Hi Johan-pol. These meters are compatible with Venus OS and is already being used on numerous sites in South Africa

PartNumber Description Product Range
2CMA100155R1000 B21 312-100 65A Direct Connected Meter, 2 output, 2 input, RS-485
2CMA100169R1000 B23 312-100 65A Direct Connected Meter, 2 output, 2 input, RS-485
2CMA100183R1000 B24 352-100 CT Connected Meter, 2 output, 2 input, RS-485
1 Like 1 ·
juergenal avatar image juergenal rgerber commented ·

Would the B23 312-100 also works with the cerbo gx?

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ juergenal commented ·

hi all, after releasing Venus OS v2.92 last week, which adds support for certain ABB meters, we've now also updated the documentation to specify exactly which meters are compatible.


See selection guide PDF on this page:

https://www.victronenergy.com/accessories/energy-meter

0 Likes 0 ·
juergenal avatar image juergenal mvader (Victron Energy) ♦♦ commented ·

@mvader (Victron Energy) Last week I made a Test. In my Victron System I have an EM24 for the Grid and on AC Out 1 I have also an EM24 for my Enphase Energy Solar Power and since Friday an ABB B23 312-100 for my Heating Unit. The Grid Meter is installed on Cerbo GX USB 1 and the Enphase Meter is installed at USB 2. Then I made a connection from the EM24 Enphase to the ABB Meter. Than I reboot the Cerbo GX. Sometimes the Cerbo found the Em24 and on the next reboot it found the ABB but not both thogheter. Why not? The RS485 Bus adresses on EM24 is 1 and the ABB is 2. Do you have an explanation for it?

0 Likes 0 ·
herculess avatar image herculess mvader (Victron Energy) ♦♦ commented ·
@mvader (Victron Energy): is it also possible to add the ABB B23 via modbus-tcp? multimaster via modbus is not possible, so my modbus devices are only accessible via modbus-tcp from different locations, to use the data on multiple monitoring tools. otherwise i need a mbusd on the cerbo, which than acts as modbus-tcp server
0 Likes 0 ·
herculess avatar image herculess herculess commented ·

To answer myself, on the victron github is an abb.py script, which works as tcp modbus-client as well and has to be replaced with the original abb.py (rs485 only): https://github.com/victronenergy/dbus-modbus-client

actually this has to be done also on venusos v2.93 - i hope, the tcp option finds the way in the next release

0 Likes 0 ·
sega avatar image
sega commented

It is possible to connect a Waveshare Industrial serial server, RS485 to RJ45 Ethernet Modbus TCP an read the settings from the SDM630 v2 or SDM72DM V2 and connect it to the VENUS OS?

6 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.

sega avatar image sega commented ·
you have any victory with that?
0 Likes 0 ·
tomcat avatar image tomcat sega commented ·

I'm using this one: https://www.amazon.de/gp/product/B09QMNWYLQ/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1
With this Settings:

modbus-ip-gateway.jpg


to connect an SDM630V2 Modbus to HomeAssistant and Cerbo GX over IP.


vos.jpg

On Home Assistant its working for longer time but it looks like its working for Cerbo too. But the complete system is not live jet im still in building stage.

-1 Like -1 ·
vos.jpg (33.7 KiB)
sega avatar image sega tomcat commented ·

when i scan the holding register 4x with Modbus Poll (FC02) i get the 137 value... which means the SMD72 is a SDM72DMv2 like in the Python file...

137: {

'model': 'SDM72DMv2',

'handler': Eastron_SDM72Dv2,

0 Likes 0 ·
sega avatar image sega tomcat commented ·

@tomcat Great to see... thats my setting - i think i have the Problem on the Venus OS side because Communictaion is possible with the EMM Tool over the Waveshare.


1. installed new VenusOS 2.92

2. put the file into the directory with WINSCP

3. change the *-client.py file with the addon Import TWE...

4. cleard the cache files in _pycache_

5. reboot VenusOS

6. EM24 is showing up but no SDM72


did i missed something?


whatsapp-image-2022-10-28-at-73740-pm.jpeg

screenshot-2022-10-28-at-182647.pngscreenshot-2022-10-28-at-182725.pngscreenshot-2022-10-28-at-183516.pngscreenshot-2022-10-28-at-183540.pngscreenshot-2022-10-28-at-183638.png

-1 Like -1 ·
sega avatar image sega sega commented ·

when i scan the holding register 4x with Modbus Poll (FC02) i get the 137 value... which means the SMD72 is a SDM72DMv2 like in the Python file...

137: {

'model': 'SDM72DMv2',

'handler': Eastron_SDM72Dv2,

0 Likes 0 ·
sega avatar image sega sega commented ·
@ThomasW. kannst du mir vielleicht mit meinem SDM72 helfen... irgendwie komm ich nicht weiter... Grüße - Danke!
0 Likes 0 ·
x90cr avatar image
x90cr commented

I have the SDM72Dv2 and it shows up in my device list, but it shows as not connected.
Every 30 seconds a connection will be established briefly.
Does anyone have a solution, I've tried everything from the comments?

For your information, I also use an EM24 Ethernet as a grid meter and would like the Eastron as a PV meter.

5 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.

sega avatar image sega commented ·
I'm also trying that... any solution?
0 Likes 0 ·
x90cr avatar image x90cr sega commented ·

Nein, keinen Erfolg. Ich habe mir jetzt unfreiwillig einen ET340 bestellt damit ich meine Anlage fertig umbauen kann. Ich brauch den nur als PV Zähler, da tut der es auch, wobei mir der Spaß eigentlich zu teuer für diese Funktion ist.

0 Likes 0 ·
sega avatar image sega x90cr commented ·

@x90cr läuft bei mir seit gestern... war eigentlich dann ziemlich easy!

screenshot-2022-11-01-at-095346.png

0 Likes 0 ·
x90cr avatar image x90cr sega commented ·
Und wo lag das Problem?

Ist dein EM24 per LAN oder RS485 angebunden?

Wenn alles über RS485 läuft scheint es seltener Probleme zu geben.
0 Likes 0 ·
sega avatar image sega x90cr commented ·

@x90cr both with Modbus TCP

1 Like 1 ·
thomasw-1 avatar image
thomasw-1 commented

GX OS version 2.92 uses new libraries, which aren't compatible with previous ones anymore.
Victron embedded ABB meters as default in current GX (even if serial connection is supported right now).

Eastron meters are not really prefessional in terms of version maintenance. In addition they are not suited to cover phase-netting as required for German market.
Therefore I have to balance, if I will apply an additional update on those meters.

4 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.

telekatz avatar image telekatz commented ·

The difference in V2.92 from the previous version is how the probe.ModelRegister function is called. You need to specify the size of the first parameter to make it work again.

E.g. for SDM630:

probe.add_handler(probe.ModelRegister(Reg_u16(0xfc02), models,
1 Like 1 ·
sega avatar image sega telekatz commented ·

@ThomasW. and @Telekatz yes... that's the way to go... setup was easy after the (Reg_u16(0xfc02) edit and the baudrate on the SDM72 should also be 19200, not working on 9600...

0 Likes 0 ·
x90cr avatar image x90cr sega commented ·
Hat bei mir beides auch nicht geholfen.

Mit Reg_u16 war dann auch keine Verbindung zum EM24 Ethernet mehr möglich.
Ich nutze übrigens VenusOS 2.80-21-large-23


0 Likes 0 ·
lennycb avatar image lennycb commented ·

@ThomasW. First of all, great job you did there.


I've plowed through the entire post.

My SDM630 also works, but I have a few questions:


Topic 1:

What do you mean by "phase netting"? Phase balancing count" perhaps?


Topic 2:

In my opinion something doesn't fit with the "flow direction" (display).


Initial situation:

SDM630 as PV meter

Connection: PV inverter --> terminal above SDM630 --> SDM630 terminal below --> to the house network

Configured in Venus as an inverter counter at AC OUT.


Result:

Display result positive (in my opinion correct for PV)

Flow direction (blue line) to WR (correct)

Value is added to "AC loads" (incorrect)


should be deducted, right?


PV inverter values are negative on the balance sheet and must be deducted correctly, but are always displayed as "positive" in Venus and everything else I call it.


How do you see that?

0 Likes 0 ·
buddhafragt avatar image
buddhafragt commented

Hello is the EASTON SDM230 also compatible?

Only 1 phase, but the protocol seems the same as SDM630

2 |3000

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

sega avatar image
sega commented

@ThomasW. @x90cr @marommel @Telekatz

quick test with my 2 Eastron on an Waveshare Adapter... working fine!


screenshot-2022-11-02-at-215208.pngscreenshot-2022-11-02-at-215156.png

screenshot-2022-11-02-at-215221.pngwhatsapp-image-2022-11-02-at-95141-pm.jpeg

7 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.

marommel avatar image marommel commented ·
there're two differences to my setup. I use an rs485 to usb adapter and firmware 2.92

I'll take a try on an firmware update tomorrow


0 Likes 0 ·
sega avatar image sega marommel commented ·

@marommel firmware 2.92 is also fine... do you have a SDM72 or SMD630 on USB RS485? SDM72 is showing up also the SDM630 with a USBtoRS485 adapter... both on one USBtoRS485 still testing...

whatsapp-image-2022-11-02-at-103319-pm.jpeg

0 Likes 0 ·
marommel avatar image marommel sega commented ·
one sdm72 on rs485 to usb adapter. did everything as described in my first posting.


maybe something wrong with the adapter as the green leds are not flashing? that's the case with the second usb to rs485 Adapter used with the em24


0 Likes 0 ·
sega avatar image sega marommel commented ·

@marommel post your files... is think you made something wrong ;-) with my USBtoRs485 is everthing fine... only one SDM is only showing up...

check your usbtors485 - connect with SSH as root... type:

ls -l /dev/serial/by-id

you can also add your usb when it is not in the list for auto dedection...

nano /etc/udev/rules.d/serial-starter.rules

0 Likes 0 ·
wawibu avatar image wawibu commented ·

@Sega are you able to see the total grid value within the VRM Portal? I'm able to manage to get the SDM630v2 working and showing the values in Venus OS - but not in the VRM Portal (see my post above). Do you have maybe an idea?

0 Likes 0 ·
sega avatar image sega wawibu commented ·

@WaWiBu do you have a Multiplus running in your setup or just a PV Inverter(1xSDM630), Venus OS and the Grid Meter(1xSDM630)? Because in the VRM you see the AC Input only wenn you Have the Blue Big Device up and running ;-)

Two examples.... it is normal when you have not set up a ESS System or so...

screenshot-2022-11-09-at-205520.png
screenshot-2022-11-09-at-205536.png

1 Like 1 ·
wawibu avatar image wawibu sega commented ·
THANKS!

the big blue thing is not yet installed. So I assume once that is installed the AC IN Total will be shown :)

0 Likes 0 ·
marommel avatar image
marommel commented

@Sega in the shell:

root@einstein:~# ls -l /dev/serial/by-id
lrwxrwxrwx    1 root     root            13 Nov  3 10:19 usb-FTDI_FT232R_USB_UAR                                  T_AB0NGGKD-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx    1 root     root            13 Nov  3 10:19 usb-FTDI_FT232R_USB_UAR                                  T_AB0OELVD-if00-port0 -> ../../ttyUSB0

That looks promising for me.

those are the three files i uploaded:
files.zip

in "__pycache__" I deleted the corresponding three files and restarted.

Thanks a lot for your help!

7 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.

sega avatar image sega commented ·

@marommel the following line is wrong on you files... your wrote "(Reg_u16(0xfc02))" <--- wrong

changed it... but your files in my test rigg - restart everthing okay with only one USBtoRS485... you use a EM24 + SDM72 on one USBtoRS485 or just 1 SDM72 on your setup?

probe.add_handler(probe.ModelRegister(Reg_u16(0xfc02), models,
                                      methods=['rtu', 'tcp'],
                                      rates=[19200],
                                      units=[1]))
0 Likes 0 ·
marommel avatar image marommel sega commented ·

wow man tahnk! just a typo... thats annoying. tanks for your help!

I'm using an EM24 as grid meter conectet via USBtoRS485 and an second USBtoRS485 with a SDM72 just for logging my heatpump. I know it should be possible to run serval rs485 divices on one usb adapter, but after reading people had troubles I just bougt a second adapter. Dispite my typo that was a good idea ;-)


0 Likes 0 ·
sega avatar image sega marommel commented ·

yeah... with 2 USBtoRS485 it is possible... :) or 1 Waveshare to ModbusTCP

0 Likes 0 ·
marommel avatar image marommel sega commented ·

I did some testing:

(1) The sdm72 also functions with 9600 baud.

(2) connecting the sdm72 and an sdm120 on the same bus but with different id (101 for the sdm72 and 1 for the sdm120) doesn't work out using the rs485toUSB adapter

(3) if I cut power to one of the two, the other one gets connected

edit: (4) it random wich meter gets connected if both are on the rs485 bus at the same time

It's really a pity that it's not working out...

0 Likes 0 ·
sega avatar image sega marommel commented ·

@marommel Same problem on the rs485 no 2 devices possible had also the same problem with 2xem24

0 Likes 0 ·
marommel avatar image marommel sega commented ·
@Sega : I'm considering the wafeshare solution. is that wafeshare device using a separate IP for each connected meter?
0 Likes 0 ·
sega avatar image sega marommel commented ·
@marommel on the waveshare you can use 2 sdm72 with 1 IP address but different unit Id but with baud 19200 works only for me
0 Likes 0 ·
marommel avatar image
marommel commented

@Sega : I still don't get why the direct RS485 is not working with two meters, cause victron is documenting a soulution for two em24 at one rs485toUSB adapter.

I reconfirgured my meters to id1 and id2 an checked the console:

1667994807772.png

the one with ID2 (sdm72) uses connection ttyUSB1:2
the one with ID1 (sdm120) uses connection ttyUSB1:1

That would fit the victron documentation. But doesn't help eather.

Is there any other difference by using der waveshare gateway then the connection type? are the by waveshare connected meters listed in the "energymeters" tab?

As it should be possible to connect 2 devices to one rs485toUSB adapter and it's not working with this lib other than by modbusTCP, I consider some "bug" in the lib. But I don't have a clue where to search.

Another approach to the whole "problem" would be: https://community.victronenergy.com/questions/111121/emulating-em24-ethernet-meter-via-modbustcp-server.html


2 |3000

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

charliebarracuda avatar image
charliebarracuda commented

I want to connect a SDM630 as a PVinverter meter via USB-RS485 adapter. The adapter and meter are working. The EEM meter setting program gives back the correct voltage with baudrate 19200 / data bits 8 / parity none/ stop bit 1 , modbus ID 1.

The adapter shows also up as .../ttyUSB0 when queried ls -l /dev/serial/by-id.

But the SDM doesn't show up in the device list. I copied and modified all files as described above.

probe.add_handler(probe.ModelRegister(0xfc02, models,

methods=['rtu', 'tcp'], rates=[19200], units=[1]))

I guess the parity and stop bit infomation is still missing. How do I need to modify the file? What does "units" stand for?

I run the firmware 2.75. So no need for the "Reg_u16" modification. When i try it it also doesn't work and my em24 which i use as grid meter doesn't show up anymore.

2 |3000

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

pantau avatar image
pantau commented

I had also no success to connect 2 devices to one RTU interface. Looks like scanning stops after the first device is found.

If you change /opt/victronenergy/dbus-modbusclient/scan.py in class SerialScanner:

def __init__(..., full=False): => full=True

it works for me. Don't forget to delete scan*.pyc in __pycache__ so the updated file is taken.


2 |3000

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

charliebarracuda avatar image
charliebarracuda commented

Thanks for the reply.

Scan.py seems to look through all modbus adresses from 1..247, not called adress but unit. Nothing idicates stopping after the first. Don't know what mode means? 8n1?

Maybe it's not possible to use multiple meters. In device.py there are several if/elif loops. I have only rudimentary phyton knowledge but if the if condition is satisfied (tcp device connected) then the elif commands (connecting ModbusSerial devices) is not executed? Which would mean as soon one tcp device is connected no serial connection is possible anymore. Is there a possibiliy to debug the boot process to see which funtion doens't work? Unfortunately the full=True didn't change anything. Still no serial connected SDM630 found.

2 |3000

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

charliebarracuda avatar image
charliebarracuda commented

All input registers in TWE_Eastron_SDM630v2 give back the correct values with a modbus simulator. Both with a USB adapter and also TCP (over a waveshare converter). But still no meter in the VenusOS.

Holding register

0xfc00: 342

0xfc02: 112

0xfc03: 0 , maybe that's the problem?

The import takes place, as soon i delete some lines in the py file the log file shows ImportErrors.

I connected a elgris smartmeter where i can choose from different address tables. Choosing SDM630 nothing happens, no device found. Choosing EM24 it is regognized right away.

Any ideas?


2 |3000

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

pv-riese avatar image
pv-riese commented

I have 3 SDM630. But had seen that only 2 Modbus Devices are "supported" on one RS485 USB Adapter.


However, If I connect 2 SDM630 on Version 2.90 Venus OS with ID1 and ID2, I see only one.

When I connect 2 SDM630 on Version 2.92 Venus OS, with ID1 and ID2 and the change to "REG_u16, I see both. But in the same moment the VE.BUS with the MultiPlus2 get lost...


Some one the same Issues?

Thanks

2 |3000

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

buddhafragt avatar image
buddhafragt commented

I have installed a SDM72D-Modbus,

in the menu I can see the device (Klimaanlage):

bildschirmfoto-2022-12-18-um-172735.png

but not in the pages or in the Victron portal:

bildschirmfoto-2022-12-18-um-172930.png

Can someone tell me, what is wron here? Some special setup?

Thanks!!



2 |3000

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

wolferl avatar image
wolferl commented

Good Morning

Is there any knowledge, if the SDM630-Modbus v3 is also supported?

thank you

wolferl

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.

Björn Kellermann avatar image Björn Kellermann commented ·

Hello,

I do not know if the sdm630-Modbus v3 is supported, but it supports phase net metering as required by German law.

Modbus parameters in Home Assistant are:

  • address: 396
  • data_type: float32
  • precision: 3
  • slave: 1
  • slave_count: 2
  • unit_of_measruement: kWh

BR, Björn


0 Likes 0 ·
lwde avatar image
lwde commented

Just take a look at https://github.com/stormmurdoc/victron_sdm630_bridge - works way better.

2 |3000

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

Christian Butterweck avatar image
Christian Butterweck commented

I fixed a bug with the Victron VRM portal (finally VRM Grid statistics too).
It was showing no or wrong grid & battery data with the Eastron SDM72DM-V2 .
https://github.com/christian1980nrw/VenusOS-SDM72D-M-V2-Eastron-Modbus-driver/blob/main/TWE_Eastron_SDM72D.py

Regards

Christian

1680876769002.png

2 |3000

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

qasi29 avatar image
qasi29 commented

Hi, with information from this Thread, i was able to write a Driver for Janitza UMG 96 RM-E
https://github.com/patrick-dmxc/VenusOS-Janitza-UMG-96-RM

2 |3000

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

marommel avatar image
marommel commented

Hi,

I'd been using that lib with venus OS 2.92, but recently changed to 3.11 Maybe not an good idea. After reinstalling the lib, it's not working anymore. Does someone got any experience with the lib and the newest venus OS?

Thanks a lot,

Markus

7 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.

marommel avatar image marommel commented ·

i got it working by using these files: https://github.com/christian1980nrw/VenusOS-SDM72D-M-V2-Eastron-Modbus-driver

1 Like 1 ·
bobbyx avatar image bobbyx marommel commented ·
did someone tried this driver also with OS 3.12?
0 Likes 0 ·
sega avatar image sega bobbyx commented ·
@marommel @BobbyX do you have the SDM72D running on VenusOS 3.12?
0 Likes 0 ·
marommel avatar image marommel sega commented ·
Hi @Sega I didn't do any further update yet.
0 Likes 0 ·
sega avatar image sega marommel commented ·
it's working for me - see the last post!
0 Likes 0 ·
marek-gawlik avatar image marek-gawlik commented ·

Hello, Markus

I have got this same after update to 3.10 Venus OS. So I create new version of TWE_Eastron_device.py. TWE_Eastron_device.txt

1 Like 1 ·
sega avatar image sega marek-gawlik commented ·

@Marek Gawlik do you have the SDM72D running on VenusOS 3.12?

0 Likes 0 ·
chicogonzales avatar image
chicogonzales commented

Hi guys,

I just upgraded from v2.94 to v3.12 and afterwards the connection to my SDM630v3 with Modbus TCP through a Protoss PE11-H wasn't working any longer.
I tried to adopt the changes made in TWE_Eastron_device.py for SDM72D but unfortunately I did not get it working. The Multi connected to the PE11-H somehow but opened more than one connection at a time which was not normal behaviour. Also no registers were read and written to dbus.

The only solution so far for me was to boot into the previous version v2.94. After doing that it immediately worked again!

Did somebody get it working with Venus OS v3.1x and an Eastron SDM630v2/v3?


3 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.

telekatz avatar image telekatz commented ·

With the attached files my SDM630v2 is working again under Venus OS V3.12.

SDM630v2.zip

1 Like 1 ·
sdm630v2.zip (1.7 KiB)
woz001 avatar image woz001 telekatz commented ·

I am currently switching over from a Gr*watt 1x3kW + MasterP*wer 1x5kW system to a "clean" Multiplus II 3x48/5000 + MPPT 450/200 + Cerbo GX system (I took this 2for3 deal). I am currently testing all required changes/addons with a RPi before transferring to the Cerbo.

I have a SDM630 MODBUS V3 (Gr*watt version) already installed and wanted to re-use it. I had my own readout solution in Python using an RPi, so I am familar with this type.

I tried the original TWE lib above and it was not working - neither with 2.9.1 nor 3.1.3 OS. Thus, I was just about to start my own implentation from scratch when I saw the different code in this tiny reply... Much more Pythonic coding - well done! ;-)

I can confirm it works "out of the box" with a waveshare industrial USB/RS485 connected to the SDM630 MODBUS V3 and v3.13 OS on a Raspberry 2 Zero. Will do more testing now and comparison with my other readout setup, but up to now it looks fine. So I will soon transfer to the Cerbo. Thanks for this version!

0 Likes 0 ·
autoschrauberix avatar image autoschrauberix commented ·

I can confirm SMD630v2.zip is working. @Telekatz Thank you, I tried to fix it too, but can't

0 Likes 0 ·
chicogonzales avatar image
chicogonzales commented

@Telekatz thanks a lot. I can also confirm that your implementation is working very well.

Unfortunately my custom dbus service that reads registers of my Huawei SUN2000 inverter also stopped working when switching to v3.12. So I had to switch back again to v2.94 until I will have that one fixed, too.

3 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.

sega avatar image sega commented ·

@chicogonzales what i need for my sdm72 do work again under 3.12 - can someone post all files?

0 Likes 0 ·
chicogonzales avatar image chicogonzales sega commented ·
See earlier post of @Christian Butterweck from April 7th. He provided a fix for SDM72D.
0 Likes 0 ·
chicogonzales avatar image chicogonzales sega commented ·
@Sega please scroll up some posts. @Christian Butterweck linked a github repository with a fix for SDM72D on April 7th!

I personally have an Eastron SDM630v3 and got it working with the fix provided by @Telekatz.
In the meantime I also got my Huawei service working under v3.12 so that everything is working fine for me again!


0 Likes 0 ·
sega avatar image
sega commented

Update - Venus OS 3.12 is working with SDM72 and SDM630

Eastron.zip

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.

robertik avatar image robertik commented ·

Update - Venus OS 3.13 is now working with SDM120M - on my case USB to RS485 adapter, I have also updated option to position it as pvinverter

SDM120M.zip

0 Likes 0 ·
sdm120m.zip (2.2 KiB)
sevensworld avatar image sevensworld commented ·
Can you pls explain how to get it working with this files?

After crashing my old SD card with v3.10, i actually tried 3.13 and 3.20 , but no way to get the SDM72M-V2 working again -.-

0 Likes 0 ·
mchlrv avatar image
mchlrv commented

I'm trying to get met SDM72D-M working on my Cerbo GX running firmware 3.13. I configured the SDM72D-M to a baud rate of 19200 and copied the files from @Christian Butterweck to below path.

/opt/victronenergy/dbus-modbus-client/

Add line 26 of the file "/opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py" I added "import TWE_Eastron_SDM72", clear the "__pycache__" directory and rebooted the Cerbo.


The SDM72D-M is connected to a WaveShare USB to RS485 module (B- to B-, A+ to A+ and G to G). The Cerbo recognizes the WaveShare, see below output.

ls -l /dev/serial/by-id
lrwxrwxrwx    1 root     root            13 Dec 30 09:58 usb-FTDI_FT232R_USB_UART_A10LSLVF-if00-port0 -> ../../ttyUSB0

After the the reboot I go to "Modbus TC/UDP devices" and run a scan. The logs show the scan starting and completing in 11 seconds. However no devices are discovered. Also at the "Energy meters" menu nothing pops up.

I'm a bit confused what I'm missing, any suggestions?


[edit]

After fiddling around for two days I finally got it working using the files from @Sega. Using modbus poll I read function 03 at address 64514 which returned 137 in my case. This corresponds to the model 137 in the code. I only removed the model 135 (lines 76-79) from the code as these were not present.

[/edit]

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.

sega avatar image sega commented ·

yes... this was also my problem... is thought i let both version in the code... you use it with a usb adapter... i'm using the waveshare to modbus tcp adapter!

0 Likes 0 ·
woz001 avatar image
woz001 commented

Inspired by the nice and compact code published by @Telekatz (thanks again!) - and the following updates for other meters, I created a consolidated version for Eastron SDM72/120/630 with minimum code and files needed. Those meters are very similar (I also checked again the original protocol specs from Eastron) and don't require separate files. This way maintenance should be greatly reduced.

I also left the original import of the carlo_gavazzi module in while testing, so one might even try to use that in parallel as well (I don't have one of those for testing). I packed it in a venus-data.tgz for USB auto-install from a blank OS setup found in this ZIP: Eastron_Consolidated_Venus_v3.1.x.zip

There might be still some issue with an USB adapter setup. In my case some default GPS service is immediately running when plugging in the adapter (I can immediately see some activity on the LEDs), so I had to stop it first to do a re-detect of the meter via ssh. I don't know how to disable GPS via the touchscreen by default - GPS also does not really make sense for my home installation (somehow waste of CPU resources...). Maybe someone has an idea, then the USB installation probably would not require initial fixing via root/ssh access.

Some details in the README.TXT in the zip. Developed on a RPi 2 Z, then finally tested on an untampered Cerbo GX with OS v3.1.3, Waveshare Industrial USB/RS485 Converter, SDM630 MODBUS V3 (19200 Baud, ID 1). Hope it helps.

4 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.

bobbyx avatar image bobbyx commented ·

perfect, works with waveshare modbus tcp adapter and SDM72

0 Likes 0 ·
cipis avatar image cipis commented ·

Ok with modifications https://community.victronenergy.com/idea/114716/power-meter-lib-for-modbus-rtu-based-meters-from-a.html?childToView=255221#reply-255221

0 Likes 0 ·
maikelk avatar image maikelk commented ·
Quick question, it doesnt seem that it installes you files, should i extract the zip in the root of the usb stick or should i create a folder called data?


Or is it possible to copy your files over and add the import eastron section in the file?

After upgrading to 3.13 it cant find my SDM630 anymore and based on above replys etc it should work. I cant get it to work with any of the files above mentioned by you and others. It was working flawlessly in 2.94 but because im now finally ready to start up the system i wanted to bring everything too the latest software versions(i did read it would work in 3.13 after the upgrade but was hoping with all your and others work who are reporting it can work i took the plunge and upgraded)

0 Likes 0 ·
maikelk avatar image maikelk maikelk commented ·
My fault!! Had to manually add it because it seems to expect port 502 when automatic scanning it but i was usig 8899 on my system(cant remember why actually but its used for my SolarEdge too as grid meter...)


Well at least i installed a fresh 3.13 large image to the Pi and your script!

0 Likes 0 ·
cipis avatar image
cipis commented

SDM630-2T V2:

39424: {

'model': 'SDM630-2T',

'handler': Eastron_Meter_3P,

},



SDM630MCT-2T protocol v1.2_21_11_08_CX_0100.pdf

8 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.

cipis avatar image cipis commented ·
When switch to 38400 bps ( from 19200) and unit 11 (from 1), ID is changed to 12288 ... Strange, but functional. Maybe problem HEX vs. uint16?

Everytime I change SDM parameters, I must run CASModbusScanner for reading from FC02.

0 Likes 0 ·
woz001 avatar image woz001 commented ·

Thanks, updated the installer.

eastron-consolidated-venus-v31x_v1.1.zip

0 Likes 0 ·
schraubaer avatar image schraubaer woz001 commented ·

Hi woz001, 1st thank you (and also the others) a lot for your code and your effort! with this help i (as a beginner) could get an EASTRON SDM630 V3 2023 working on Venus OS 3.30/3.31, and it seems to work stable, great!

Playing around with it i found out, that if i unplug the RS485 converter and plug it in again (the same for opening and connecting again one of the RS 485 wires) there is different behaviour after doing this:

in case A the LEDs of the Adaptor (original Victron) are blinking with perid ~1s and everything is fine. In case B the LEDs are permanently blinking the SDM630 still shows the phone symbol, but the Cerbo does not recognize the meter here.

The funny thing is, that this happens alternatingly (nearly perfect), case A -> case B -> case A -> case B ... when recursively opening and reconnecting the RS485.

Is there anybody with the same effect or has an idea what the cause (and a fix) could be? i also installed a "serial battery" and a "shelly plug" on the same cerbo, so if i am the only one with this effect maybe there could be side effects from these. Some more investigation on the effect as follows:


I found out that when i am in case B i can resolve the situation with following sequence:

/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB0

/opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py -s ttyUSB0

/opt/victronenergy/serial-starter/start-tty.sh ttyUSB0


And same behaviour in blank VENUS OS 3.14 with nothing other installed than this code


Alternatingly plugging the USB2RS485 adapter into a Cerbo and a raspi (both OS 3.31) makes AABBAABB... which i would interpret that the issue is not on the adapter or eastron side but on the GX side.


doing:

/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB0

/opt/victronenergy/serial-starter/start-tty.sh ttyUSB0

/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB0

/opt/victronenergy/serial-starter/start-tty.sh ttyUSB0 ...

also leads to ABABAB...


(!) using TWE Meter Library v1.4.zip on a venus OS 2.94 does NOT show this behaviour, interruption of USB or RS485 ALWAYS leads to the good case A. So the issue comes either from OS <=2.94 vs. >2.94 or from the according implementation of the driver. I could not get the v1.4 working with OS > 2.94


using the original code from Telekatz on venus OS 3.31 has the same "ABABA" issue.


hopefully this helps to delimit the issue a bit and with some help form experts like @Telekatz and @woz001 it might be possible to fix that? :) Please let me know if more investigation is needed i will try to collect it then!


Thanks a lot for a feedback!

0 Likes 0 ·
schraubaer avatar image schraubaer schraubaer commented ·

would these log entries help ?

tail -F -n 100 /data/log/dbus-modbus-client.ttyUSB0/current | tai64nlocal


2024-04-26 10:52:18.094382500 *** CCGX booted (0) ***
2024-04-26 10:52:34.636268500 /opt/victronenergy/serial-starter/run-service.sh: line 5: shift: 2: shift count out of range
2024-04-26 10:52:46.998776500 INFO Waiting for localsettings
2024-04-26 10:52:48.540889500 INFO [rtu:ttyUSB0:9600:2] Found SDM630Modbusv2
2024-04-26 10:52:49.200414500 INFO registered ourselves on D-Bus as com.victronenergy.grid.cg_10737xxxx4

→ „A“


2024-04-27 07:32:32.358297500 INFO [rtu:ttyUSB0:9600:2] Device failed: Could not configure port: (5, 'Input/output error')
2024-04-27 07:32:32.373295500 /opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (1871) - No such process

→ „B“


2024-04-27 07:34:40.791428500 /opt/victronenergy/serial-starter/run-service.sh: line 5: shift: 2: shift count out of range
2024-04-27 07:34:42.543340500 INFO Waiting for localsettings
2024-04-27 07:34:43.846419500 INFO [rtu:ttyUSB0:9600:2] Found SDM630Modbusv2
2024-04-27 07:34:44.093739500 INFO registered ourselves on D-Bus as com.victronenergy.grid.cg_10737xxxx4

→ „A“


2024-04-27 07:38:01.280998500 INFO [rtu:ttyUSB0:9600:2] Device failed: Could not configure port: (5, 'Input/output error')
2024-04-27 07:38:01.298919500 /opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (11677) - No such process

→ „B“


2024-04-27 07:39:57.070639500 /opt/victronenergy/serial-starter/run-service.sh: line 5: shift: 2: shift count out of range
2024-04-27 07:39:58.860461500 INFO Waiting for localsettings
2024-04-27 07:40:00.163789500 INFO [rtu:ttyUSB0:9600:2] Found SDM630Modbusv2
2024-04-27 07:40:00.444169500 INFO registered ourselves on D-Bus as com.victronenergy.grid.cg_10737xxxx4

→ „A“

0 Likes 0 ·
telekatz avatar image telekatz schraubaer commented ·

Have you checked if there is another process allocating the serial port?


Example for ttySC0 to get process ID and process:

root@raspberrypi2:~# ls -l /proc/[0-9]*/fd/* |grep /dev/ttySC0
ls: /proc/6392/fd/255: No such file or directory
ls: /proc/6392/fd/3: No such file or directory
lrwx------    1 root     root            64 May  6 20:56 /proc/1638/fd/5 -> /dev/ttySC0

root@raspberrypi2:~# ps |grep 1638
 1638 root     34804 S    {dbus-modbus-cli} /usr/bin/python3 -u /opt/victronen
 6414 root      2688 S    grep 1638
root@raspberrypi2:~#
0 Likes 0 ·
schraubaer avatar image schraubaer telekatz commented ·

Hi @Telekatz, thanks you for your reply, here the results:

good case (A):

root@einstein:~# ls -l /proc/[0-9]*/fd/* |grep /dev/ttyUSB0
ls: /proc/2713/fd/255: No such file or directory
ls: /proc/2713/fd/3: No such file or directory
lrwx------    1 root     root            64 May  7 17:02 /proc/2535/fd/5 -> /dev/ttyUSB0
root@einstein:~# ps |grep 2535
 2535 root     34804 S    {dbus-modbus-cli} /usr/bin/python3 -u /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py -x -s ttyUSB0
 2812 root      2688 S    grep 2535

bad case (B):

root@einstein:~# ls -l /proc/[0-9]*/fd/* |grep /dev/ttyUSB0
ls: /proc/3516/fd/255: No such file or directory
ls: /proc/3516/fd/3: No such file or directory

good case again:

root@einstein:~# ls -l /proc/[0-9]*/fd/* |grep /dev/ttyUSB0
ls: /proc/4492/fd/255: No such file or directory
ls: /proc/4492/fd/3: No such file or directory
lrwx------    1 root     root            64 May  7 17:08 /proc/4421/fd/5 -> /dev/ttyUSB0
root@einstein:~# ps |grep 4421
 4421 root     34804 S    {dbus-modbus-cli} /usr/bin/python3 -u /opt/victronenergy/dbus-modbus-client/dbus-modbus-client.py -x -s ttyUSB0
 4537 root      2688 S    grep 4421

so no other concurring process on the same port?

As the eastron meter even in the bad case indicates communication (phone symbol) and the USB2RS485 Adapter is blinking at high frequency: could it be that something goes wrong when stopping the process at the first signal interruption, healing anyhow when interrupting the signal again?

0 Likes 0 ·
telekatz avatar image telekatz schraubaer commented ·

My guess is that the serial port is incorrectly occupied by the “serial battery” script when the SDM630 is not recognized. It may work if you change the SDM630 baud rate to 38400, as none of the supported "serial battery" devices use this rate.

0 Likes 0 ·
schraubaer avatar image schraubaer telekatz commented ·

that's it, with both 19200 or 38400 baud on the SDM630 the issue is gone, no chance to reproduce it anymore, thank you!!

Nevertheless there is potential of future side effects, so i summarize my findings in case someone wants to go deeper into detail:

-> As i reproduced it with a brand new OS image on a Raspi with nothing more extra installed than the eastron driver i would think the cause would be something else than the serialBattery.

-> As i tried OS 2.94 without the issue even at 9600 baud but OS 3.14 with the issue at 9600 baud, i would assume it might be some victron supported driver that came in with 2.94 < OS <= 3.14 and is probing at 9600 baud (but not higher), wich is systematically corrupting the eastron driver.

0 Likes 0 ·
maikelk avatar image
maikelk commented

I now have the SDM630 working with the software from @woz001 . I Upgraded from 3.13 to 3.14 and copied over the files and added in the dbus file import eastron.

I change the SDM120 baudrate to 9600 to try and get the SDM120 into Victron as PV meter.

The unit isnt discovered unfortunatly, comms are working i tested it with a script running on my RPi.

In the GX i added the addresses:

192.168.1.108 with port 8899, this is the grid meter SDM630 address 1 running on Baud 19200.

192.168.1.131 with port 8899, this is the PV meter SDM120 address 1 running on Baud 9600.

Am i doing something wrong? Do i still need to change the address on the SDM120? Because this is written in the bottom of eastron.py : units=[1, 2]))

6 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.

woz001 avatar image woz001 commented ·

Did it work in 3.13 with the same eastron files and thos stopped working in 3.14? or is it in general not working for the sdm120?

I only have one grid meter on rs485, but I'd say (or guess w/o having a detailed investigation) that the distinguishing and thus relevant property is the modbus address, not the IP address...

As a quick check: I'd propose to just connect only the sdm120 - if it is detected in principle (without the sdm630 connected and thrown out from the device list).

Just to exclude other issues, e.g. if your meter uses a different model number (to that one found in the device list of eastron.py), it would be also not detected.

Hope it helps...

0 Likes 0 ·
maikelk avatar image maikelk woz001 commented ·

It also didnt work in 3.13, but i was trying it with baudrate 2400(which i also added on eastron.py as baudrate)

If i clear the device list and only enter the ip of the SDM120 it also doesnt appear.

How can i get the model number? Maybe thats the problem.

0 Likes 0 ·
cipis avatar image cipis maikelk commented ·

Maybe check this: "Everytime I change SDM parameters, I must run CASModbusScanner for reading from FC02."

My SDM630 actualy have model number 12394.
Read registr FC02 (64515 DEC) and add to model. I use CASModbusScanner for Windows. I have waveshare tcp/rs485 Converter.

0 Likes 0 ·
cipis avatar image cipis maikelk commented ·

12394:modelno.jpg

0 Likes 0 ·
modelno.jpg (54.5 KiB)
woz001 avatar image woz001 maikelk commented ·

I have no equipment nearby to check if the code is fully correct, but some quick idea might be to add an info line while probing (see end of "probe.py"):

1706898860200.png

then run dbus-modbus-client.py in the command line to see the output.

Afterwards you can remove the line again.

But you should also compare the register description in general with the other supported ones to be sure it is compatible - just in case...

0 Likes 0 ·
1706898860200.png (179.0 KiB)
woz001 avatar image woz001 maikelk commented ·

I just bought a few days ago an Eastron "SDM120M" (the label is printed directly on the side of the case) on Amazon (ASIN: B08X8SD1FD, advertised as "SDM120-MODBUS-MID"), as I require it for measuring the input/output power of a small 800VA Hoymiles micro inverter. This is more reliable and cheaper than buying and hacking the Hoymiles wireless adapter, although I don't get detailled PV data that way.

I just unpacked and connected it, works out of the box (mine was pre-set at 9600 baud, ID 1 from the seller). I am using the Cerbo GX with OS v3.1.3, my previously posted Eastron modbus driver and a separate Waveshare Industrial USB/RS485 Converter.

I think it is important what is written on the label directly on the device, I noticed there are a lot of variants out there...

0 Likes 0 ·
fridge3 avatar image
fridge3 commented

Is it possible to get two SDM120M into Venus

Both are connected to one PE11 and also working (also readout from Wallbox)

The first one has ID 8 and second at ID 9

I use the script from @robertik

But if i setup both only ID 9 will appear and if i setup only ID 8 nothing appears

2 |3000

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

matthiasu avatar image
matthiasu commented

OK, so it's increasingly difficult to find the current version of the various scripts.

I tried to collect them all and created a git repository:

https://github.com/M-o-a-T/victron-meter-library

Lightly tested with my 1-phase SDM120.

This archive still needs a README, and ideally an install script for a packager, to insert the required imports into `dbus-modbus-client.py` instead of requiring manual patching.

Contributions are more than welcome.

2 |3000

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

xvictron avatar image
xvictron commented

Is it possible to change the phase of a SDM120?Actual the values were shown at phase 1 in the Cerbo. But this meter is connected to phase 2. Is it possible to change that?


Another question: after an update of Cerbo/VenusOs I lost the config files and have to recreate the .py files. Is it possible that the config will survive an update?

Thanks

3 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.

fridge3 avatar image fridge3 commented ·

i am also searching for someone who know this for the sdm120

every sdm120 would be automaticly shown on Phase 1


no; after update you have to do add it agian

0 Likes 0 ·
telekatz avatar image telekatz fridge3 commented ·

You can try my version of the script: https://github.com/Telekatz/venus.dbus-modbus-eastron

0 Likes 0 ·
schraubaer avatar image schraubaer telekatz commented ·

nice code! i tested it, but same issue as described in: https://community.victronenergy.com/idea/114716/power-meter-lib-for-modbus-rtu-based-meters-from-a.html?childToView=279944#comment-279944

may i ask you to check this occasionally in your environment (in case it is running on Venus OS > 2.94)?

0 Likes 0 ·
wade1 avatar image
wade1 commented

Can someone confirm this still works with SMD630 v2 build in 2024?
i have two smd630 from 2023 and they work fine, the new one from 2024 doesnt work. Does these have a new model number?

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.

wade1 avatar image wade1 commented ·
Update: the Model 2024 works fine, mine device (new) was broken and the modbus wasnt working. Got another one which now works as indented.
0 Likes 0 ·
mark232 avatar image
mark232 commented

Hello. it is possible that if I added this data to the configuration, it would be able to send data via modbus to another device. I don't need venus to process it on the display.

class Eastron_Meter_3P(Eastron_Meter_1P):
 def phase_regs(self, n):
 s = 2 * (n - 1)
 return [
 Reg_f32b(0x0000 + s, '/Ac/L%d/Voltage' % n, 1, '%.1f V'),
 Reg_f32b(0x0006 + s, '/Ac/L%d/Current' % n, 1, '%.1f A'),
 Reg_f32b(0x000c + s, '/Ac/L%d/Power' % n, 1, '%.1f W'),
 
 Reg_f32b(0x0012 + s, '/AC/L%d/PowerVAr' % n, 1, '%.1f VAr'),
 Reg_f32b(0x015a + s, '/Ac/L%d/Energy/Forward' % n, 1, '%.1f kWh'),
 Reg_f32b(0x0160 + s, '/Ac/L%d/Energy/Reverse' % n, 1, '%.1f kWh'),

Or any other data..

2 |3000

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

mark232 avatar image
mark232 commented

so I will answer myself. can be added for example:

Reg_f32b ( 0x001E + s , '/AC/L%d/PowerFactor' % n , 1 , '%.1f ' ),

therefore, I want to ask how is it possible that when my Multiplus II is connected to the network and used in inverter mode, it produces a negative factor back to the network?is it mutiplus II fault or is it normal?

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.