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

10 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

10 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

  • Wed, 10/29/2025 - 08:51
    gurux.dlms.c 9.0.2510.2901
  • Thu, 10/16/2025 - 09:59
    gurux.dlms.java 4.0.83
  • Wed, 10/08/2025 - 10:21
    gurux.dlms.c 9.0.2510.0801
  • Fri, 09/26/2025 - 10:02
    gurux.dlms.cpp 9.0.2509.2601
  • Fri, 09/26/2025 - 09:45
    gurux.dlms.c 9.0.2509.2601

New forum topics

  • Guidance on using the source codes
  • How to get/convert user readable format data from readRowsByRange
  • Insufficient memory to continue the execution of the program.
  • The client instance code failed to connect to the electricity meter for authentication
  • Unable to Release Request when closing connection with meter.
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin