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. Get Selected Values From The Meter

Get selected values from the meter

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 James P , 8 March, 2021
Forums
Gurux.DLMS

Hi,
I'm using Gurux.DLMS Python.
Now I'm able to read the whole register it works fine but it takes a long time. Invoking self.getAssociationView() takes long time. Is it possible to get just selected values maybe by OBIS code or sth like that?
Or if it's not possible how to save getAssociationView obj to the file?

To this time I have try sth like this
test = GXDLMSClock("1.1.32.7.0.255")
self.read(test, 3)
self.read(test, 2)
print(test)

but it throws an error
File ".../Gurux.DLMS.Client.Example.python/main.py", line 105, in main
reader.readAll(settings.outputFile)
File "...\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 590, in readAll
self.read(test, 3)
File "...\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 322, in read
data = self.client.read(item, attributeIndex)[0]
File ...\GXDLMSClient.py", line 974, in read
return self._read(item.name, item.objectType, attributeOrdinal)
File "...\GXDLMSClient.py", line 963, in _read
sn += (attributeOrdinal - 1) * 8
TypeError: can only concatenate str (not "int") to str

Profile picture for user Kurumi

Kurumi

5 years 3 months ago

Hi,

Hi,

You try to read your meter using Short Name referencing. When Short Name referencing is used you must also give the short name address and it's different for each meter type. For this reason, it might be good to read the association view and save it for each different meter type.

You need to create object like this:
test = GXDLMSClock("1.1.32.7.0.255", SHORT_NAME)

You can save the association view to the file with -o parameter. Like this:
-o output.xml

BR,
Mikko

James P

5 years 3 months ago

Thank you very much for your

Thank you very much for your response, now reading selected values works fine.
How to use output.xml? sth like open("output.xml", 'r')?

Profile picture for user Kurumi

Kurumi

5 years 3 months ago

Hi,

Hi,

You can save values like this;
items = GXDLMSObjectCollection()
items.save("fileName.xml")

Load like this:

c = GXDLMSObjectCollection.load("fileName.xml")
items.extend(c)

BR,
Mikko

James P

5 years 3 months ago

I pasted those lines to

I pasted those lines to GXDLMSReader.py in ReadAll() function and in output.xml it saves just
<?xml version="1.0" ?>
<Objects/>
in first approach -o output.xml it saves associationView fine.
so when I use this output.xml like this
items = GXDLMSObjectCollection()
c = GXDLMSObjectCollection.load("output.xml")
items.extend(c)
I'm able to read whole register.

James P

5 years 3 months ago

I pasted those lines to

I pasted those lines to GXDLMSReader.py in ReadAll() function and in output.xml it saves just
<?xml version="1.0" ?>
<Objects/>
in first approach -o output.xml it saves associationView fine.
so when I use this output.xml like this
items = GXDLMSObjectCollection()
c = GXDLMSObjectCollection.load("output.xml")
items.extend(c)
I'm able to read whole register.

  • 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