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. Trying To Configure a Profile To Store Register Values

Trying to configure a profile to store register values

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 , 24 February, 2022
Forums
Gurux.DLMS

I am trying to store values of the following register: 0.1.24.2.2.255
And store the value of it every 15 min in following profile: 0.0.99.2.0.255

What I understand is that I need to set:
capturePeriod = 900
Set a capture object to a generic profile.

I have following code but I am sure that I am missing some stuff

# Initialize a GXDLMSProfileGeneric object
profile_generic = GXDLMSProfileGeneric(ln = 0.0.99.2.0.255)

# set capture period
profile_generic.capturePeriod = 900

# add capture object
pg.addCaptureObject('0.1.24.2.2.255', 3, 0) (??)

# save
pg.capture(pg.client) (??)

I am not sure how to implement it in the correct way.
I need to do it programmatically through gurux library and Python.

Do you have any idea?

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi,

Hi,

You need to save the values after you set them.
For example, if you set capture period you need to write it to the meter using attribute #4.

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

The capture method will generate a message that asks meter to save current values for the buffer.

I'll propose that you create this with GXDLMSDirector first so you can get an idea of what to do.

BR,
Mikko

tistepiste

4 years 3 months ago

Thanks for your response.

Thanks for your response.

What is not clear to me yet is the following.

I need to do two things:
- Write register value
To set the register value, do I do it by setting a Capture Object on the ProfileGenericObject?
Using the addCaptureObject method?
- Set capture period to a meter for the register value to be written
Setting the capture method is clear I think and I believe I have set it the correct way with the code above?

To save this, I need to use the Capture method, right?
I used the capture method in the last step (# save) but it seems not to have done the work.
As attribute I gave pg.client, but possibly I didn't do this the correct way?

"The capture method will generate a message that asks meter to save current values for the buffer."
Is this a physical message that needs to be accepted?

I have a Mac so I sadly dont seem to be able to run GXDLMSDirector.

Thanks again for your initial response

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi,

Hi,

You don't write the register value. The meter does it. If the capture period is greater than zero, the meter will start automatically updating values that are defined in Capture objects.

Capture is an invoke and if you call it the current values are saved to the buffer.

Make sure that you have enough access rights to invoke the Cature.

I strongly advise that you search a Windows and play with GXDLMSDirector. It will help you to understand the DLMS meters.

BR,
Mikko

tistepiste

4 years 3 months ago

Thank you for your response,

Thank you for your response,

I am aware that I can't write the register value - I was not very clear in my previous post.
What I meant is the following; that I want to write the Register object value in the buffer of a ProfileGeneric object.

I found a windows and played around with GXDLMSDirector.

I created a profile generic object (configurable) with Logical Name: 0.0.99.1.0.255
I added two Capture Objects: Clock (0.0.1.0.0.255) and an Extended Register (0.1.24.2.1.255).
I specified the Period: 900
And clicked on 'Capture'
It gave me a message: "action accomplished'.

It seems to have worked, so now I know it is possible, thanks!

However, the actions I took through the gxdlmsdirector follow the same logic as I tried to implement in the code I showed before.

Now I understand how to create / initialize a ProfileGeneric object, and how to set a CapturePeriod.
What I don't understand is how do add a Capture Object correctly to this Profile Generic object.

I did the following, Is this the way to do it?

#Add Capture Object
pg.addCaptureObject('0.1.24.2.1.255', 2, 0) #(pg is a Profile Generic Object initialized at the start)

After adding the Capture Object, I want to capture the values of this object.
I tried to capture these values with the Capture function through:

pg.capture(gp.client)
It requires a 'Client' parameter (as see in the docs). But I am not certain that this is the way to access the client correctly.

Other than that, I need to make sure that the newly set capture objects are saved to the meter, not only saving the values of the capture objects on the moment of the capture.
I understand there is a 'write' operation involved here, however I can't seem to find out how to do it
I tried to implement it this way:

# Write capture objects
gp.reader.write(pg.captureObjects, 3)
gp.reader.write(pg.capturePeriod, 4)

________________________________________________________________________________________

My full code is this:
# Connect with meter (Authentication: LOW)
gp = reader.connect(row)

# Create ProfileGeneric object (=configurable profile)
pg = GXDLMSProfileGeneric(ln = '0.0.99.1.0.255')

# Set capture Period (900) = 15min
pg.capturePeriod = 900

# Add capture object (values of register '0.1.24.2.1.255' should be captured every 15 mins)
pg.addCaptureObject('0.1.24.2.1.255',2, 0)

# Capture method saves the new params
# pg.capture(gp.client)

# Write capture objects to meter
gp.reader.write(pg.captureObjects, 3)
gp.reader.write(pg.capturePeriod, 4)

Kind regards,

Jean-Baptiste

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi Jean-Baptiste,

Hi Jean-Baptiste,

You are adding the capture object correctly and you write it to the meter as expected. If you want to capture object values right away you can use the capture method of the profile generic object like this:

gp.readDataBlock(pg.capture(gp.client))

CapturePeriod is usually set to save values periodically.

BR,
Mikko

tistepiste

4 years 3 months ago

Dear Mikko,

Dear Mikko,

Thanks again for the response.

Sadly, writing to the meter doesn't seem to work.

Following code:
# Write capture objects to meter
gp.reader.write(pg.captureObjects, 3)

Gives following error:
AttributeError("'list' object has no attribute 'getValue'",)

Apparently it seeks for a 'getValue' attribute but I cannot seem to be successful in passing the correct parameter.

When printing out following pg.captureObjects; I get:
[('0.1.24.2.1.255', <gurux_dlms.objects....128091cf8>)]

A list of tuples with first tuple the logical name of the register, and second tuple the Capture Objects.

When passing only the Capture objects; eg: pg.captureObjects[0][1] to the write function, I get following code and error:

code:
gp.reader.write(pg.captureObjects[0][1], 3)

error:
AttributeError("'CaptureObjects' object has no attribute 'getValue'",)

Any idea on what I could be missing? I feel like this is just the last step in a correct implementation

Kind regards,

Jean-Baptiste

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi Jean-Baptiste,

Hi Jean-Baptiste,

You need to give the COSEM object as a parameter and use it like this:
gp.reader.write(pg, 3)

BR,
Mikko

tistepiste

4 years 2 months ago

Dear Mikko,

Dear Mikko,

Thanks! I got it to work.
Full code that works:

pg = GXDLMSProfileGeneric(ln = '0.0.99.1.1.255')

extended_register = GXDLMSExtendedRegister(ln = '0.1.24.2.1.255')
clock = GXDLMSClock()
pg.capturePeriod = 900

pg.addCaptureObject(clock, 2, 0)
pg.addCaptureObject(extended_register,2, 0)

gp.reader.write(pg, 4)
gp.reader.write(pg, 3)

Thanks again.

Kind regards

  • 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