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 8 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

  • Thu, 11/19/2026 - 10:57
    Gurux.DLMS.Python 1.0.204
  • Thu, 11/19/2026 - 10:12
    gurux.dlms.c 9.0.2611.1901
  • Tue, 10/13/2026 - 12:00
    gurux.dlms.java 4.0.97
  • Tue, 09/22/2026 - 14:02
    Gurux.DLMS.Net 9.0.2609.2201
  • Mon, 09/21/2026 - 10:18
    Gurux.DLMS.Net 9.0.2609.2101

New forum topics

  • Landis E650 meter reading over DLMS
  • class_id = 40, version = 2, pushsetup Unparsed data frame
  • GXObisValueItem entries without MaskSize appear to be interpreted as bit flags
  • CheckedListBox incorrectly selects GXObisValueItem Value=0 for non-zero values
  • UIValueType=TextBox is rendered as CheckedListBox when Values are defined
More

Who's new

  • Sayang
  • q80435762@gmail.com
  • ONCAK
  • Berhasil
  • ratirvivege1979
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin