Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. Reading DLMS Frame - Python

Reading DLMS frame - Python

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By jonasfoyth , 3 March, 2020
Forums
Gurux.DLMS

Hello,

I'm trying to read a dlms frame in python and convert this to xml:

b'~\xa0>)\x03v\xffd\xe6\xe7\x00\xc4\x01\xc1\x00\x01\x01\x02\x07\t\x0c\x07\xe0\x0c\r\x02\x04\x00\x00\xff\x80\x00\x00\x06\x00\x00\x04\x95\x12\x00\x00\x06\x00\x00\x00\x00\x06\x00\x00\x00\x00\x06\x00\x00\x00\x00\x06\x00\x00\x00\x00\xfb.~'

converted: 7E A0 3E 29 03 76 FF 64 E6 E7 00 C4 01 C1 00 01 01 02 07 09 0C 07 E0 0C 0D 02 04 00 00 FF 80 00 00 06 00 00 04 95 12 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 06 00 00 00 00 FB 2E 7E

First way:

data, addr = sock.recvfrom(256) # buffer size is 1024 bytes

reply = GXReplyData()
notify = GXReplyData()
client = GXDLMSClient()
client.interfaceType.HDLC

client.getData(data, reply, notify)
converted = GXDLMSTranslator()
xml = converted.dataToXml(data)

result: ValueError: Invalid data type.

error

Second way:

data, addr = sock.recvfrom(256) # buffer size is 1024 bytes
reply = GXReplyData()
notify = GXReplyData()
client = GXDLMSClient()
client.interfaceType.HDLC

rd = GXByteBuffer(data)
print("rd:", rd)
client.getData(rd, reply, notify)
converted = GXDLMSTranslator()
xml = converted.dataToXml(notify.data)

result:

xml: empty

Any sugestion?

Profile picture for user Kurumi

Kurumi

6 years 3 months ago

Hi,

Hi,

Use messageToXml for received message. Like this:

c = GXDLMSTranslator()
xml = c.messageToXml(data)

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin