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. How To Get UIValues

How to get UIValues

Profile picture for user Frank
By Frank, 15 April, 2025
Forums
General discussion
Hi
is there a method to get the UIValue based on the actual
value read in the meter?

for example, I have a GXDLMSData that has a custom 
attributesettings that defines GXObisValueItem like 
for example:
GXObisValue Value is 1 and UIValue is Reset

right now I am manually matching them

GXDLMSAttributeSettings atbr = dataobj.Attributes[1]; 
if (atbr.Values.Count > 0) 
{ 
	foreach (GXObisValueItem val in atbr.Values) 
	{ 
		if (dataobj.Value != null &&
			int.TryParse(dataobj.Value.ToString(), out int parsedValue) &&
			val.Value == parsedValue) 
		{ 
			Value = val.UIValue; break; 
		} 
	} 
} 
else 
{ 
	Value = dataobj.Value?.ToString(); 
}

the issue is when there are alot more attributes with
custom ui value and if the object with custom UI value 
is captured by a ProfileGeneric object
How can I update the buffer to show the UI values 
instead of the value from the meter
Profile picture for user Kurumi

Kurumi

3 weeks 6 days ago

Hi, Set the UI data type…

Hi,

Set the UI data type like this:

dataobj.SetUIDataType(2, DataType.DateTime);
Then the data type is correct when you ask for the value like this;

dataobj.Value.ToString();

BR,
Mikko

Profile picture for user Frank

Frank

3 weeks 5 days ago

Hi Mikko I tried …

Hi Mikko

I tried

dataobj.SetUIDataType(2, DataType.None);
Value = dataobj.Value.ToString(); // for debugging

I also tried setting the datatype to uint16

but the value is still the value read from the meter
this is the xml
<GXObisCode>
<LogicalName>0.0.96.11.0.255</LogicalName>
<Description>Meter Event</Description>
<Interface>Data</Interface>
<ObjectType>1</ObjectType>
<Attributes>
<GXDLMSAttributeSettings>
<Name>Event code</Name>
<Index>2</Index>
<Type>UInt16</Type>
<Access>1</Access>
<Access3>0</Access3>
<Values>
<GXObisValueItem>
<Value>1</Value>
<UIValue>Reset</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>2</Value>
<UIValue>Power Up</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>4</Value>
<UIValue>DST</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>8</Value>
<UIValue>Push</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>16</Value>
<UIValue>Auto Connect</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>32</Value>
<UIValue>Password changed</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>64</Value>
<UIValue>Wrong password</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>128</Value>
<UIValue>Output relay state</UIValue>
</GXObisValueItem>
<GXObisValueItem>
<Value>256</Value>
<UIValue>Global meter reset</UIValue>
</GXObisValueItem>
</Values>
<UIValueType>3</UIValueType>
<AccessSelector>0</AccessSelector>
</GXDLMSAttributeSettings>
</Attributes>
</GXObisCode>

Is it possible to get the UIvalue directly from the dataObject? This object is a CaptureObject of a profile generic and the buffer shows the integers instead of the UI value

GXDirector shows the uivalue properly both in the dataobject and in the profilegeneric buffer

Edit:
Also now for some reason instead of Meter Event, the attribute name is just the default which is Value T.T

Profile picture for user Kurumi

Kurumi

3 weeks 4 days ago

Hi, With some objects, like…

Hi,

With some objects, like clock, it's possible to get the UI data type from the object.

If you want to show value as double and not integer, you need to read or set the scaler for the register object.

BR,
Mikko

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Fri, 05/09/2025 - 13:03
    Gurux.DLMS.Python 1.0.181
  • Wed, 05/07/2025 - 16:09
    Gurux.DLMS.Android 2.0.14
  • Tue, 05/06/2025 - 09:34
    gurux.dlms.c 9.0.2505.0601
  • Tue, 05/06/2025 - 08:51
    GXDLMSDirector 9.0.2505.0601
  • Tue, 05/06/2025 - 08:26
    gurux.dlms.java 4.0.79

New forum topics

  • I LOST MY CRYPTO, HOW DO I RECOVER IT? iFORCE HACKER RECOVERY
  • GXNet python implementation hangs on close
  • Conexión Landis ZMG310 Protocolo IEC
  • I need function of below OBIS code
  • How communicating with meter using proparatory command
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin