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. "Error: Get Data Type Failed, Invalid Attribute To Write Ip Address"

"Error: Get Data Type failed, Invalid attribute to write Ip address"

By sirishalv72@gm…, 17 January, 2025
Forums
Gurux DLMS for ANSI C++

Hi everyone,

I'm encountering an issue while trying to write an IPv6 address as a structure using C# and the GXDLMS library. The error message I'm receiving is:

Get Data Type failed, Invalid attribute

I'm confident that the attribute is correct Here’s the code I'm using:csharp

string ipv6Address = "2401:8800:0e11::2"; // Example: Replace with your dynamic IPv6 address

if (!System.Net.IPAddress.TryParse(ipv6Address, out System.Net.IPAddress parsedAddress))
{
throw new ArgumentException("Invalid IPv6 address format.");
}

byte[] addressBytes = parsedAddress.GetAddressBytes();

List<object> structureItems = new List<object>();
foreach (byte b in addressBytes)
{
structureItems.Add(b); // Add each byte as an item in the structure
}

GXDLMSData ipAddressObject = new GXDLMSData(obj.LogicalName)
{
Value = structureItems // Assign the structure to the Value property
};

conn.ReadDataBlock(Client.Write(ipAddressObject, 3), reply); // Attempting to write the IPv6 address
The attribute is correct, and the data type is indeed a structure. Despite this, I keep getting the error that the attribute is invalid when trying to write the data.

Has anyone experienced this issue before, or can anyone suggest where the problem might lie? Any advice would be greatly appreciated!

Thanks in advance

Profile picture for user Kurumi

Kurumi

4 months 3 weeks ago

Hi, Your structureItems …

Hi,

Your structureItems data type is an object list and it won't work.

Try to read the value with GXDLMSDirector and then write it back.
I believe that your data is more like:

GXDLMSData ipAddressObject = new GXDLMSData(obj.LogicalName)
{
Value = addressBytes
};

The data object value attribute index is #2, not #3. You need to change this line:
conn.ReadDataBlock(Client.Write(ipAddressObject, 2), reply);

BR,
Mikko

sirishalv72@gm…

4 months 3 weeks ago

reply.Clear(); string…

reply.Clear();
string ipv6Address = "xxx.xxx.xxx";
// Convert the IPv6 address to a byte array.
if (!System.Net.IPAddress.TryParse(ipv6Address, out var address) || address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
{
throw new ArgumentException("Invalid IPv6 address format.");
}
byte[] ipv6Bytes = address.GetAddressBytes();
//conn.ReadDataBlock(Client.Write(objData, 3),reply);
GXDLMSData ipAddressObject = new GXDLMSData(obj.LogicalName)
{
Value = address.GetAddressBytes()
};

conn.ReadDataBlock(Client.Write(ipAddressObject, 2), reply);

still throwing exception-Insufficient memory to continue the execution of the program.

Profile picture for user Kurumi

Kurumi

4 months 3 weeks ago

Hi, It's not possible to say…

Hi,

It's not possible to say what might cause this because I don't know what you try to write and where you get the error. I also don't know in what format your meter wants the IP adddress.

Check that your IPv6 address is correct and try to read the value from the meter first. Try to write the value with GXDLMSDirector. I believe it will help you to understand DLMS data structures.

BR,
Mikko

sirishalv72@gm…

4 months 3 weeks ago

Hi, A meter should send data…

Hi,
A meter should send data to the Head-End System (HES) server every 15 minutes. To achieve this, I am configuring the Destination IP address in the HES using the DLMS .NET Library in C#.

Could you help modify my C# code to properly configure the Destination IP address for communication via DLMS?

Thanks in advance

Profile picture for user Kurumi

Kurumi

4 months 3 weeks ago

Hi, I believe that you need…

Hi,

I believe that you need to set the destination address to the push object.
Read the association view with GDDLMSDirector. Then select the push object that you want to modify and set the new IP address.

Check Send destination and method:

https://gurux.fi/Gurux.DLMS.Objects.GXDLMSPushSetup

BR,
Mikko

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

Hire Us!

Latest Releases

  • Thu, 06/19/2025 - 09:33
    Gurux.DLMS.Python 1.0.185
  • Wed, 06/18/2025 - 15:11
    Gurux.DLMS.Python 1.0.184
  • Wed, 06/18/2025 - 10:05
    Gurux.DLMS.Python 1.0.183
  • Wed, 06/18/2025 - 09:06
    GXDLMSDirector 9.0.2506.1801
  • Wed, 06/18/2025 - 08:41
    Gurux.DLMS.Net 9.0.2506.1801

New forum topics

  • Unable to read parameter values from Landis+Gyr E550 meter using GXDLMSDirector - NoAccess status
  • data.SetComplete(false); But all data recieved
  • Crash (endless loop)
  • Server is not able to download object list with maxPduSize 64 or 128 (or anything below 156-bytes PDU size)
  • Day profile action item add error (String is not recognized as valid DateTime value)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin