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

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

  • Sun, 02/01/2026 - 19:47
    gurux.dlms.cpp 9.0.2602.0101
  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87

New forum topics

  • Asynchronous support in Gurux DLMS stack (.NET)?
  • Multiple meter loop On OFF Problem
  • Python GXDLMSTranslator
  • Issue with KWH Value Reading Using Gurux DLMS Library.
  • CEWE Prometer 100
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin