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. Manufacturer Serial Number Not Parsing

Manufacturer Serial Number Not Parsing

By hhkx , 7 April, 2023
Forums
Gurux.DLMS

Hi,

I am reading 0.0.96.1.0.255, ObjectType.Data but result is not parsing data it is showing as HEX:

96.1.0(36 30 33 38 33 30 33 30)
1.0.0(23-04-07,12:43)(-180)(Ok)(23-03-01,02:00)(23-10-01,03:00)(0)(False)(Crystal)

Code:

GXDLMSObject obj = GXDLMSClient.CreateObject(ObjectType.Data);
obj.Version = 0;
obj.LogicalName = "0.0.96.1.0.255";
Client.Objects.Add(obj);
Reader.GetScalersAndUnits();
Reader.GetReadOut();

/////
public void GetReadOut()
{

var result = new List<KeyValuePair<GXDLMSObject, object>>();

foreach (GXDLMSObject it in _settings.Client.Objects)
{
// Profile generics are read later because they are special cases.
// (There might be so lots of data and we so not want waste time to read all the data.)
if (it is GXDLMSProfileGeneric)
{
continue;
}
if (!(it is IGXDLMSBase))
{
//If interface is not implemented.
//Example manufacturer spesific interface.
if (_settings.Trace > TraceLevel.Error)
{
Console.WriteLine("Unknown Interface: " + it.ObjectType.ToString());
}
continue;
}
if (_settings.Trace > TraceLevel.Warning)
{
Console.WriteLine("-------- Reading " + it.GetType().Name + " " + it.Name + " " + it.Description);
}
foreach (int pos in (it as IGXDLMSBase).GetAttributeIndexToRead(false))
{
if (pos == 1)
{
continue;
}
try
{
object val = Read(it, pos);
result.Add(new KeyValuePair<GXDLMSObject, object>(it, ShowValue(val, pos)));
}
catch (Exception ex)
{
Console.WriteLine("Error! " + it.GetType().Name + " " + it.Name + "Index: " + pos + " " + ex.Message);
Console.WriteLine(ex.ToString());
}
}
}
Console.WriteLine($"result readout: {result.Count}");
}

Profile picture for user Kurumi

Kurumi

3 years 2 months ago

Hi, It looks like you are…

Hi,

It looks like you are reading your meter using IEC 62056-21 and not DLMS.
https://www.gurux.fi/DLMSCOSEMFAQ

BR,
Mikko

hhkx

3 years 2 months ago

Hi Mikko, I am using Gx dlms…

Hi Mikko,

I am using Gx dlms.net read methods. I can read other meter brand properly. Should I do some any other settings? By the way GXDlmsDirector can read also properly.

Read scalers and units from the device.
-------- Reading GXDLMSData 0.0.96.1.0.255
TX: 16:58:16 00 01 00 01 00 01 00 0D C0 01 C1 00 01 00 00 60 01 00 FF 02 00
RX: 16:58:16 00 01 00 01 00 01 00 0E C4 01 C1 00 09 08 36 30 33 38 33 30 33 30
Index: 2 Value: 36 30 33 38 33 30 33 30

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, I'm not quite sure what…

Hi,

I'm not quite sure what you mean by this:
96.1.0(36 30 33 38 33 30 33 30)
1.0.0(23-04-07,12:43)(-180)(Ok)(23-03-01,02:00)(23-10-01,03:00)(0)(False)(Crystal)

You are reading the Ch. 0 Device ID 1, manufacturing number and meter returns it as a hex. You can convert it to the string by setting UIType to string like this:

GXDLMSData obj = new GXDLMSData("0.0.96.1.0.255");
obj.SetUIDataType(DataType.String);

BR,
Mikko

hhkx

3 years 1 month ago

Hi Mikko, This is the way I…

Hi Mikko,

This is the way I made them written. The main issue is when I read Device Id it returns me the hex value instead of ASCII from ShowValue(it,pos) method.

On a meter of another brand, I can properly get the ASCII value with the same code.

hhkx

3 years 1 month ago

Hi again, In the below code,…

Hi again,

In the below code, on the last if block, reply.DataType comes OctetString. Is it because od the meter itself?

public object Read(GXDLMSObject it, int attributeIndex)
{
GXReplyData reply = new GXReplyData();
if (!ReadDataBlock(_settings.Client.Read(it, attributeIndex), reply))
{
if (reply.Error != (short)ErrorCode.Rejected)
{
throw new GXDLMSException(reply.Error);
}
reply.Clear();
Thread.Sleep(1000);
if (!ReadDataBlock(_settings.Client.Read(it, attributeIndex), reply))
{
throw new GXDLMSException(reply.Error);
}
}
//Update data type.
if (it.GetDataType(attributeIndex) == DataType.None)
{
it.SetDataType(attributeIndex, reply.DataType);
}
return _settings.Client.UpdateValue(it, attributeIndex, reply.Value);
}

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, The Device ID is usually…

Hi,

The Device ID is usually an octect-string, but it can also be string. You need to tell the library that this is shown in string and not in hex string. For this reason you need to add this like after you have created the object.

obj.SetUIDataType(DataType.String);

BR,
Mikko

hhkx

3 years 1 month ago

Okay it seems I should write…

Okay it seems I should write an if block for this register.

But I am wondering how Gurux Dlms Director shows this as string? Does it have the similar if block?

Thanks.

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, Parse objects will…

Hi,

Parse objects will handle this. It will update the description and common data types.
You can do it like this:

GXDLMSConverter c = new GXDLMSConverter(Standard);
c.UpdateOBISCodeInformation(Client.Objects);

BR,
Mikko

hhkx

3 years 1 month ago

Hi, Okay that's good. I put…

Hi,

Okay that's good. I put that line of code after GetScalersAndUnits part.

But which registers will be updated? Does it cause any wrong data value?

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, It'll updates all the…

Hi,

It'll updates all the COSEM objects that are given to it. It will only update the description and UI types for some objects. It doen't cause wrong data value.

BR,
Mikko

hhkx

3 years 1 month ago

Hi Mikko, Thank you for your…

Hi Mikko,

Thank you for your support. It is perfect to know, fixed my issue.

  • 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
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin