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. Unable To Parse Billing Date Object Values When Reading Billing Profile.

Unable to parse Billing Date object values when reading Billing Profile.

By saraf_kshitiz, 9 January, 2025
Forums
Gurux DLMS for Android

Hi Mikko Kurumi Sir, 
I'm unable to parse the hex values of Billing Date object when I'm reading Billing Profile from the meter. 
I'm getting readings like this :- 

Entries: 4/13 
0.0.0.1.2.255 Billing Date 
07 E9 01 06 01 12 1C 30 FF 80 00 00 
07 E9 01 01 03 00 00 00 FF 80 00 00 

Here's my code :- 

        for (Object rows : cells) {
            sb = new StringBuilder();
            index = 0;
            for (Object cell : (Object[]) rows) {
                if (cell instanceof byte[]) {
                    sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
                } else {
                    // If voltage attribute is there in the data
                    if (voltageFlag) {
                        if (index == voltageIndex) cell = getCorrectVoltage(cell);
                    }
                    sb.append(cell).append(" | ");
                }
                index++;
            }
            if (ObisCodesMapping.profileGenericScalers.contains(pg.getLogicalName()))
                processScalerPgData(sb);
            writeTraceCSV(sb.toString());
        }
        showSnackBar(mContext);

I believe the if condition is running the statement : sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
The bytes are converted to hex values, how do I parse this to datetime? 

Waiting for your response. 
Thanks, 
Kshitiz. 

Profile picture for user Kurumi

Kurumi

5 months 1 week ago

Hi Kshitiz, The date-time…

Hi Kshitiz,

The date-time should be changed automatically if the capture object is a clock.
You can also change bytes to date-time like this:

GXDLMSClient.changeType((byte[])cell, ObjectType.DATE_TIME);

BR,
Mikko

saraf_kshitiz

5 months 1 week ago

Hi Mikko Sir, Your given…

Hi Mikko Sir, 
Your given code works fine and gives parsed datetime value for billing date. 
You've been a great help and support. 
There's just a minor update, DataType.DATETIME is used instead the parameter you gave. The code that worked for me looks like :-

                if (cell instanceof byte[]) {
String s1 = GXDLMSClient.changeType(
(byte[]) cell, DataType.DATETIME
).toString();
Log.d(TAG, "interateTableValues: s1: " + s1);

sb.append(s1).append(" | ");
// sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
} else {
 

Thanks, 
Kshitiz

  • 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

  • HLS GMAC L+G 570
  • 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)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin