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. No Data With Cl_readList() Response

No data with cl_readList() response

By tfo_develco , 30 August, 2023
Forums
Gurux.DLMS

I'm trying to read a list of register with cl_readList (GuruxDLMS.c). I based my function on the GuruxDLMSClientExample. The reply from the meter is:
PDU: c403c1040104010401040104

<GetResponse>
<GetResponseWithList>
<!--Priority: HIGH ServiceClass: CONFIRMED invokeID: 1-->
<InvokeIdAndPriority Value="C1" />
<Result Qty="04" >
</Result>
</GetResponseWithList>
</GetResponse>

So appearently no actually register data and reply_isMoreData(&reply) is false.
What am I missing? (I'm using HighGMAC authentication.)

BR, Thomas Fogh

static DLMS_ERROR_CODE ReadRegisters(void)
{
gxArray list;
message messages;
gxReplyData reply;
DLMS_ERROR_CODE ret = DLMS_ERROR_CODE_OK;
gxByteBuffer bb, rr;

gxDataInfo info;
dlmsVARIANT value;

ESP_LOGD(METER_TAG, "ReadRegisters");

arr_init(&list);

arr_push(&list, key_init("0.1.96.8.0.255", (void *)2)); // Ch. 1 Time of operation, total
arr_push(&list, key_init("1.1.14.7.0.255", (void *)2)); // Ch. 1 Supply frequency Inst. value
arr_push(&list, key_init("1.1.13.7.0.255", (void *)2)); // Ch. 1 Sum Li Power factor Inst. value
arr_push(&list, key_init("1.1.32.7.0.255", (void *)2)); // Ch. 1 L1 Voltage Inst. value

mes_init(&messages);
if ((ret = cl_readList(&mvDlmsSettings, &list, &messages)) != 0)
{
ESP_LOGE(METER_TAG, "ReadList failed %s", hlp_getErrorMessage(ret));
}
else
{
uint8_t pos;

reply_init(&reply);
// NOTE! Set ignore value to true because list is parsed differently than normal read.
reply.ignoreValue = 1;
BYTE_BUFFER_INIT(&rr);
BYTE_BUFFER_INIT(&bb);
// Send data.
for (pos = 0; pos != messages.size; ++pos)
{
// Send data.
reply_clear(&reply);
if ((ret = HandleDLMSPacket(messages.data[pos], &reply)) != DLMS_ERROR_CODE_OK)
{
ESP_LOGE(METER_TAG, "HandleDLMSPacket failed %s", hlp_getErrorMessage(ret));
break;
}

// Check is there errors or more data from server
while (reply_isMoreData(&reply))
{
ESP_LOGD(METER_TAG, "reply_isMoreData");
// NOTE! Set ignore value to true because list is parsed differently than normal read.
reply.ignoreValue = 1;
//mvDlmsSettings.cipher.invocationCounter = ++invocationCounter;
if ((ret = cl_receiverReady(&mvDlmsSettings, reply.moreData, &rr)) != DLMS_ERROR_CODE_OK ||
(ret = HandleDLMSPacket(&rr, &reply)) != DLMS_ERROR_CODE_OK)
{
ESP_LOGE(METER_TAG, "MoreData HandleDLMSPacket failed %s", hlp_getErrorMessage(ret));
break;
}
bb_clear(&rr);
}
bb_set2(&bb, &reply.data, reply.data.position, -1);
}
if (ret == 0)
{
ESP_LOGD(METER_TAG, "bb.size: %u", bb.size);
}
bb_clear(&bb);
bb_clear(&rr);
reply_clear(&reply);
}
mes_clear(&messages);

arr_clear(&list);

return ret;
}

Profile picture for user Kurumi

Kurumi

2 years 9 months ago

Hi, You need to add COSEM…

Hi,

You need to add COSEM object for the list, not the OBIS codes.
Something like this:

gxRegister r1, r2;
cosem_init(BASE(r1), DLMS_OBJECT_TYPE_REGISTER, "0.1.96.8.0.255");
cosem_init(BASE(r2), DLMS_OBJECT_TYPE_REGISTER, "1.1.14.7.0.255");

arr_init(&list);
arr_push(&list, key_init(BASE(r1), (void *)2)); // Ch. 1 Time of operation, total
arr_push(&list, key_init(BASE(r2), (void *)2)); // Ch. 1 Supply frequency Inst.

BR,
Mikko

tfo_develco

2 years 9 months ago

Hi Mikko, It's working now. …

Hi Mikko,

It's working now. :)

Thanks!

BR, Thomas

  • 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