Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Iammeter WEM3080T #14

Open
pczolee opened this issue Jan 13, 2022 · 21 comments
Open

Support Iammeter WEM3080T #14

pczolee opened this issue Jan 13, 2022 · 21 comments

Comments

@pczolee
Copy link

pczolee commented Jan 13, 2022

Hello.

Is it possible to support Iammeter WEM3080T ? I have one and I have everything (solaredge inverter, rs485 adapter etc) to test it.

Thanks

@nmakel
Copy link
Owner

nmakel commented Mar 3, 2022

Thanks for getting in touch! I had a look at the documentation of your meter, and while there are many integrations with existing tools, and even a web based API, I can't actually find a modbus document anywhere. Have you found anything that lists all the available registers?

It might be worthwhile just using the web API (via wifi I suspect) as a data source. In case you would like to try this, all we really need is the JSON output of http://meter-ip/monitorjson.

@pczolee
Copy link
Author

pczolee commented Mar 4, 2022

Thanks for the answer! I'll have a look for modbus documentation and let you know if I find it! Anyway the json putput is:

{"method":"uploadsn","mac":"B0F89329E511","version":"2.75.69","server":"em","SN":"DF4DBF22","Datas":[[237.4,3.00,634,11248.760,8031.330,49.93,0.89],[229.7,6.33,1417,8473.460,8373.760,49.93,0.97],[236.4,6.66,-1565,8832.250,8865.660,49.93,0.99]]}

The data details are (the negative power means there is export to the grid):

L1:  
voltage 0 | 237.4 V
current 1 | 3 A
power 2 | 634 W
importenergy 3 | 11248.76 kWh
exportgrid 4 | 8031.33 kWh
frequency 5 | 49.93 Hz
pf: 6 | 0.89

L2 (the rest is same)
0 | 229.7
1 | 6.33
2 | 1417
3 | 8473.46
4 | 8373.76
5 | 49.93
6 | 0.97

L3  (the rest is same)
0 | 236.4
1 | 6.66
2 | -1565
3 | 8832.25
4 | 8865.66
5 | 49.93
6 | 0.99

@pczolee
Copy link
Author

pczolee commented Mar 6, 2022

Thanks for getting in touch! I had a look at the documentation of your meter, and while there are many integrations with existing tools, and even a web based API, I can't actually find a modbus document anywhere. Have you found anything that lists all the available registers?

It might be worthwhile just using the web API (via wifi I suspect) as a data source. In case you would like to try this, all we really need is the JSON output of http://meter-ip/monitorjson.

I have got the modbus documentation with registers from the factory, but they ask me "do not post on the internet". So can I have your email address to send you?

Thanks

@nmakel
Copy link
Owner

nmakel commented Mar 6, 2022

Thanks for getting in touch! I had a look at the documentation of your meter, and while there are many integrations with existing tools, and even a web based API, I can't actually find a modbus document anywhere. Have you found anything that lists all the available registers?
It might be worthwhile just using the web API (via wifi I suspect) as a data source. In case you would like to try this, all we really need is the JSON output of http://meter-ip/monitorjson.

I have got the modbus documentation with registers from the factory, but they ask me "do not post on the internet". So can I have your email address to send you?

Thanks

That's an odd request from the manufacturer. The documentation will be used to add the meter to the sdm_modbus project where -- in addition to the register values in the code -- the documentation will be uploaded for reference. If you do not feel comfortable with that then I suggest you do not post the documentation here and we try to get the web based API working. Otherwise, please attach it to this issue.

@pczolee
Copy link
Author

pczolee commented Mar 7, 2022

That's true. It is a very good thing if we can use the web api as well, because it makes much more easy to use this meter. But of course with modbus it can be more precise (over the web api we have 6sec refresh rate)...
You can find the protocol info below.

WEM3080T Protocol.pdf

@Rai-Rai
Copy link

Rai-Rai commented Mar 7, 2022

A working json meter would be great. I'd then contribute a similar mete to the project - my python skills are good enough for that, but not for adding the first json based meter

@nmakel
Copy link
Owner

nmakel commented Mar 7, 2022

That's true. It is a very good thing if we can use the web api as well, because it makes much more easy to use this meter. But of course with modbus it can be more precise (over the web api we have 6sec refresh rate)... You can find the protocol info below.

WEM3080T Protocol.pdf

Thanks for the document.

Would you please grab the latest master from sdm_modbus and try the following, substituting YOUR_SERIAL_DEVICE for /dev/tty... whatever:

import sdm_modbus
import json

meter = sdm_modbus.WEM3080T(device="YOUR_SERIAL_DEVICE")
print(json.dumps(meter.read_all(scaling=True), indent=4))

@pczolee
Copy link
Author

pczolee commented Mar 8, 2022

I tried... My device is ttyUSB0

[74526.782724] usbcore: registered new interface driver ch341
[74526.782744] usbserial: USB Serial support registered for ch341-uart
[74526.782772] ch341 7-1:1.0: ch341-uart converter detected
[74526.799616] usb 7-1: ch341-uart converter now attached to ttyUSB0

I made a test.py with the following content:

#!/usr/bin/env python3

import sdm_modbus
import json

meter = sdm_modbus.WEM3080T(device="/dev/ttyUSB0")
print(json.dumps(meter.read_all(scaling=True), indent=4))

First I installed the sdm_modbus with pip

$ ./test.py
Traceback (most recent call last):
File "./test.py", line 6, in
meter = sdm_modbus.WEM3080T(device="/dev/ttyUSB0")
AttributeError: module 'sdm_modbus' has no attribute 'WEM3080T'

So It looks pip have old version. So I grab the master and the files from src/sdm_modbus moved to the ~/.local/lib/python3.6/site-packages/sdm_modbus (the old was here, so of course removed before).

After that test.py running, but no result:

$ ./test.py
{}

Of course the device have 20666 permission... What's wrong? :(

@nmakel
Copy link
Owner

nmakel commented Mar 8, 2022

After that test.py running, but no result:

$ ./test.py {}

Of course the device have 20666 permission... What's wrong? :(

That's not actually a completely horrible result. The default baud rate of sdm_modbus is 38400 baud. Your meter probably works on a different baud rate, but as the modbus documentation is so very very short there's no telling what it is. You will need to experiment with different baud rates until you get some result. Do this by adjusting the script so:

#!/usr/bin/env python3

import sdm_modbus
import json

baudrate = 1200
meter = sdm_modbus.WEM3080T(device="/dev/ttyUSB0", baud=baudrate)
print(json.dumps(meter.read_all(scaling=True), indent=4))

Try baudrate of 1200, 2400, 9600, or 115200.

@pczolee
Copy link
Author

pczolee commented Mar 10, 2022

I tried it, but with the same result :(
I thought I try with another laptop, but on this running ubuntu 14.04 with python 3.4. I have an error whet I try to run:

Traceback (most recent call last):
File "./test.py", line 3, in
import sdm_modbus
File "/usr/local/lib/python3.4/dist-packages/sdm_modbus/init.py", line 1, in
from sdm_modbus.meter import *
File "/usr/local/lib/python3.4/dist-packages/sdm_modbus/meter.py", line 130
return f"{self.model}({self.device}, {self.mode}: stopbits={self.stopbits}, parity={self.parity}, baud={self.baud}, timeout={self.timeout}, retries={self.retries}, unit={hex(self.unit)})"
^
SyntaxError: invalid syntax

Is this because of the older python version? Which version do I need?

Today I going to try with another adapter and with another cable. Are there any other way how can I debug?

It is very complicated to use/integrate the json output? Because that should be much more easy to use the people in some cases...

Thanks

@pczolee
Copy link
Author

pczolee commented Mar 10, 2022

I have no luck :( . Now I tried with a one meter long cable, of course with every baud rate, but the same is the result :( . Let me know how can I debug to find where is the problem?!

Thanks

@nmakel
Copy link
Owner

nmakel commented Mar 10, 2022

I have no luck :( . Now I tried with a one meter long cable, of course with every baud rate, but the same is the result :( . Let me know how can I debug to find where is the problem?!

Thanks

The empty {} is a good result, it means the script executes properly, there's just no communication with the meter. This may be due to a number of things. The most likely are the baud rate and the id the meter is listening on. Because there's no documentation this is just guessing, but you could try adding unit to the following line and trying values other than the default of 1. Due to the lack of documentation this could be any number between 1 en 254:

meter = sdm_modbus.WEM3080T(device="/dev/ttyUSB0", baud=baudrate, unit=2)

@pczolee
Copy link
Author

pczolee commented Mar 18, 2022

Are there any way to make this automate? I mean a program which can try any id or baud to find the device?

@pczolee
Copy link
Author

pczolee commented Mar 19, 2022

I have got this from the manufacturer:
the RS485 is 9600/8/N/1.

The software will work like a Modbus master, polling the data from the energy meter.

Hope it will help...

@nmakel
Copy link
Owner

nmakel commented Mar 28, 2022

I have got this from the manufacturer: the RS485 is 9600/8/N/1.

The software will work like a Modbus master, polling the data from the energy meter.

Hope it will help...

Those values match what you would have tried already using the suggestions I posted. Have you had any luck talking to the meter via any other software?

@pczolee
Copy link
Author

pczolee commented Mar 30, 2022

I have got this from the manufacturer: the RS485 is 9600/8/N/1.
The software will work like a Modbus master, polling the data from the energy meter.
Hope it will help...

Those values match what you would have tried already using the suggestions I posted. Have you had any luck talking to the meter via any other software?

I have to look for an other tool to test it... Can you give me any suggestion?

@pczolee
Copy link
Author

pczolee commented Mar 30, 2022

Reading from json is not working?

@pczolee
Copy link
Author

pczolee commented May 16, 2022

Another good thing. Now we are able to use modbus tcp to read data from WEM3080T. You can watch here:
https://www.youtube.com/watch?v=aumNgMPp1sA
and here: https://www.iammeter.com/newsshow/news-modbus-tcp-energy-meter
So the question is, can we use this as a source to make this meter work with SE inverter?
Thanks

@pczolee
Copy link
Author

pczolee commented Jun 8, 2022

Are there any news regarding this meter?

@nmakel
Copy link
Owner

nmakel commented Jun 9, 2022

I asked you to try connecting to the meter using any other modbus software to confirm the meter is accessible. Have you done this? I won't be able to debug the problem unless you can verify that the meter is actually working over modbus.

@pczolee
Copy link
Author

pczolee commented Jun 10, 2022

Well, unfortunately I had no success with modbus rtu (tried with modbus mechanic), maybe my usb-rs485 adapter is fault. The new is on the way, so I will see when it is here. But, as I wrote, now we can communicate with the meter in modbus tcp. and that one is working with modbus mechanic. So that's why I ask maybe we can use this meter with modbus tcp communication?!
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants