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
15 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)
rtrooster avatar image rtrooster zolimar commented ·

Did you also removed the TWE cache files in the __pycache__ directory?

  • OS versions >=2.80: For updates of this library delete all files with prefix "TWE_" in directory /opt/victronenergy/dbus-modbus-client/__pycache__

Otherwise you changes are not updated

0 Likes 0 ·
zolimar avatar image zolimar rtrooster commented ·
I did. I also tried to delete all .pyc files, but still the same.
0 Likes 0 ·
zolimar avatar image zolimar zolimar commented ·
Something is strange: I tried to listen in with another RS485 adapter on the PC.

It seems that the Cerbo GX is sending the message: 01 03 00 0B 00 01 F5 C8, si it requests 1 byte from the meter from address 00 0B and the meter correctly responds: 01 03 02 00 00 B8 44, with the 0B registry content that is 00 but the discovery and with unknown "Device ID message" in the log. Why the Victron device is trying to read the content of registry 00 0B??? Do you know where can I change it in the python script? @ThomasW. maybe can you help?

0 Likes 0 ·
zolimar avatar image zolimar zolimar commented ·
And there is another sequence from Victron device: 00 08 00 00 55 55 1E B5 that the meter is responding to with: 01 08 00 00 AA 55 5E 94 and this is happening several times in a row. I am completely clueless.
0 Likes 0 ·
telekatz avatar image telekatz zolimar commented ·

Try this change in TWE_Eastron_SDM630v2.py line 94:

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

This fixed the problem in my installation after the power meter stopped working after updating Venus OS to V2.92.

1 Like 1 ·
zolimar avatar image zolimar telekatz commented ·
Thanks a loooootttttt!!!!! You made my day. It indeed solved my problem and SDM630v2 started working immediatly. Thanks again!
0 Likes 0 ·
sega avatar image sega telekatz commented ·

Great... that's also the solution for the SDM72 - you made also my day :D

0 Likes 0 ·
marommel avatar image marommel sega commented ·

hi, in my case I can't get the sdm72 working.

that's what I did:

- edit "TWE_Eastron_SDM72D.py " for my device:

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

- uploaded "TWE_Eastron_device.py" and "TWE_Eastron_SDM72D.py"

- add line "import TWE_Eastron_SDM72D" in the "dbus-modbus-client.py"

- restart the cerbo gx

As I understood now I should see the SDM72 in the device list? But I'dont. Is it necassary to run a scan somewhere? Did I miss something?

Strangely since these uploads the "press to scan" button on the "Modbus TCP devices" tab doesn't work anymore.

I use the original victron RS485 to usb adapter and run the lastest venus OS 2.92

Thanks a lot for your help,

Markus


0 Likes 0 ·
sega avatar image sega marommel commented ·

@marommel for me the SDM72 is also working... but also needs a baudrate higher then 9600 (19200 is the setting) - both testet... ModbusTCP over Waveshare and RS485


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


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

0 Likes 0 ·
Show more comments
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



-1 Like -1 ·
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?

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.

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

Your Opinion Counts

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