Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Getting Attribute Values Stored In GXDLMSObjects Per Attribute(GXDLMSAttributeSettings )

Getting attribute values stored in GXDLMSObjects per attribute(GXDLMSAttributeSettings )

Profile picture for user Frank
By Frank, 3 March, 2025
Forums
General discussion

Hi!

I have no problem getting the GXDLMSObject, casting it to a more specific object by objectType, and getting the stored/read values from the meter.

However, I want to get the values per attribute in the GXAttributeCollection Attributes property of the GXDLMSObject, not the exposed data stored in the other object properties such as LogicalName, Value etc.

I have tried to debug and explore the contents of an GXDLMSObject
before and after reading, before and after casting to a more specific object like GXDLMSData but the value in GXDLMSAttributeSettings in the GXAttributeCollection of the object is always empty.

What i want to do is to get the value per attribute easily bindable to a control without creating wrappers and such

For example to display,
Attribute Name | Attribute Index | Value | Access Rights

i see the object GetValue(GXDLMSSettings settings, ValueEventArgs e) from the IGXDLMSBase but i dont know where the valueeventargs comefrom or hwo to mock it to get a value for a specific attribute

Profile picture for user Frank

Frank

8 months 2 weeks ago

Update: I was able to get…

Update:

I was able to get the values via
var val = (obj as IGXDLMSBase).GetValue(dev.Comm.client.Settings, new Gurux.DLMS.ValueEventArgs(obj, index, index, null));

im a little confused tho since some vals return byte[] some return strings

i am a little confused as to what the selector is for in the valueeventargs

Profile picture for user Kurumi

Kurumi

8 months 2 weeks ago

Hi, The attribute value…

Hi,

The attribute value depends on the COSEM object type. GetValue returns the value that is written to the meter.

I believe that the best approach for you is to use the GetValues method and then get the value using the attribute index to get the attribute value.

BR,
Mikko

Profile picture for user Frank

Frank

8 months 2 weeks ago

Hi thank you for the reply…

Hi thank you for the reply

ive decided to do so right now and just get the object item based on the attribute index

i didnt want to do this because ive had cases where some objects dont show the LN in the getvalues method so the object index and attribute index are off by 1 but ive tested it again and ive yet to encounter it
I'll add it here if I ever encounter it again and can be replicated

Profile picture for user Kurumi

Kurumi

8 months 2 weeks ago

Hi, You can get the logical…

Hi,

You can get the logical name of the COSEM object from attribute index #1. You just need to decrease the attribute index by one to get the object index.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 11/13/2025 - 15:23
    Gurux.DLMS.Python 1.0.192
  • Thu, 11/13/2025 - 14:55
    gurux.dlms.java 4.0.84
  • Wed, 10/29/2025 - 08:51
    gurux.dlms.c 9.0.2510.2901
  • Thu, 10/16/2025 - 09:59
    gurux.dlms.java 4.0.83
  • Wed, 10/08/2025 - 10:21
    gurux.dlms.c 9.0.2510.0801

New forum topics

  • how to get attribute 2 type for GXDLMSData object in python
  • Guidance on using the source codes
  • How to get/convert user readable format data from readRowsByRange
  • Insufficient memory to continue the execution of the program.
  • The client instance code failed to connect to the electricity meter for authentication
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin