Closed prein2 closed 5 years ago
nevermind.. got it!
can you explain how you solved this?
The meterbus.send_request_frame command has an option to request a special kind of frame. For first test, I altered the code of the following file: https://github.com/ganehag/pyMeterBus/blob/master/tools/mbus-serial-request-data-multi-reply.py and hardcoded my dataframe in it.
btw: use python2..
Here is how this file looks in my case (if you have the same meter, this file will directly work..) note line 71...
https://github.com/ganehag/pyMeterBus/pull/17/commits/e45fc0d19afaaaca0f3ac6412a642caa587c8239
Thanks,
I am using the same meter (Eastron sdm630 Mbus) but using your file i'm getting the following error.
bart@server:~/pyMeterBus-master/tools$ sudo python mbus-serial-request-data-multi-reply_Aestron630 -d /dev/ttyUSB0 INFO:meterbus.serial:SEND (005) 10 40 FE 3E 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 01 B1 05 16 Traceback (most recent call last): File "mbus-serial-request-data-multi-reply_Aestron630", line 73, in <module> meterbus.recv_frame(ser)) File "../meterbus/__init__.py", line 48, in load raise MBusFrameDecodeError("empty frame", data) meterbus.exceptions.MBusFrameDecodeError
Of coarse 😉
Forgot to mention: it is hard-coded to adress 1..
Also put the address in your command line for the rest of the function to work properly.
For another address, change \x01 in your address according to the manual..
Op 4 okt. 2019 om 07:14 heeft bart.e notifications@github.com<mailto:notifications@github.com> het volgende geschreven:
Thanks,
I am using the same meter (Eastron sdm630 Mbus) but using your file i'm getting the following error.
bart@server:~/pyMeterBus-master/tools$ sudo python mbus-serial-request-data-multi-reply_Aestron630 -d /dev/ttyUSB0 INFO:meterbus.serial:SEND (005) 10 40 FE 3E 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 01 B1 05 16 Traceback (most recent call last): File "mbus-serial-request-data-multi-reply_Aestron630", line 73, in
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/ganehag/pyMeterBus/issues/16?email_source=notifications&email_token=AA7DUI6LC2BLKMNFE5IJ75TQM3GJTA5CNFSM4I3SXCIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKNXJQ#issuecomment-538237862, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA7DUIYAQCEXU6TA7PX5FO3QM3GJTANCNFSM4I3SXCIA.
Nice to see you guys managed to figure it out. Great!
I've published a new version (0.7.17) with some improvements to the "Control Frame". Fingers crossed that it works. I didn't have the time to write any test cases.
frame = meterbus.TelegramControl()
frame.address = 0x01
frame.set_ram_readout() # 0xb1
meterbus.serial_send(frame)
It can also create a baud-rate switch frame using:
frame.set_baud(300) # 600, 1200, 2400, 4800, 9600, 19200, 38400
Additional methods are in telegram_control.py
@prein2 my meter has address 3, so i changed the code to \x03 and added argument -a 3 to the command.
(it looks likle this meterbus.send_request_frame_multi(ser, address,"\x68\x03\x03\x68\x53\x03\xb1\x05\x16")
)
Still same result though:
bart@ubuntu_webserver:~/pyMeterBus-master/tools$ sudo python mbus-serial-request-data-multi-reply_Aestron630 -d /dev/ttyUSB0 -a 03 INFO:meterbus.serial:SEND (005) 10 40 03 43 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 03 B1 05 16 Traceback (most recent call last): File "mbus-serial-request-data-multi-reply_Aestron630", line 73, in <module> meterbus.recv_frame(ser)) File "../meterbus/__init__.py", line 48, in load raise MBusFrameDecodeError("empty frame", data) meterbus.exceptions.MBusFrameDecodeError
the scan tool does find the meter at address 3.
ok, so you can wake-up the device, and can send the right command, but you don't get a reply...
How about the baudrate? You can set it at the meter and can give the right baudrate, for 2400 try:
sudo python mbus-serial-request-data-multi-reply_Aestron630 -d -a 3 -b 2400 /dev/ttyUSB0
yes, the baudrate is set in the meter to 2400 and i tried setting it in the command, same result. With the wrong baud rate the scan command does not wok either. So i know it works at 2400.
I really have no idea!
Try the following file: https://github.com/prein2/pyMeterBus/blob/patch-2/MbusAestron630.py
It first pings the meter, then requests the standard frame (for Energy values) and then requests the other frame (for Voltage, power etc). Main difference: the timeout is 1 second, I think that's more than the other file..
After the debug output you only get energy and power, but you can add a print command for the full json structure..
@prein2 thank you for helping...
i get this output now, still error's out.
bart@ubuntu_webserver:~/pyMeterBus-master1/tools$ sudo python MbusAestron630.py -d /dev/ttyUSB0 -b 2400 -a 03 INFO:meterbus.serial:SEND (005) 10 40 03 43 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (005) 10 7B 03 7E 16 INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 5D INFO:meterbus.serial:RECV (001) 5D INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 08 INFO:meterbus.serial:RECV (001) 03 INFO:meterbus.serial:RECV (001) 72 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (090) 99 09 24 40 01 02 55 00 00 00 0C 04 02 22 00 00 0C 04 02 22 00 00 0C 04 00 00 00 00 0C 04 02 22 00 00 0C 04 02 22 00 00 0C 04 00 00 00 00 0C FD 3A 24 03 00 00 0C FD 3A 09 00 00 00 0C FD 3A 15 03 00 00 0C FD 3A 24 03 00 00 0C FD 3A 09 00 00 00 0C FD 3A 15 03 00 00 1F 16 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 03 B1 05 16 Traceback (most recent call last): File "MbusAestron630.py", line 84, in <module> main() File "MbusAestron630.py", line 48, in main meterbus.recv_frame(ser)) File "build/bdist.linux-x86_64/egg/meterbus/__init__.py", line 48, in load meterbus.exceptions.MBusFrameDecodeError
ps, can i get the formatting of the output to show correct here?
@prein2 i'm a step closer now! I changed the meter address to 1 and edited the code and command to the same address. Now it dfoes receive instantaneous data! Seems like it does not like addresses other then 1. This could be an issue later on as i'm planning on adding a second sdm630.
This is the output now.
bart@ubuntu_webserver:~/pyMeterBus-master1/tools$ sudo python mbus-serial-request-data-multi-reply_Aestron630 -d /dev/ttyUSB0 -a 01 INFO:meterbus.serial:SEND (005) 10 40 01 41 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 01 B1 05 16 INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 90 INFO:meterbus.serial:RECV (001) 90 INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 08 INFO:meterbus.serial:RECV (001) 01 INFO:meterbus.serial:RECV (001) 72 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (141) 99 09 24 40 01 02 55 00 00 00 0B FD 47 60 38 02 0B FD 47 28 39 02 0B FD 47 64 38 02 0B FD 47 86 13 04 0B FD 47 89 13 04 0B FD 47 31 13 04 0B FD 59 26 03 00 0B FD 59 50 03 00 0B FD 59 97 02 00 0B FD 59 58 00 00 0B 2A 89 07 00 0B 2A 77 01 00 0B 2A 06 03 00 0B 2A 06 03 00 0B FD 3A 77 21 F0 0B FD 3A 58 07 F0 0B FD 3A 81 07 F0 0B FD 3A 41 06 F0 0A FD 3A 40 03 0A FD 3A 27 02 0A FD 3A 65 03 0A FD 3A 30 04 0A FD 3A 01 50 10 16 { "access_no": 85, "identification": "09999999", "manufacturer": "PAD", "medium": 2, "records": [ { "unit": "V", "value": 238.599999999999994315658113919198513031005859375 }, { "unit": "V", "value": 239.280000000000001136868377216160297393798828125 }, { "unit": "V", "value": 238.640000000000014779288903810083866119384765625 }, { "unit": "V", "value": 413.8600000000000136424205265939235687255859375 }, { "unit": "V", "value": 413.8899999999999863575794734060764312744140625 }, { "unit": "V", "value": 413.31000000000000227373675443232059478759765625 }, { "unit": "A", "value": 0.326000000000000011990408665951690636575222015380859375 }, { "unit": "A", "value": 0.350000000000000033306690738754696212708950042724609375 }, { "unit": "A", "value": 0.296999999999999986233234494648058898746967315673828125 }, { "unit": "A", "value": 0.058000000000000002942091015256664832122623920440673828125 }, { "unit": "W", "value": 78.900000000000005684341886080801486968994140625 }, { "unit": "W", "value": 17.699999999999999289457264239899814128875732421875 }, { "unit": "W", "value": 30.60000000000000142108547152020037174224853515625 }, { "unit": "W", "value": 30.60000000000000142108547152020037174224853515625 }, { "unit": "none", "value": 1502177 }, { "unit": "none", "value": 1500758 }, { "unit": "none", "value": 1500781 }, { "unit": "none", "value": 1500641 }, { "unit": "none", "value": 340 }, { "unit": "none", "value": 227 }, { "unit": "none", "value": 365 }, { "unit": "none", "value": 430 }, { "unit": "none", "value": 5001 } ] } http://localhost:8080/json.htm?type=command¶m=udevice&idx=196&nvalue=0&svalue=78.9 Traceback (most recent call last): File "mbus-serial-request-data-multi-reply_Aestron630", line 122, in <module> result = json.load(urllib2.urlopen(URL)) File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 429, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 447, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open raise URLError(err) urllib2.URLError: <urlopen error [Errno 111] Connection refused>
Cool! Perfect, now it is just a matter of implementing..
I wonder why the address problem is persistent..
The error you get is a snippet of my own code, I send the values I want to domoticz, so just ignore it...
Op 8 okt. 2019 om 11:13 heeft bart.e notifications@github.com<mailto:notifications@github.com> het volgende geschreven:
@prein2https://github.com/prein2 i'm a step closer now! I changed the meter address to 1 and edited the code and command to the same address. Now it dfoes receive instantaneous data! Seems like it does not like addresses other then 1. This could be an issue later on as i'm planning on adding a second sdm630.
This is the output now.
bart@ubuntu_webserver:~/pyMeterBus-master1/tools$ sudo python mbus-serial-request-data-multi-reply_Aestron630 -d /dev/ttyUSB0 -a 01 INFO:meterbus.serial:SEND (005) 10 40 01 41 16 INFO:meterbus.serial:RECV (001) E5 INFO:meterbus.serial:SEND (009) 68 03 03 68 53 01 B1 05 16 INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 90 INFO:meterbus.serial:RECV (001) 90 INFO:meterbus.serial:RECV (001) 68 INFO:meterbus.serial:RECV (001) 08 INFO:meterbus.serial:RECV (001) 01 INFO:meterbus.serial:RECV (001) 72 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (001) 99 INFO:meterbus.serial:RECV (141) 99 09 24 40 01 02 55 00 00 00 0B FD 47 60 38 02 0B FD 47 28 39 02 0B FD 47 64 38 02 0B FD 47 86 13 04 0B FD 47 89 13 04 0B FD 47 31 13 04 0B FD 59 26 03 00 0B FD 59 50 03 00 0B FD 59 97 02 00 0B FD 59 58 00 00 0B 2A 89 07 00 0B 2A 77 01 00 0B 2A 06 03 00 0B 2A 06 03 00 0B FD 3A 77 21 F0 0B FD 3A 58 07 F0 0B FD 3A 81 07 F0 0B FD 3A 41 06 F0 0A FD 3A 40 03 0A FD 3A 27 02 0A FD 3A 65 03 0A FD 3A 30 04 0A FD 3A 01 50 10 16 { "access_no": 85, "identification": "09999999", "manufacturer": "PAD", "medium": 2, "records": [ { "unit": "V", "value": 238.599999999999994315658113919198513031005859375 }, { "unit": "V", "value": 239.280000000000001136868377216160297393798828125 }, { "unit": "V", "value": 238.640000000000014779288903810083866119384765625 }, { "unit": "V", "value": 413.8600000000000136424205265939235687255859375 }, { "unit": "V", "value": 413.8899999999999863575794734060764312744140625 }, { "unit": "V", "value": 413.31000000000000227373675443232059478759765625 }, { "unit": "A", "value": 0.326000000000000011990408665951690636575222015380859375 }, { "unit": "A", "value": 0.350000000000000033306690738754696212708950042724609375 }, { "unit": "A", "value": 0.296999999999999986233234494648058898746967315673828125 }, { "unit": "A", "value": 0.058000000000000002942091015256664832122623920440673828125 }, { "unit": "W", "value": 78.900000000000005684341886080801486968994140625 }, { "unit": "W", "value": 17.699999999999999289457264239899814128875732421875 }, { "unit": "W", "value": 30.60000000000000142108547152020037174224853515625 }, { "unit": "W", "value": 30.60000000000000142108547152020037174224853515625 }, { "unit": "none", "value": 1502177 }, { "unit": "none", "value": 1500758 }, { "unit": "none", "value": 1500781 }, { "unit": "none", "value": 1500641 }, { "unit": "none", "value": 340 }, { "unit": "none", "value": 227 }, { "unit": "none", "value": 365 }, { "unit": "none", "value": 430 }, { "unit": "none", "value": 5001 } ] } http://localhost:8080/json.htm?type=command¶m=udevice&idx=196&nvalue=0&svalue=78.9 Traceback (most recent call last): File "mbus-serial-request-data-multi-reply_Aestron630", line 122, in
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ganehag/pyMeterBus/issues/16?email_source=notifications&email_token=AA7DUI4ZLAOS5EM45G7XLPDQNRFMHA5CNFSM4I3SXCIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEATP2LY#issuecomment-539426095, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA7DUI647WCII5OALCNEBWTQNRFMHANCNFSM4I3SXCIA.
yeah i think i'll edit the MbusAestron630.py file to send data through mqtt. Thanks alot for helping out!
Hello there, I don't know where else to ask this, so I will post here.
I've been trying to get meterbus to work with a Kamstrup 6M2 using an M-Bus to UBS module from Aliexpress. I always get an error regarding an empty frame. The energy meter works, and I can see an LED blink every time that I scan the COM port is scanned (using mbus-serial-scan.py)
Could it be that I receive no frames because the USB module I've purchased is actually not an M-Bus master but a slave module?
I probably have the same aliexpress module. I DO have the master version though, which i think you need.
Hello there, I don't know where else to ask this, so I will post here.
I've been trying to get meterbus to work with a Kamstrup 6M2 using an M-Bus to UBS module from Aliexpress. I always get an error regarding an empty frame. The energy meter works, and I can see an LED blink every time that I scan the COM port is scanned (using mbus-serial-scan.py)
Could it be that I receive no frames because the USB module I've purchased is actually not an M-Bus master but a slave module?
As far as I remember, and if I am wrong then anyone please correct me. The MBus master communicates with slaves using voltage shifting. While a slave responds by altering the current. Thus you should be able to determine which device you have by measuring with a basic multimeter while sending random data in a low baudrate.
Hello there, I don't know where else to ask this, so I will post here. I've been trying to get meterbus to work with a Kamstrup 6M2 using an M-Bus to UBS module from Aliexpress. I always get an error regarding an empty frame. The energy meter works, and I can see an LED blink every time that I scan the COM port is scanned (using mbus-serial-scan.py) Could it be that I receive no frames because the USB module I've purchased is actually not an M-Bus master but a slave module?
As far as I remember, and if I am wrong then anyone please correct me. The MBus master communicates with slaves using voltage shifting. While a slave responds by altering the current. Thus you should be able to determine which device you have by measuring with a basic multimeter while sending random data in a low baudrate.
Thank you for the info! I've ordered a master module and I will hopefully be able to test it before the holidays. If it's okay, I'll post my findings here? If there's any info I should obtain from the 6M2 that can help others, I'll gladly look into it.
Sure, you can post it here, or in a new issue.
With python3: meterbus.send_request_frame_multi(ser, address,"\x68\x03\x03\x68\x53\x01\xb1\x05\x16") ) should be meterbus.send_request_frame_multi(ser, address, b'\x68\x03\x03\x68\x53\x01\xb1\x05\x16') )
took me some time to figure it out. I can now readout the Eastron-SDM instantaneous electrical information.
Ive got an Eastron energy measuring module. With the standard mbus-serial-request-data and mbus-serial-request-data-multi-reply I only get the Energy values.
The protocol (https://www.kwhmeter.nl/Files/2/26000/26485/Attachments/Product/0Oq90EEQ42226h7911o5983365exE52r.pdf) states that when I send the following frame: Master to slave : 68 03 03 68 53 XX b1 05 16 Slave to master: Variable data structure (instantaneous electrical information) If the primary address is 01 then XX=01
But how do I send this frame to the slave?
Any tips?