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

1 year 5 months 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

1 year 5 months 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

  • 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