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. 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 4 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

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
More

Who's new

  • Duaneduh
  • ClaytonPap
  • sAYgntkdaTjhgpvfz
  • HenryEneno
  • ScottCab
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin