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

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin