Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. DLMS Python

DLMS Python

By SMarcin, 4 August, 2025
Forums
Gurux.DLMS

Hello everyone!

I've been trying to connect to LandisGyr E650 using GURUX Python library, but im having some issues (please note that i can connect via Director without an issue)

I'am able to connect to the meter using python, but when i tried to fetch some data i get this:
7ea010150352c501e6e7000ec00302d2f87e

which translates to:
<HDLC len="15" >
<TargetAddress Value="10" />
<SourceAddress Value="1" />
<!--I frame.-->
<FrameType Value="52" />
<PDU>
<ConfirmedServiceError>
<Service Value="192" />
<ServiceError>
<Service Value="ServiceUnsupported" />
</ServiceError>
</ConfirmedServiceError>
</PDU>
</HDLC>

The way i fetch data is like below:
try:
obj = GXDLMSData()
obj.logicalName = obis_code

request = client.read(obj, 2)
sock.send(bytes(request[0] if isinstance(request, list) else request))

#reply
reply = sock.recv(128)

I also get the same respone whenever i try to get association view.

Any ideas? I can post more code/info if needed.

Thank you in advance!

Profile picture for user Kurumi

Kurumi

6 months 1 week ago

Hi, You can use the client…

Hi,

You can use the client example to read your meter. You can see the correct command line arguments when you select the meter in GXDLMSDirector.

I can't tell what might cause this because the meter reply doesn't tell anything about what might be the reason.

BR,
MIkko

SMarcin

6 months 1 week ago

Hi Kurumi, I'm not really…

Hi Kurumi,

I'm not really BIG into programming (im more into PLCs), so could you please explain the process step by step?

I was able to get a proper response from the meter which in hex from looks like this:

7ea01521037469cee6e7000c010002020ffe162385427e

And using translator on the website it translates to:

<HDLC len="20" >
<TargetAddress Value="16" />
<SourceAddress Value="1" />
<!--I frame.-->
<FrameType Value="52" />
<PDU>
<ReadResponse Qty="1" >
<Data>
<Structure Qty="2" >
<Int8 Value="-2" />
<Enum Value="35" />
</Structure>
</Data>
</ReadResponse>
</PDU>
</HDLC>

Which is absolutely correct (scaler 0.01 and unit=voltage), but now i dont know how to parse this hex string into data using python.

I'am getting this hex string from this part of the code:

assoc = GXDLMSRegister()
assoc.shortName = 0xB048

#CLIENT READ 3 (SCALER + UNIT)
request_fragments = client.read(assoc, 3)

full_response = b""

fragments = request_fragments if isinstance(request_fragments, list) else [request_fragments]
for fragment in fragments:
sock.send(fragment)
response = sock.recv(4096)
full_response += response

client.updateValue(assoc, 3, full_response)

print("Assoc scaler: ", assoc.scaler)
print("Assoc unit: ", assoc.unit)

But assoc.scaler and assoc.unit values are like this when i print them:

Assoc scaler: 1.0000000000000001e+126
Assoc unit: 160

Which is wrong obviously, because they should be -2 and 35.

I also tried using:
reply = GXReplyData()
But it didnt work too

Could you please tell me how to correctly parse them step by step and which python methods should i use?

Im using PyPi gurux_dlms v1.0.189 library.
If you need more info, please ask and i will post it.

Thank you kindly in advance!

Profile picture for user Kurumi

Kurumi

6 months 1 week ago

Hi, Meter data might be…

Hi,

Meter data might be fragmented, and now you expect that it will come in one part. This works when the frame size is small and the meter is close, but it will cause problems in the long run.

You also need to parse the meter reply before calling updateValue.

Get the client example and add read after initializeConnection.

https://github.com/Gurux/Gurux.DLMS.Python/blob/fdcdb3a83ecd4ffa0b0c495…

You can do it like this:

assoc = GXDLMSRegister()
assoc.shortName = 0xB048
self.read(assoc, 2)
print("Assoc scaler: ", assoc.scaler)
print("Assoc unit: ", assoc.unit)

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Sun, 02/01/2026 - 19:47
    gurux.dlms.cpp 9.0.2602.0101
  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87

New forum topics

  • Asynchronous support in Gurux DLMS stack (.NET)?
  • Multiple meter loop On OFF Problem
  • Python GXDLMSTranslator
  • Issue with KWH Value Reading Using Gurux DLMS Library.
  • CEWE Prometer 100
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin