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

11 months 2 weeks 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

11 months 2 weeks 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

11 months 2 weeks ago

Hi, You can use GXDateTime…

Hi,

You can use GXDateTime.ToHex method for that.

BR,
Mikko

Mahaveer

11 months 2 weeks 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.

  • 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