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. Node
  3. Set/Write OctetString Type Objects

Set/Write OctetString type objects

By Mahaveer , 2 July, 2024
Forums
Gurux.Net

Hi Team,

I am writing value to Last Token Recharge Time: 0.0.94.96.22.255 in meter with data (02/07/2024 10:30:40 AM) which is with data type OctetString, but I am getting an error as
Access Error : Device reports a inconsistent Class or object.

I am using below code for write value.

GXReplyData reply = new GXReplyData();
GXDLMSObject obj = Client.Objects.FindByLN(ObjectType.Data, "0.0.94.96.22.255");
((GXDLMSData)obj).Value = "02/07/2024 10:30:40 AM";
ReadDataBlock(Client.Write(obj, 2), reply);

Can you please guide me to set the value in a given object, here the datatype is OctetString and the value in datetime format. I also tried to set with datetime datatype, array, byte. but nothing is working and getting the same error as above.

Thanks

Profile picture for user Kurumi

Kurumi

2 years 2 months ago

Hi, At first, read the value…

Hi,

At first, read the value. It will update the data type. Then try to write the value back to the meter. When it works you can update the new date time like this:

((GXDLMSData)obj).Value = new GXDateTime("02/07/2024 10:30:40 AM");

BR,
Mikko

Mahaveer

2 years 2 months ago

Hi Kurumi, Thanks for your…

Hi Kurumi,

Thanks for your response and now it's working fine.

Can you please guide me one thing in c# using gurux library how can we convert datetime value to OctetString.

I want to convert this [07/02/2024 06:43:30 AM]
to
"07 E7 0C 18 FF 00 00 00 FF 01 4A FF"

Regards,
Mahaveer Prajapati

Profile picture for user Kurumi

Kurumi

2 years 2 months ago

Hi, You can use GXDateTime…

Hi,

You can use GXDateTime.ToHex method for that.

BR,
Mikko

Mahaveer

2 years 2 months ago

Thanks a lot Kurumi for your…

Thanks a lot Kurumi for your quick response.
I tried your given code and it's working as I was expecting.

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 08/26/2026 - 09:04
    Gurux.DLMS.Python 1.0.203
  • Mon, 08/17/2026 - 11:28
    Gurux.DLMS.Python 1.0.202
  • Mon, 08/17/2026 - 09:47
    gurux.dlms.cpp 9.0.2608.1701
  • Mon, 08/17/2026 - 09:25
    gurux.dlms.c 9.0.2608.1701
  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701

New forum topics

  • Security vulnerability report — request for a private contact (GuruxDLMS.c / ANSI C)
  • Topic: Insufficient Memory Error When Reading Class 7 Profile Generic Objects
  • SN ReadResponse returns all-null values when response spans multiple HDLC frames
  • Gurux.Serial.Android 3.0.6 – CH340 (HL-340) USB-Serial Adapter Not Working,
  • Trying to talk to a L&G E360 meter (Using Python Gurux)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin