Smart Meter AM550 auslesen. (Python)

50 posts / 0 new
Last post
UnknownExe
Smart Meter AM550 auslesen. (Python)

Hello I am new here at GURUX and would have a question about the software.

I would like to read the AM550 electricity meter in Python. I get the data from the customer interface on a USB adapter that is connected to a Raspberry Pi.

Now I want to read out the data record using a Python script and save it in a variable for further processing.

Can you help me with a simple example code?

Thanks in advance
UnknownExe

Kurumi
Kurumi's picture

Hi,

Check the video from YouTube first:
https://youtu.be/OcmYvcsgjz4

Then use client example to read data from the meter:
https://github.com/Gurux/Gurux.DLMS.Python/tree/master/Gurux.DLMS.Client...

Client example comman line parameters are something like:

python main.py -S COM_PORT -t Verbose

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thanks for your quick reply

I've already tried it, but unfortunately it didn't work. (Photo is attached). With the command: sudo screen -l / dev / ttyUSB0 -s 115200 --parity = none: So I get a terminal where I get data sent every second.

My current electricity provider told me that this character is encrypted with AES 128 and that you can only make it readable with GURUX later, for example.

In addition, I know that the electricity meter can only send and not receive. How can I now write a script where the data is omitted, decrypted and processed.

Unfortunately, I cannot say how to do it. I hope you can help me

Sincerely, UnknownExe

Image: 
Kurumi
Kurumi's picture

Hi,

If I understand correctly, the meter is sending push messages once per second and you want to convert send data to XML? Is this correct? Do you have encryption keys? You need them if data is encrypted.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thanks for the quick reply

Yes, that's exactly what I want. I want to get the data in my script and do calculations, for example. I have already received encryption and the key from my electricity provider.

UnknownExe

Kurumi
Kurumi's picture

Hi,

In this case, you don't use the client example. It'll make a connection to the meter and reads data from it.
You need to use Gurux.DLMS.Push.Listener.Example.python

Try something like:

python main.py -S /dev/ttyUSB0:115200 -t Verbose

Then you need to set the authentication and block cipher keys.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thx,

something did not work during the attempt. Picture attached.

What do you mean by (Then you need to set the authentication and block cipher keys.) Or how can I do that?

UnknownExe

Image: 
Kurumi
Kurumi's picture

Hi,

My mistake- The parameter is:
python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose

You need authentication and block cipher key from the meter company. Without those keys, you can't decrypt the data. Keys are 16 bytes long keys.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Can it be that I have to write my key somewhere in the code?

Do I need two keys for decryption or did I get it wrong?

UnknownExe

Hii and thanks,

Yeah it worked so I'm getting data now. I already have the key. The key consists of 32 characters. Where do I write the key so that I can read the data clearly.

I would be very grateful if you could help me with the key.

Best regards

UnknownExe

Image: 
Kurumi
Kurumi's picture

Hi,

If you have only one key I believe that your meter is using the same key for authentication and block ciphering.

Add parameter like this:

-A YOUR_KEY -B YOUR_KEY

Please, don't paste images. It's easier to get bytes if you paste them as text.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thanks

Have I made a mistake while entering? Or I don't find the mistake.

Have I understood that correctly? So I should not post pictures, just the command?

Image: 
Kurumi
Kurumi's picture

Hi,

Yes, don't post the images.

I just checked and command line support for ciphering is missing from the push listener. We'll add command line parameters today.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thanks

Oki I will no longer post pictures, just the commands and the errors!

What would you really do for me today !!! Thank you, thank you, I am indebted to you.

If it works afterwards I would like to ask you how I can save the data I get in a script in a variable?

So how could I make a script where every 5 min for example Gurux provides me with all the data from the electricity meter and stores it in a variable.

Thanks again you really help me

Kind regards UnknownExe

Kurumi
Kurumi's picture

Hi,

Changes are in GitHub. Get the latest version. Check onReceived method. There is a printData that prints received values. You can modify this for your needs.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thanks that went quickly

Now this command goes: python main.py -S / dev / ttyUSB0: 115200: 8None1 -t Verbose -A AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH -B AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH

But the values I get look like this: New data is received. / dev / ttyUSB0: 1C 73 76
trace: 10: 40: 28 2 9B 9C A6
New data is received. / dev / ttyUSB0: 9B 9C A6
trace: 10: 40: 28 2 98

How can I read this now?

Kind regards UnknownExe

UnknownExe

I've been thinking but I can't figure out what that could mean

Kurumi
Kurumi's picture

Hi,

Check your baud rate. The first (and last) char should be 7E when your serial port settings are correct.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

539/5000
Hello and thanks!

The baud rate 115200 should be correct for the ISKRA AM550. But that doesn't work for me yet! I don't see 7E. The activation key offered by my electricity is correct. My command is: python main.py -S / dev / ttyUSB0: 9600: 8None1 -t Verbose -A AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH -B AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH

Why could that be, please help me!

Another little question! The values are HEX and I have to convert them to ASCII by hand right?

Best regards!

UnknownExe

UnknownExe

Could it be that I don't need the authentication key! But only the decryption key?

Kurumi
Kurumi's picture

Hi,

Keys are given as hex. The keys are not the problem here. Check your serial port settings. You should see 0x7e in the trace. Try with different baud rates.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello,

I'm confused! It shouldn't matter whether it's a key or not! a 7E should always come! But no matter what baud rate I enter, there is simply no 7E. Now I'm even at the end of my Latin I hope you can still help me or give me a tip! The baud rate for the AM550 is 115200 on the internet but I have no success with that either.

Kind regards UnknownExe

Kurumi
Kurumi's picture

Hi,

I asked from this and it seems that some meters are configured to send ASCII data and not DLMS. This depends from the metering company, etc.

Try to connect using 115200 8None1. Is your data ASCII?

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

When I was experimenting, I got a thing with 7e, the same thing, but I can't convert it into clear signs either.

Command: python main.py -S /dev/ttyUSB0:9600:7even1 -t Verbose -A KEY-B KEY

7E 1B 5C 18 2B 18 1E 5B 5E 58 47 1B 5C 1F 3E 1F 7B 1B 1C 46 1B 2B 1C 1D 1A 33 79 1B 1C 66 5D 37 1B 5E 1E 78 1B 3C 1E 5D 56 33 2B 1C 18 57 3B 2B 5C 5A 73 1B 1E 46 06 5F 18 5E 5F 1F 7F 1B 5C 1E 1B 19 47 1B 1C 18 1B 59 1B 1C 1C 53 1C 5F 1B 1B 5C 19 5F 1C 19 18 1E 18 1E 37 1B 1E 38 58 53 5E 03 5A 46 1B 5C 27 13 7F 1B 1C 1A 19 6B 1B 1C 5D 2B 77 1B 3C 58 1A 18 1B 1C 1F 7F 1B 5C 1D 5E 3B 58 5E 38 5E 57 5C 1B 1C 1D 5D 5C 7B 1B 2B 5E 63 7E

with this command: python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose -A KEY-B KEY

Unfortunately I don't get a 7E!

My data comes in the DLMS from binary

Kurumi
Kurumi's picture

Hi,

Now there is 7E in the beginning and in the end, but data in the middle is not correct. Can you ask from the metering company what serial port settings you should use?

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

The electricity meter company says that the settings should be 115200 8None1! But they said it's probably an electrical problem for me. Do I have to build a RJ11 or Rj12 to usb cable myself? Or can I buy?

Kurumi
Kurumi's picture

Hi,

Have you connected to the serial port or P1? Can you connect using 115200 8None1 and post received bytes here as plain text? I'll check one thing.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

hello, should i send the original output of the console window? or should I summarize it on the hex characters. best regards UnknownExe

UnknownExe

My Output;

GURUX with KEY
Commend: python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose -A KEY -B KEY
Try 1 Output:
00 1B 58 1B 58 63 5A 1B 58 6B 1E 5F 3B 2B 58 5E 1E 73 1B 18 33 5C 58 7B 1B 58 77 38 58 59 1E 1C 18 58 5E 7B 5A 19 1B 18 5F 5F 19 1B 58 5C 19 47 1B 58 5F 1E 7F 1B 58 1B 1F 1C 1B 78 47 58 1A 00 63 5A 7F 1B 30 5C 1F 1B 1B 18 1B 18 1F 5E 5C 2B 73 1B 58 16 5C 0B 1F 1B 58 57 5B 1B 58 5A 7D 1B 58 18 5B 1D 58 59 5B 63 1B 18 6C 18 5C 1B 18 1F 47 1B 58 5F 59 18 18 1D 5F 18 58 1B 58 5F 00 1A 58 7E 1B 58 1F 1B 1C 1C 18 58 19 7E 1B 18 1B 30 59 2B 5B 1B 30 3F 1D 5E 7F 33 2B 58 1D 5E 5E 1B 18 1C 7A 1B 2B 18 1C 5F 1B 58 5A 18 1B 18 66 7D 18 58 27 1B 58 1B 1B 18 33 37 1C 1B 1C 00 63 1F 18 47 1B 18 5D 19 7C 1B 18 5C 67 1B 5C 18 3B 1B 58 5C 0F 1B 58 5E 5F 7F 1B 5C 1F 5D 1B 5C 18 5B 1F 7E 1B 18 5E 1F 1B 58 5D 3C 5B 5A 53 18 4B 7E 1B 18 1F 7F 7F 1B 58 5B 1F 18 18 5C 00 23 1C 7F 18 58 27 47 53 37
Try 2 Output:
9B 1C DA 9B 5C 1E 1A 59 66 9B DC 46 1F 59 9B 9C DD 9E 18 53 D8 5F 9B 5C 19 DE DE FF 9B DC FB B7 FF 9B 9C 66 B1 3B 98 18 59 4B 36 F8 9B 1C B7 37 FE BB AB 1C 9B 5C 66 FF 9B 18 83 9F 9A FF 9B 1C 9A 5E 5D DA 9B DC 5B 1F 9B DC F3 9B 98 DE D9 B3 AB 58 9A DD 37 9B DC 1E 4E FE 9B 1C D8 9B 1C DE 6B DB 9B 9B DC 5A DC 18 9B 5C 9A 9B 1C 5F 9B 1C D9 1D DC 36 9B 9C 6F 58 DB 98 DC 98 9F 9B 5C 59 1B 9B DC E7 F9 9B 9C 1F FE FB 9B 1C DF DD 5E 9B 1C 5A FF 9B 1C 9B 1C 5C 57 BF 9B 58 D3 3F 98 9C 19 9C 9B 5C 5C 1F 38 98 DC 1C DC D6 57 9B 5C 9F D6 98 5C 5C FB 98 5C 9B 98 9B DC 73 B3 AB 1C 5A 46 03 9B 3C 9D 1A BB AB 5C DB 57 9B 5C 9C 5E BB AB 5C DA 1F FF 98 9C F7 1B FF

Try 3 Output:
00 98 5C 9E 1B B1 DF 1C 9A 1F 9B 1C 39 FF 9B 9C 5F 1B 3B 9F B3 AB DC 5D FC 98 5C 5E 5A F3 BB AB 9C 5B D9 9B DC 17 06 9B 9C 3F 56 C7 FF 1C 7B 9B AB 1C DA DE 17 DF 9B 9C DF 9B 5C 86 9A D6 9B 00 9C 06 DB 9B 5C 27 2E 98 9C D9 DB C6 9B DC 76 19 9B 98 DC DC 66 DA 5B 9B 9C 1F B9 9B DD 98 5C 98 9E 9B 5C 18 FF 9B 5C A6 9B 9B 9C 5F 47 9B D8 23 FB 9B 5C 56 5B 1A 9B DC 99 99 9B DC CB DD 00 A7 9B 1C C3 1B 9B D8 5A 39 DB DD DD 58 6B E7 9B 5C B3 DB D7 D9 9B DC BC 9D 9F 9B DC 57 A6 1A FF 9B 5C 1D A3 5C BB AB BC 58 5F 1A 98 DC 99 5B 9B 1C 19 DF 9A 9B 9C 0B 1D 86 5F 17 9B DC BE 00 9B DC FF 77 FC 9B 5C DF 9C 53 18 5D AB 59 9B DC F7 3F DF 9B 98 DB 23 5F 9B D8 ED 5E 9B 58 87 9B 3C DB B1 FB 9C 9B 9F 5A 9B 5C 43 E3 9B 5C 9B 9B F9 9B D8 FB 19 9B 58 DB FF FF 18 9B DC 3E 00 DE 9B 98 5C 76 98 58 5F 1F

GURUX without KEY

Output over a longer period:
9B 1C 9C 9E 9B 9C 9B 57 BB DD 5C DE 9D B7 9B 9C 97 77 A6 9A 9B 5C D8 57 DD 9B 5C DF 1C 9B 5C 47 9A 18 9B DC DC 1C DF 7B 9B 9C 9B 1C 9E 9F 03 53 9C EF 86 7F 9B 9C 98 DA 9B 5C B8 9E 9B 1C DA 5C BE 9B AB DC 98 9E DB D9 9B 1C 9C 5E 26 9B 5C 1A DF 9B 3C 9C DE 5E D8 9B DC 5B DB 1F 1C EB 38 DA D7 D6 BB AB DC DC C7 9B 1C 5E 5B 9B AB DC 9B 9B 5C 47 C6 9B 9C 07 53 DC 5C DD 7B 3A 53 9C C7 B9 F6 98 1C 1B 16 18 9B DC CB 1B 99 9B 5C 19 F6 9B 1C 9B 9C 3A 9B 1C 9F DC 5B FF 9B 1C 1A E3 9B 1C 47 9B 9C F7 27 9B 5C 03 98 5C 18 DC 53 3C 9A DE 7F 9F 9B 5C FF FF 98 1C 1F 5F 9B AB 5C 5C 46 98 DC 9E 5A B7 9B 9C FB 43 1F 9B DC 1D 9B 38 5B BB DE 98 58 A7 5B 5A 98 1C BB 98 D8 57 18 98 9B 1C DF 19 9B D8 46 DD 9B 1C 1C D7 B3 9B 5C BE 58 19 53 18 5C 9B 5E 98 98 06 9B D8 1C 5D 9B 9C F6 FF 53 18 DF FA 9B D8 DD 5B D8 98 58 A7 43 66 9B 18 9A 1C 9B 9C DF 9F 9B 1C 1F 99 86 9B 5C 7F 98 58 E6 07 9F 9B DC B8 5B E7 9B DC 4B DC FF 9B 9C 1F DB 63 9B 5C 9B 1C 1A 5D C6 BB 9B 9C D9 16 9B 5C B7 76 DF FD 9B 9C 93 9D 9B DC 1C 9B DC DF 9E DF 26 9B 5C 9D 9F 9E 98 58 FE 9B DC DE 9E 9B 9C 5F D8 A6 9B 18 5F 1E 9E 9B 9B DC 3C B7 66 FF 9B 9C B8 9B D8 67 5D 5A 9B 34 1A 17 F7 9B 1C 46 FB FD 9B 5C 5F BF 98 5C D6 B3 9B 1C D6 39 FB 98 5C DA 9C 5C 9B 58 3B 5B C7 98 18 5B 9D 57 FB 53 18 9D 9C F9 9B 58 DF 1E 1D 98 1C DF FF 5D 9B 18 FF 9B 5C DD 5A 98 9B 58 5B 13 59 9B 5C 9A DE 7F 9B 1C 18 26 A7 9B 1C A6 5C FD 9B 5C FF 1D 6B 9B 1C 1B 5B FF 98 9C 5A 9E 66 47 53 98 73 43 1A A7 9B 9C 23 73 9F 9B 5C EB 5A FF 9B DC F3 B3 FE 9B 1C 96 59 99 9B DC 46 9B 9C D8 DD 9B 9C 66 46 9E D9 9B 9C DD 9B 58 1A FF 9B DC DD 9B 9B 9C 9F 1B 1B 9B DC A3 9C 98 18 57 DB 9B 9C 1B 9B DC DE DE B7 B3 AB 9C 77 33 9B 9C D3 5E 9B 5C 9F D3 D9 9B 5C 5E B3 DC 9B DC 5D 9B DC DD 3E 0B 98 18 DB 5A 1D 5F 9B 9C C6 1F 5D 9E 9B 1C 9E 77 DF 9B 5C FF 5B 98 98 D9 DB 1B 9B DC 1F 33 EB 5B 5C 98 18 9A D6 98 DC 5C C3 36 9B 1C 5B 9D 98 58 1F 67 DD 9B 58 DF 1F 1C 98 9C 18 13 58 9B 5C 1C F8 9B DC DA 5B DE 9B 5C 1E 9C 27 9B 5C 53 19 9B DC 53 58 99 9D 97 FE 9B 5C 06 5B 9B DC 93 DF 1A 9B 5C 8B 9D 99 BB AB 98 DA 1F 06 9B 1C 06 1C FE FE 98 1C 5D A3 7D 1E 9B 9C 9F 9A 9B 58 9B 59 9B 58 87 19 9B 1C E6 5F 98 D8 18 5D 1C 9E 9B D8 5B 98 5C 5B 5F 1E 9B 9C B7 DC 1A 9B 9C 3A E6 3B 9B 9C 99 DB 3B 5D 9B DC FB 9B 9B 9C D8 1E 9B DC FC 9B DC DE 9B 9C 86 1E 9B DC 1C BF 9B 1C 9E 9B D8 23 76 9B DC 35 1A E7 FB 9B 5C 76 1D 98 DC 9B 5C 59 DB E3 FF 9B 9C 58 DD A6 9B DC DD D9 99 5F 38 9C E7 1E E3 9B 5C 36 D9 9B DC 9D 1F 9B DC 58 9A 9B 5C 1D 03 9B DC DA DD 59 5B 3B 53 5C 58 5B 57 B7 9B DC C7 9E 18 5F 9B 5C 76 DF 83 98 DC E6 58 33 9B 9C 1B 5A 9B 1C 1D 76 9E 9B 1C 5D 9B 1C BB FB B1 AB 9C 18 9F 9B DC DB 9B 5C 4B 2B DD 9B 9C C3 5F 9B DC 5E 7B C6 9B DC 9A DA DB BB AB 9C DB 9B DC 5D 1F D9 9B 5C 9B 9C 9D 5E D3 BB AB DC C7 1A 9B DC 5C D9 9B 1C EF 9E 9B DC 9A F9 9B 9C 5A 5C FE 9B 5C 9D 58 98 1C C6 07 76 9B 1C 1E 58 9F 9F E6 9B 5C 5E B7 9F 9B 9C 5C 1D 5D F8 9B DC 5A F9 53 5C FB DD A6 53 5C BB 9B 1C 1C 59 BB AB 1C DE 9B 9C 5A A7 FB 98 9C 99 DE 9B 1C 46 9B 1C BF 98 DC 58 98 1C 19 59 1E 33 9B DC 7D DB 9A 9B DC B6 5C 33 9B B1 AB 9C 18 26 FF 9B 9C D3 FF F6 5B 9B 9C 5C 03 9B 5C B6 9F 17 98 1C 26 9B 9B 98 5C DC E6 9B 98 DC 5D 5B 1B BB AB 9C 0B F8 9B 9C 99 DC E3 9B DC DF 1D 9B 5C FE 9B 1C 96 5A 9B 9C 57 DB 9B DC 3A D8 F8 9B 1C 5F 59 9B 1C B9 9B 98 BC E7 9F 9D 53 1C 07 5D 9B 1C AF 13 5B 9B 1C 1A DF 18 9B BC 87 2B 35 5C D9 97 5B 99 9B 9C 9B 9C 9B 9E AB 9B 1C 5E 1C 9D 99 9B 5C 9B DC D8 87 9B AB 5C 1B 9E 98 BB AB DC BD DD 19 87 9A 9B DC 1D 1E 1C 9B DC DB C7 D8 9B BC 98 A7 1B 9B 5C FF 9B 1C 18 98 9C 9C 5F B7 B6 9B 9C 3B 9B 9C 7F 19 53 9C 1A 5F 9B 9B 9C D9 DF 1A 9B FF 9B BC DE DD 9B 9C 2B C7 9B DC D9 9F FF 9B 1C DB 5E EB 9B 1C DA

Output from my Python Script Code --> image

b'\x00\xfe`\xf7\xcf\x02c3{\xc5\xe6\xe7\x00\xfb\x08\xc9\xf3\xcb\xe9\xf4\xc6~\xce\xff`\x00\n\xee2\xfb\x02\xf0\xc3\xf8\xed6\xeaa\xc8\xf0\xe0?\x0cu\xca\xf4\xfe\x06s\xc2\xf0\xf1j\x0b\xf9\xe5el:\xc0\xfe\xc3\xf0\x00h\xfc\xc5\xfd\xe4}\xc4\x05\xea4\xeb;\x04\xfb\xf3\x0b\xc9l\x0e\xc2ob5\x03\xc0\xfc\xe5vx\xef=\xf9\x01\x00d\x08\x0c\xc7\xf1\xf8d\xfa\xe1\xf1\xf69exz\xf6\xea\nw\xf1\xf2\xc6n\xec\xfe\xfe`\xf7\x00\xcf\x02c3{\xc5\xe6\xe7\x00\xfb\x08\xc9\xf3\xcb\xe9\xf4\xc6~\xce\xff`\x00\n\xee3\xff\xf6\x00\xfc\xf2\xcf\xfe\xf91\xcb\xf2mq\xf0du\xea\xf30u\xca\xffm|f\x05\xc3a`\xf9dh:z\xf75\xf9\x000\xea\xf0\x06\x0e\t\x0b}kt\rj\xcawc\xf8\xfdy\xec7\x00\x07o\xc0\xe1\xe2\xef\xc3\xcai\xce\xfb\xe0f\xc6y7\xf0\x03\xff\xfe:\xf3u{\xc5\xf9\x02y\xeaqf\xf7\x018\xfe\xfe`\xf7\xcf\x02c\x003{\xc5\xe6\xe7\x00\xfb\x08\xfe\xfe`\xf7\xcf\x02c3{\xc5\xe6\xe7\x00\xfb\x08\xc9\xf3\xcb\xe9\xf4\xc6~\xce\xff`\x00\n\xeey>\xe1c\xf8p2\x01d\xe1\xfa874\xf4\xf3\x02\xefm6t\xf8e\xf7\xca\x04\xe0\xe9\xc0\xfd\x07:\xf9\xf38\x06\xc6u\xca\xe0\xf6\xf03h{4\xf4r\xfbs\xf3i\xfa\x04\xe3\xea\xc0n<\xe9\xc1k\xf6~g\xfb\xc76\xff9\xf8|\xf0\xf1\xe2\xf9\xea:\xf4\x01\x0frt\xe4\xc4=\xf4\xe8\xc8\xc3\x04\xefb\xfe'

Image: 
UnknownExe

I hope the data can help you

Kurumi
Kurumi's picture

Hi,

Can you print data in hex and add it here?

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello,

What do you mean exactly? So the original output from Gurux or from my Python script?

So I get this output again from my Python script:

0x7ea077cf022313bb45e6e700db0849534b6974463e4e5f2000113c343fd6fc45ce3e85f848a3e8ce0a8daaf470a7f4b0cfad6371cee20ca337664a57356b5a78f341c7605f98b5b7807bf3c03da942e2fedacdd760a891ce10c30680a3e2c1575ca7f2741308bf6ca8e86d197bafa2c6238a66fc5ad791a67e

0x7ea077cf022313bb45e6e700db0849534b6974463e4e5f2000113cba00ca8f26f58af24b1b6365b8aee52886eb94f23727f1fc15cc6f0117b07ffccfd723fa29b3074d37fa21c180d567744ad94c0085031a2bcc069e7fb5f7a3a6f9b021bb745ee0a4a42f2b27651179456d6e3480c1a6637bc8d55f6b747e

0x7ea077cf022313bb45e6e700db0849534b6974463e4e5f2000113cd13153d5bee8baf72650d67088ec149b8be8ee7b5eeeddffa16353e376d635840cb267cb19f1e1d2e026dcd9a0353989ee15ef83c623fb86215ce8e7414f418b5ab51594d1f74d616691538df0ba0edb4e21b3f6db7b8b66b99db744527e

And from the Gurux I get this output (original):

python main.py -S /dev/ttyUSB1:115200:8None1 -t Verbose
gurux_dlms version: 1.0.83
gurux_net version: 1.0.17
gurux_serial version: 1.0.14
/dev/ttyUSB1:115200 8NONE1
Press any key to close the application.
Media state changed. MediaState.OPENING
Media state changed. MediaState.OPEN
trace:13:47:16 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:16 2 1C 5B 13 1E DF
New data is received. /dev/ttyUSB1:1C 5B 13 1E DF
trace:13:47:17 2 98 DC
New data is received. /dev/ttyUSB1:98 DC
trace:13:47:17 2 7F 9F 1C
New data is received. /dev/ttyUSB1:7F 9F 1C
trace:13:47:18 2 9B 9C DF 1E
New data is received. /dev/ttyUSB1:9B 9C DF 1E
trace:13:47:19 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:19 2 1C BD 16 D3 1B
New data is received. /dev/ttyUSB1:1C BD 16 D3 1B
trace:13:47:20 2 BB
New data is received. /dev/ttyUSB1:BB
trace:13:47:20 2 AB 9C 9F
New data is received. /dev/ttyUSB1:AB 9C 9F
trace:13:47:21 2 98 1C 1F 07
New data is received. /dev/ttyUSB1:98 1C 1F 07
trace:13:47:22 2 98 1C
New data is received. /dev/ttyUSB1:98 1C
trace:13:47:22 2 B7
New data is received. /dev/ttyUSB1:B7
trace:13:47:23 2 9B 5C 5A 7B
New data is received. /dev/ttyUSB1:9B 5C 5A 7B
trace:13:47:23 2 DC
New data is received. /dev/ttyUSB1:DC
trace:13:47:24 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:24 2 9C 26 1C 93
New data is received. /dev/ttyUSB1:9C 26 1C 93
trace:13:47:25 2 9B 5C DC
New data is received. /dev/ttyUSB1:9B 5C DC
trace:13:47:25 2 9A
New data is received. /dev/ttyUSB1:9A
trace:13:47:26 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:26 2 DC 9E D9
New data is received. /dev/ttyUSB1:DC 9E D9
trace:13:47:27 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:27 2 5C
New data is received. /dev/ttyUSB1:5C
trace:13:47:28 2 9B 1C 1C 1E
New data is received. /dev/ttyUSB1:9B 1C 1C 1E
trace:13:47:28 2 DB D9
New data is received. /dev/ttyUSB1:DB D9
trace:13:47:29 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:29 2 5C DB
New data is received. /dev/ttyUSB1:5C DB
trace:13:47:30 2 9B 9C 5A DB
New data is received. /dev/ttyUSB1:9B 9C 5A DB
trace:13:47:30 2 4B
New data is received. /dev/ttyUSB1:4B
trace:13:47:31 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:31 2 5C 7F 73 53
New data is received. /dev/ttyUSB1:5C 7F 73 53
trace:13:47:32 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:32 2 BC 5E 47
New data is received. /dev/ttyUSB1:BC 5E 47
trace:13:47:33 2 9B DC
New data is received. /dev/ttyUSB1:9B DC
trace:13:47:33 2 CB 5B
New data is received. /dev/ttyUSB1:CB 5B
trace:13:47:34 2 98 5C 5A 9F F7
New data is received. /dev/ttyUSB1:98 5C 5A 9F F7
trace:13:47:35 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:35 2 DC D9
New data is received. /dev/ttyUSB1:DC D9
trace:13:47:36 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:36 2 9C C6 1D
New data is received. /dev/ttyUSB1:9C C6 1D
trace:13:47:37 2 9B 3C 0B
New data is received. /dev/ttyUSB1:9B 3C 0B
trace:13:47:38 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:38 2 3E DA 1F DC 4B
New data is received. /dev/ttyUSB1:3E DA 1F DC 4B
trace:13:47:39 2 9B DC 18 1F 1A
New data is received. /dev/ttyUSB1:9B DC 18 1F 1A
trace:13:47:39 2 1D
New data is received. /dev/ttyUSB1:1D
trace:13:47:40 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:40 2 9C AB 1B
New data is received. /dev/ttyUSB1:9C AB 1B
trace:13:47:41 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:41 2 5C 1D D8
New data is received. /dev/ttyUSB1:5C 1D D8
trace:13:47:42 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:42 2 1C 5A
New data is received. /dev/ttyUSB1:1C 5A
trace:13:47:43 2 98 1C
New data is received. /dev/ttyUSB1:98 1C
trace:13:47:43 2 16 5F D7 9B
New data is received. /dev/ttyUSB1:16 5F D7 9B
trace:13:47:44 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:44 2 5C DD 9D DD
New data is received. /dev/ttyUSB1:5C DD 9D DD
trace:13:47:45 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:45 2 1C 1B
New data is received. /dev/ttyUSB1:1C 1B
trace:13:47:46 2 9B 1C B7 C6
New data is received. /dev/ttyUSB1:9B 1C B7 C6
trace:13:47:46 2 FD
New data is received. /dev/ttyUSB1:FD
trace:13:47:47 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:47 2 9C 59 5B 58
New data is received. /dev/ttyUSB1:9C 59 5B 58
trace:13:47:48 2 9B 9C 38 DE
New data is received. /dev/ttyUSB1:9B 9C 38 DE
trace:13:47:48 2 3F
New data is received. /dev/ttyUSB1:3F
trace:13:47:49 2 9B
New data is received. /dev/ttyUSB1:9B
trace:13:47:49 2 5C DD 1C 1A 1F
New data is received. /dev/ttyUSB1:5C DD 1C 1A 1F
trace:13:47:50 2 38 DC
New data is received. /dev/ttyUSB1:38 DC
trace:13:47:50 2 1C
New data is received. /dev/ttyUSB1:1C
^C
Media state changed. MediaState.CLOSING
Media state changed. MediaState.CLOSED

I hope you can help me

Unknown

UnknownExe

Hello as I see I get nice values in my Python script and a complete nonsense in the Grurux Script. How can I change this so that Grurux gets the same values?

Kind regards UnknownExe

Kurumi
Kurumi's picture

Hi,

You are right. Your Python returns correct bytes. We are checking why the serial port component returns wrong bytes, but we don't have an answer yet.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello,

I write it in my post the code of my Python script maybe it will help you to fix the problem.

Code:

import serial

ser = serial.Serial(
port="/dev/ttyUSB0",
baudrate=115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
);

in_bin = ser.read(1000)
in_hex = hex(int.from_bytes(in_bin,byteorder='big'))

print(in_hex)

ser.close()

Best regards

UnknownExe

UnknownExe

Hello and thanks for the knowledge.

I am looking forward to your answer once you have resolved this problem. I have sent you an email with my private email regarding this. you can ignore this or we can continue communicating there. Thanks again. I hope to get back to you soon :)

Sincerely, UnknownExe

Kurumi
Kurumi's picture

Hi,

This is fixed. Update gurux-serial to the version 1.0.15. There was a typo and because most of the meters are using 9600 this was not recognized before.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello, and THX

I think the problem has not yet been resolved.

My output still looks strange. I also don't find a 7E A0. Also, I only get so few characters there should normally be more data per second?

I hope you can help me with this.

Command and Output:

python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose
gurux_dlms version: 1.0.83
gurux_net version: 1.0.17
gurux_serial version: 1.0.14
/dev/ttyUSB0:115200 8NONE1
Press any key to close the application.
Media state changed. MediaState.OPENING
Media state changed. MediaState.OPEN
trace:12:55:34 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:34 2 58 9D
New data is received. /dev/ttyUSB0:58 9D
trace:12:55:35 2 98 58 9A
New data is received. /dev/ttyUSB0:98 58 9A
trace:12:55:35 2 E6 DF
New data is received. /dev/ttyUSB0:E6 DF
trace:12:55:36 2 98 D8
New data is received. /dev/ttyUSB0:98 D8
trace:12:55:36 2 9B 13
New data is received. /dev/ttyUSB0:9B 13
trace:12:55:37 2 9B D8 96 9B
New data is received. /dev/ttyUSB0:9B D8 96 9B
trace:12:55:37 2 59
New data is received. /dev/ttyUSB0:59
trace:12:55:38 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:38 2 D8 DC
New data is received. /dev/ttyUSB0:D8 DC
trace:12:55:39 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:39 2 B8 66 DD
New data is received. /dev/ttyUSB0:B8 66 DD
trace:12:55:40 2 BB AB 98 9B
New data is received. /dev/ttyUSB0:BB AB 98 9B
trace:12:55:41 2 9B 9C DD DE 59
New data is received. /dev/ttyUSB0:9B 9C DD DE 59
trace:12:55:42 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:42 2 18 18 37
New data is received. /dev/ttyUSB0:18 18 37
trace:12:55:43 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:43 2 58 A3 9B
New data is received. /dev/ttyUSB0:58 A3 9B
trace:12:55:44 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:44 2 D8
New data is received. /dev/ttyUSB0:D8
trace:12:55:45 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:45 2 98 1E AB 1F
New data is received. /dev/ttyUSB0:98 1E AB 1F
trace:12:55:46 2 9B D8 D9
New data is received. /dev/ttyUSB0:9B D8 D9
trace:12:55:47 2 98 18
New data is received. /dev/ttyUSB0:98 18
trace:12:55:47 2 9E 9A
New data is received. /dev/ttyUSB0:9E 9A
trace:12:55:48 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:48 2 98 DB 9E DB
New data is received. /dev/ttyUSB0:98 DB 9E DB
trace:12:55:49 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:49 2 18 98 5A
New data is received. /dev/ttyUSB0:18 98 5A
trace:12:55:50 2 9B 18 0B 7E 8F
New data is received. /dev/ttyUSB0:9B 18 0B 7E 8F
trace:12:55:51 2 9B D8 FB 86 86
New data is received. /dev/ttyUSB0:9B D8 FB 86 86
trace:12:55:52 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:52 2 98 98 F8
New data is received. /dev/ttyUSB0:98 98 F8
trace:12:55:53 2 9B
New data is received. /dev/ttyUSB0:9B
trace:12:55:53 2 D8 D8 5F 3B
New data is received. /dev/ttyUSB0:D8 D8 5F 3B
trace:12:55:54 2 B3 AB 5C FB 67
New data is received. /dev/ttyUSB0:B3 AB 5C FB 67
trace:12:55:54 2 3B
New data is received. /dev/ttyUSB0:3B
trace:12:55:55 2 B1
New data is received. /dev/ttyUSB0:B1
trace:12:55:55 2 AB D8 1E 18 47 FF
New data is received. /dev/ttyUSB0:AB D8 1E 18 47 FF
^C
Media state changed. MediaState.CLOSING

Kurumi
Kurumi's picture

Hi,

You are using old version. Run this in app folder.

pip install --upgrade -r requirements.txt

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and thank you 1000 times

It works now the question is how do I get this data in readable characters?

Can you help me there too?

Kurumi
Kurumi's picture

Hi,

You should see it in XML format. Check your key if you can't. Can you add output as text here?

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hello and UPDATE

If I add the key I get a structure just one that says nothing to me, you can help me understand it. Can it be that the structure is broken? Because of 'int' object has no attribute '__getitem__'

Sincerely, UnknownExe

python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose -B KEY
gurux_dlms version: 1.0.86
gurux_net version: 1.0.17
gurux_serial version: 1.0.15
/dev/ttyUSB0:115200 8NONE1
Press any key to close the application.
Media state changed. MediaState.OPENING
Media state changed. MediaState.OPEN
trace:12:21:51 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 31 2B 42 F5 37 2A E4 08 C3 DA 51 3D B6 56 0B D4 FA 19 80 B0 10 AE E3 E2 F3 C6 D4 38 07 ED 9C D7 4C 81 0D 04 77 84 DC A2 8C B2 E9 C0 5E 95 AD A5 CD 3C E5 E0 66 DF 46 A0 E8 F7 0E EF E2 B9 E7 09 D6 04 6B 2B D8 46 3F CE 59 0F 99 03 9D 64 FF 49 05 B7 6C 0E A2 C3 75 F4 4C 2D 25 B4 29 37 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 31 2B 42 F5 37 2A E4 08 C3 DA 51 3D B6 56 0B D4 FA 19 80 B0 10 AE E3 E2 F3 C6 D4 38 07 ED 9C D7 4C 81 0D 04 77 84 DC A2 8C B2 E9 C0 5E 95 AD A5 CD 3C E5 E0 66 DF 46 A0 E8 F7 0E EF E2 B9 E7 09 D6 04 6B 2B D8 46 3F CE 59 0F 99 03 9D 64 FF 49 05 B7 6C 0E A2 C3 75 F4 4C 2D 25 B4 29 37 7E
<Structure Qty="0C" >
<OctetString Value="0006190900FF" />
<OctetString Value="31313231323731373132333334" />
<OctetString Value="0C153100" />
<OctetString Value="07E4080A01" />
<UInt32 Value="060C700L" />
<UInt32 Value="01A0342L" />
<UInt32 Value="00DA233L" />
<UInt32 Value="0083486L" />
<UInt32 Value="0000000L" />
<UInt32 Value="0000BEEL" />
<OctetString Value="" />
<OctetString Value="" />
</Structure>

{
00 06 19 09 00 FF
31 31 32 31 32 37 31 37 31 32 33 33 34
0C 15 31 00
07 E4 08 0A 01
6342400
1704770
893491
537734
0
3054

}
'int' object has no attribute '__getitem__'
trace:12:21:52 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 31 2C 01 DC C9 33 E1 51 E4 A7 8D CB 22 27 E7 BD D3 1B D0 1C E7 A9 11 14 E8 17 C6 D0 51 DC F9 72 06 64 80 2B 0E 90 27 6B 31 4D 8A B6 DC 99 F8 07 6E E0 81 0D E7 A6 F7 79 67 43 BF AA 26 4D B3 64 C7 BE FD 67 BE B5 C1 CD 2F AF 14 03 EF 06 F9 95 E2 C0 C3 F6 51 63 49 EA A0 F0 9D 84 F9 6B 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 31 2C 01 DC C9 33 E1 51 E4 A7 8D CB 22 27 E7 BD D3 1B D0 1C E7 A9 11 14 E8 17 C6 D0 51 DC F9 72 06 64 80 2B 0E 90 27 6B 31 4D 8A B6 DC 99 F8 07 6E E0 81 0D E7 A6 F7 79 67 43 BF AA 26 4D B3 64 C7 BE FD 67 BE B5 C1 CD 2F AF 14 03 EF 06 F9 95 E2 C0 C3 F6 51 63 49 EA A0 F0 9D 84 F9 6B 7E
<Structure Qty="0C" >
<OctetString Value="0006190900FF" />
<OctetString Value="31313231323731373132333334" />
<OctetString Value="0C153200" />
<OctetString Value="07E4080A01" />
<UInt32 Value="060C700L" />
<UInt32 Value="01A0343L" />
<UInt32 Value="00DA233L" />
<UInt32 Value="0083486L" />
<UInt32 Value="0000000L" />
<UInt32 Value="0000BFBL" />
<OctetString Value="" />
<OctetString Value="" />
</Structure>

{
00 06 19 09 00 FF
31 31 32 31 32 37 31 37 31 32 33 33 34
0C 15 32 00
07 E4 08 0A 01
6342400
1704771
893491
537734
0
3067

}
'int' object has no attribute '__getitem__'
^C
Media state changed. MediaState.CLOSING
Media state changed. MediaState.CLOSED

UnknownExe

Hii and thanks

Yes, I think that's not an XML format right?

Best regards

UnknownExe

Output:

