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. 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

1 year 11 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

1 year 11 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

1 year 11 months ago

Hi, You can use GXDateTime…

Hi,

You can use GXDateTime.ToHex method for that.

BR,
Mikko

Mahaveer

1 year 11 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

  • 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