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. Read Works But Read_by_range Doesn't Work For ProfileGeneric Object

read works but read_by_range doesn't work for ProfileGeneric object

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 tistepiste , 16 March, 2022
Forums
Gurux.DLMS

Dear,

I successfully created a ProfileGeneric object (in http://www.gurux.fi/node/19730) and I can also read out the contents from the buffer and capture objects using the function below:

def read(self, ln, gp):
profile_generic = GXDLMSProfileGeneric(ln)
gp.reader.read(profile_generic, 3)
gp.reader.read(profile_generic, 2)
return profile_generic

pg = reader.read(ln, gp)

I can easily read the buffer contents with this read using pg.buffer.

However, read_by_range doesn't seem to work.
read_by_range DOES work with another profile that was already set in the meter, it just doesn;t work on this specific profile

The code:

begin = datetime.datetime.now() - datetime.timedelta(days=2)
end = datetime.datetime.now() - datetime.timedelta(days=1)

def read_by_range(self, ln, begin, end, gp):
profile_generic = GXDLMSProfileGeneric(ln)
gp.reader.read(profile_generic, 3)
gp.reader.readRowsByRange(profile_generic, begin, end)
return profile_generic

pg = reader.read_by_range(ln, begin, end, gp)

There IS data for those timestamps, and this code DOES work for another profile already set in the meter.

When I throw an Exception it reads the following:
Access Error : Device reports scope of access violated.

DLMS TRACE:
TX: 15:40:08 00 01 00 01 00 01 00 0D C0 01 C1 00 07 00 00 63 01 01 FF 03 00
RX: 15:40:10 00 01 00 01 00 01 00 2A C4 01 C1 00 01 02 02 04 12 00 04 09 06 00 01 18 02 01 FF 0F 02 12 00 00 02 04 12 00 08 09 06 00 00 01 00 00 FF 0F 02 12 00 00
TX: 15:40:10 00 01 00 01 00 01 00 40 C0 01 C1 00 07 00 00 63 01 01 FF 02 01 01 02 04 02 04 12 00 04 09 06 00 01 18 02 01 FF 0F 02 12 00 00 09 0C 07 E6 03 0E 01 0F 28 05 00 00 00 00 09 0C 07 E6 03 0F 02 0F 28 05 00 00 00 00 01 00
RX: 15:40:10 00 01 00 01 00 01 00 05 C4 01 C1 01 0D

Could you help me in finding out what I might be missing?

NOTE:

In GuruxDLMSDirector I am able to read out this profile between specific dates

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

Can you add GXDLMSDirector log so I can compare the date-time values?

BR,
Mikko

tistepiste

4 years 2 months ago

I think I found the error.

I think I found the error. The buffer reads like this:

row = [19059, <gurux_dlms.GXDateTime.GXDateTime object at 0x7fa98d4d2a90>]

One row looks like what is stated above.
row[0] = value
row[1] = clock

read_by_range accesses index 0 of the capture objets and thinks that is the clock while it is not.

A solution would be for the buffer to save the values of the capture objects like this:
row = [<gurux_dlms.GXDateTime.GXDateTime object at 0x7fa98d4d2a90>, 19059]

But I am not sure how to reverse that order?

Or do I need to edit the read_by_range function, however I can't find where I can choose which capture object it reads

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi.

Hi.

All the meters that I know are adding a clock for the first column. I strongly propose that you swap clock and value.

Swap the Capture objects (value and clock) and write them back for the meter.

http://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric

BR,
Mikko

tistepiste

4 years 2 months ago

Dear,

Dear,

Thank you for your response.
Yes that is the issue I am trying to solve.

EDIT: Never mind, the code I had written to switch the columns actually works, just needed to overwrite the current stats.

  • 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