python main.py -S /dev/ttyUSB0:115200:8None1 -t Verbose
gurux_dlms version: 1.0.86
gurux_net version: 1.0.17
gurux_serial version: 1.0.15
/dev/ttyUSB0:115200 8NONE1
Press any key to close the application.
Media state changed. MediaState.OPENING
Media state changed. MediaState.OPEN
trace:14:44:41 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53
trace:14:44:41 2 4B 69 74 46 3E 4E 5F 20 00 15 23 AA F4 15 E7 51 4D 5F B2 17 3B 08 0D B4 6D C4 A1 C7 94 AB D6 72 AA 97 67 CA DF E9 35 7C E3 0F 14 2C 0C 71 8C 15 99 6F 64 3D 9D 24 E6 CF 55 3A 08 01 CD 5B 5A 79 68 72 21 0D 08 62 65 25 27 8F BB F9 65 94 46 CE 5F 50 E7 AA 55 CD 91 15 92 1C B9 1B 23 D4 99 FF 7D 50 DA 23 EF 22 6D 01 7E
New data is received. /dev/ttyUSB0:4B 69 74 46 3E 4E 5F 20 00 15 23 AA F4 15 E7 51 4D 5F B2 17 3B 08 0D B4 6D C4 A1 C7 94 AB D6 72 AA 97 67 CA DF E9 35 7C E3 0F 14 2C 0C 71 8C 15 99 6F 64 3D 9D 24 E6 CF 55 3A 08 01 CD 5B 5A 79 68 72 21 0D 08 62 65 25 27 8F BB F9 65 94 46 CE 5F 50 E7 AA 55 CD 91 15 92 1C B9 1B 23 D4 99 FF 7D 50 DA 23 EF 22 6D 01 7E
trace:14:44:42 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AB C7 AD 71 C0 F1 8C E0 0D 97 BA 39 5B F0 3F 16 CD 14 35 8A 53 A5 12 DC 0E FF C2 32 FC 81 8A B4 D2 7A 44 3B 39 05 40 45 E8 EC EF A4 16 9E F2 F3 64 0B DE EF A0 C8 C3 BA 33 7A CF EA F4 B7 AF C6 82 E0 73 67 D2 66 D1 C0 F0 EF 95 93 05 5A 43 53 47 3B 20 B7 85 5C E1 33 6B AD 00 03 88 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AB C7 AD 71 C0 F1 8C E0 0D 97 BA 39 5B F0 3F 16 CD 14 35 8A 53 A5 12 DC 0E FF C2 32 FC 81 8A B4 D2 7A 44 3B 39 05 40 45 E8 EC EF A4 16 9E F2 F3 64 0B DE EF A0 C8 C3 BA 33 7A CF EA F4 B7 AF C6 82 E0 73 67 D2 66 D1 C0 F0 EF 95 93 05 5A 43 53 47 3B 20 B7 85 5C E1 33 6B AD 00 03 88 7E
Invalid Command.
trace:14:44:43 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AC F0 CE AF 29 39 DE 05 85 95 F6 95 CF 32 44 33 3A 89 84 0C F5 9D D2 4E 8D B5 16 13 D5 A0 B5 1F F0 A0 DF 8A 29 21 BD 5F FB 24 81 7F 60 E8 1C 8B 58 02 19 1A 73 9E 1D 68 9D 8F 86 02 4F 1E 74 C5 92 9D 79 8B 00 4B 19 0B A2 79 3E 05 00 04 37 AC 9C 3C A9 39 BE 21 28 C5 49 98 99 02 76 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AC F0 CE AF 29 39 DE 05 85 95 F6 95 CF 32 44 33 3A 89 84 0C F5 9D D2 4E 8D B5 16 13 D5 A0 B5 1F F0 A0 DF 8A 29 21 BD 5F FB 24 81 7F 60 E8 1C 8B 58 02 19 1A 73 9E 1D 68 9D 8F 86 02 4F 1E 74 C5 92 9D 79 8B 00 4B 19 0B A2 79 3E 05 00 04 37 AC 9C 3C A9 39 BE 21 28 C5 49 98 99 02 76 7E
Invalid Command.
trace:14:44:44 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AD 2A 76 BB 34 B7 9F 41 D0 9F 5B 1A C6 B0 CC 02 5E EF 25 62 96 DC 19 1E 65 AD 82 3B 80 41 99 A4 9C 61 30 E2 AF 24 F5 20 4D 8B C6 45 52 FC 47 0B 6B EF E9 15 7B 33 35 42 6C 9B 88 CF 91 11 BF E5 63 14 F7 81 19 1A EF 76 99 1C 18 B4 59 16 11 92 07 F0 77 6B A8 74 49 67 70 40 36 D1 38 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AD 2A 76 BB 34 B7 9F 41 D0 9F 5B 1A C6 B0 CC 02 5E EF 25 62 96 DC 19 1E 65 AD 82 3B 80 41 99 A4 9C 61 30 E2 AF 24 F5 20 4D 8B C6 45 52 FC 47 0B 6B EF E9 15 7B 33 35 42 6C 9B 88 CF 91 11 BF E5 63 14 F7 81 19 1A EF 76 99 1C 18 B4 59 16 11 92 07 F0 77 6B A8 74 49 67 70 40 36 D1 38 7E
Invalid Command.
trace:14:44:45 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AE FD 2A 72 F6 53 8F FB 99 F5 C1 96 8B 24 17 F0 A8 9D 34 5D 6C 84 46 F7 0A DA C9 CE 31 6F 08 30 C1 70 6A A5 5C 43 5C B4 A2 61 5F DD F2 3F 8F 87 6C 78 3D FE 62 C1 16 D5 D2 AB 5F D8 55 59 BE 9E F9 A7 4D 31 C7 CD F4 0A FA 11 CE DA 99 B7 80 37 75 EA 71 ED 88 03 D1 3A DE 29 11 9F 1F 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AE FD 2A 72 F6 53 8F FB 99 F5 C1 96 8B 24 17 F0 A8 9D 34 5D 6C 84 46 F7 0A DA C9 CE 31 6F 08 30 C1 70 6A A5 5C 43 5C B4 A2 61 5F DD F2 3F 8F 87 6C 78 3D FE 62 C1 16 D5 D2 AB 5F D8 55 59 BE 9E F9 A7 4D 31 C7 CD F4 0A FA 11 CE DA 99 B7 80 37 75 EA 71 ED 88 03 D1 3A DE 29 11 9F 1F 7E
Invalid Command.
trace:14:44:46 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AF C4 AE 69 93 7E AA 67 7F 74 E4 36 EC 32 14 12 DC FF B5 78 37 9C F7 0B 11 97 3C 07 37 85 3A DC 5A E7 AB 14 5F CA C2 32 F5 76 EA 42 74 27 E5 E4 05 C8 94 19 42 B8 8E 5E 72 0C 59 82 C3 71 70 63 2D 04 9B 45 BE E4 1F 56 D9 26 77 8A 5F A0 F1 FC 3E DB EA D6 18 F4 A7 7F 55 E1 9E 5F 90 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 AF C4 AE 69 93 7E AA 67 7F 74 E4 36 EC 32 14 12 DC FF B5 78 37 9C F7 0B 11 97 3C 07 37 85 3A DC 5A E7 AB 14 5F CA C2 32 F5 76 EA 42 74 27 E5 E4 05 C8 94 19 42 B8 8E 5E 72 0C 59 82 C3 71 70 63 2D 04 9B 45 BE E4 1F 56 D9 26 77 8A 5F A0 F1 FC 3E DB EA D6 18 F4 A7 7F 55 E1 9E 5F 90 7E
Invalid Command.
trace:14:44:47 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 B0 B9 16 34 F9 86 EF 74 25 F6 6F 09 7B 67 AF E7 3F 4C AF 2D E0 5D 0C 91 D9 FF 3C 71 D4 7A CC 8D 21 88 9A 0D 56 9A 18 41 3E 2E C2 71 E5 0F 2C 5D 08 83 EA E7 C1 63 1A 23 F1 12 EF B2 AE DE 1A 1C F5 85 32 72 BE 11 50 8F 0A F9 19 18 48 6A 30 B4 48 CD 76 AD 9F BD 43 FB 6E 84 37 35 EE 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 B0 B9 16 34 F9 86 EF 74 25 F6 6F 09 7B 67 AF E7 3F 4C AF 2D E0 5D 0C 91 D9 FF 3C 71 D4 7A CC 8D 21 88 9A 0D 56 9A 18 41 3E 2E C2 71 E5 0F 2C 5D 08 83 EA E7 C1 63 1A 23 F1 12 EF B2 AE DE 1A 1C F5 85 32 72 BE 11 50 8F 0A F9 19 18 48 6A 30 B4 48 CD 76 AD 9F BD 43 FB 6E 84 37 35 EE 7E
Invalid Command.
trace:14:44:48 2 7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 B1 12 08 C3 C8 3B 1E A3 EB 53 F5 75 FA 40 76 4B AA DD 54 E3 42 DA 64 83 0D 9F 37 61 3F 29 78 91 CB 80 8C CD A9 22 2E 4E 9A 5A 9A 11 4E D8 E6 A8 5B 94 20 D8 78 8F 2B 45 C5 D7 BA 07 F4 AD E8 54 DD FB 13 CA BC 39 6F 49 B7 1F 57 98 4D 70 FE F7 CE 5E 8A 62 73 2B 2F 94 BE E2 EE BC 72 7E
New data is received. /dev/ttyUSB0:7E A0 77 CF 02 23 13 BB 45 E6 E7 00 DB 08 49 53 4B 69 74 46 3E 4E 5F 20 00 15 23 B1 12 08 C3 C8 3B 1E A3 EB 53 F5 75 FA 40 76 4B AA DD 54 E3 42 DA 64 83 0D 9F 37 61 3F 29 78 91 CB 80 8C CD A9 22 2E 4E 9A 5A 9A 11 4E D8 E6 A8 5B 94 20 D8 78 8F 2B 45 C5 D7 BA 07 F4 AD E8 54 DD FB 13 CA BC 39 6F 49 B7 1F 57 98 4D 70 FE F7 CE 5E 8A 62 73 2B 2F 94 BE E2 EE BC 72 7E
Decrypt failed. Invalid security suite.
^C
Media state changed. MediaState.CLOSING
Media state changed. MediaState.CLOSED

Kurumi
Kurumi's picture

Hi,
Meter is not sending list of objects and parsePushObjects fails.
Uncomment or remove after this line:
#Example is sending a list of push messages in the first parameter.

Values are XML like format at first and then values are printed.
Because there are no descriptions in the Push message, you need to know what data meter is sending.

<Structure Qty="0C" >
<OctetString Value="0006190900FF" /> This is OBIS code of the Push message.
<OctetString Value="31313231323731373132333334" /> Meter serial number: 1121271712334
<OctetString Value="0C153200" />
<OctetString Value="07E4080A01" />
<UInt32 Value="060C700L" />
<UInt32 Value="01A0343L" />
<UInt32 Value="00DA233L" />
<UInt32 Value="0083486L" />
<UInt32 Value="0000000L" />
<UInt32 Value="0000BFBL" />
<OctetString Value="" />
<OctetString Value="" />
</Structure>
BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

But what I don't understand how can I translate these values?

<Structure Qty = "0C">
<OctetString Value = "0006190900FF" /> This is OBIS code of the Push message.
<OctetString Value = "31313231323731373132333334" /> Meter serial number: 1121271712334
<OctetString Value = "0C153200" />
<OctetString Value = "07E4080A01" />
<UInt32 Value = "060C700L" />
<UInt32 Value = "01A0343L" />
<UInt32 Value = "00DA233L" />
<UInt32 Value = "0083486L" />
<UInt32 Value = "0000000L" />
<UInt32 Value = "0000BFBL" />
<OctetString Value = "" />
<OctetString Value = "" />
</Structure>

or how did you do that?

UnknownExe

Hello and thanks

So the meter serial number is correct. So these are all the values I need. So I have to include the Gurux in my script and simply pick up the print command to get the values, right? Can you please also tell me how I can get Gurux to run in my project without calling up the command on the command line? So that the values always come.

UnkownExe

Kurumi
Kurumi's picture

Hi,

Add gurux-dlms in your project. Then read value from the serial port. When you have bytes you can call getdata. Something like this:

translator = GXDLMSTranslator()
reply = None
data = GXReplyData()
notify = GXReplyData()
cl = GXDLMSClient...
while(true)
#Get data from the serial port.
try:
if not cl.getData(reply, data, notify):
reply.clear()
#If notify is fully received.
if notify.complete:
if not notify.isMoreData():
#Show received data as XML.
xml = translator.dataToXml(notify.data)
print(xml)
except Exception as ex:
print(ex)
self.notify.clear()
self.reply.clear()

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

Hii

can you help me one last time just before the breakthrough. I have these .py files in the sync_values folder. I call the get_smartmeter_gurux method from the folder. Now, in the method, exactly one data record should come out where I read the values and store them in variables and return them. What did I do wrong there?

thank you thank you thank you

Best regards

UnknownExe

Image: 
Kurumi
Kurumi's picture

Hi,

You need to read data from the serial port to the reply parameter. Now there is no data.
Something like:
reply = seria1.read()

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

UnknownExe

hi

ich glaube ich versteh das nicht ganz. Ich bekomme einen error bei seria1 and reply.clear()

ich hoffe du kannst mir da noch helfen.

def get_smartmeter_gurux():

translator = GXDLMSTranslator()
reply = seria1.read()
data = GXReplyData()
notify = GXReplyData()
cl = GXDLMSClient
#while(true):
# Get data from the serial port.
try:
if not cl.getData(reply, data, notify):
reply.clear()
# If notify is fully received.
if notify.complete:
if not notify.isMoreData():
# Show received data as XML.
xml = translator.dataToXml(notify.data)
print(xml)
except Exception as ex:
print(ex)
self.notify.clear()
self.reply.clear()

return ()