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. Read Out a Simple Obis Code With Python

Read out a simple obis code with 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 Frank G , 19 January, 2022
Forums
Gurux.DLMS

Hello Mikko,
I am trying to read out a simple attribute of one object (obiscode) using the python library.
It looks like the meter accept the SNRM and also AARQ. But I am not able to read the attribute
Would you please check this code:

client = GXDLMSClient(forAuthentication=Authentication.NONE)
client.useLogicalNameReferencing = True
client.clientAddress = 0x10
client.serverAddress = 0x4010
port = GXSerial(port="COM6")
port.open()
reader = GXDLMSReader(
client=client,
media=port,
trace=0x8,
invocationCounter=0
)

reply = GXReplyData()
data = client.snrmRequest
if data:
reader.readDLMSPacket(data, reply)
client.parseUAResponse(reply.data)
for it in client.aarqRequest():
reply.clear()
reader.readDLMSPacket(it, reply)
client.parseAareResponse(reply.data)

serial = GXDLMSData("0.0.96.1.0.255");
serial.read(obj, 2);

The Log in Hex:
Authentication: Authentication.NONE
ClientAddress: 0x10
ServerAddress: 0x4010
TX: 17:47:49 7E A0 0A 00 02 00 21 21 93 A0 C4 7E
RX: 17:47:49 7E A0 0A 21 00 02 00 21 73 FC D4 7E
TX: 17:47:49 7E A0 2E 00 02 00 21 21 10 C6 7E E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 01
BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF B3 E2 7E
RX: 17:47:49 7E A0 3A 21 00 02 00 21 30 29 72 E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01
A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 10 14 00
7D 00 07 6D C3 7E
Traceback (most recent call last):
File "
\Desktop\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\frank.py", line 52, in <module>
serial.read(obj, 2);
AttributeError: 'GXDLMSData' object has no attribute 'read'

Many Thanks
Frank

Profile picture for user Kurumi

Kurumi

4 years 6 months ago

Hi,

Hi,

Change this:

obj = GXDLMSData("0.0.96.1.0.255");
reader.read(obj, 2);

BR,
Mikko

Frank G

4 years 6 months ago

Many Thanks Mikko. it works

Many Thanks Mikko. it works now

Toni

4 years 5 months ago

Please how can I run the

Please how can I run the gurux as a script instead of the command line as seen above? Thanks

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

In reply to Please how can I run the by Toni

Hi Toni,

Hi Toni,

Please, create a new topic if you have a new question. I'll answer your question then.

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

  • 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
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More

Who's new

  • UIRlLOZQoyTZHC…
  • mpjTCKVBgHdfcCSDJDRc
  • BaEdhlfwwvUqFMkOYk
  • CrzONrPdvkWUif…
  • kra4026
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin