thingsboard-client-sdk icon indicating copy to clipboard operation
thingsboard-client-sdk copied to clipboard

RPC request & subscription, Shared Attribute request & subscription, and Provisioning are not functioning v0.16.0

Open BatuhanKaratas opened this issue 5 months ago • 3 comments

Hi,

This issue is observed while using the following fork: 👉 https://github.com/MathewHDYT/thingsboard-client-sdk with HEAD set to commit 9c0009842ca1bf768f2494b3c411a9f33f876fb9.

Tests were performed directly using the example applications in the repository (not in a custom project) to ensure accuracy.

Platform:

  • ESP32-S3
  • ESP-IDF v5.5

🔧 Observed Issues:

  1. RPC Request
Client_Side_RPC<MAX_RPC_SUBSCRIPTIONS, MAX_RPC_REQUEST> rpc_request;
RPC_Request_Callback callback(RPC_REQUEST_CALLBACK_METHOD_NAME, &processTime, nullptr, REQUEST_TIMEOUT_MICROSECONDS, &requestTimedOut);
rpc_request.RPC_Request(callback);

Log:

I (00:01:28.777) ThingsBoard: Subscribing the given topic (v1/devices/me/rpc/response/+) failed

2. RPC Subscription

Server_Side_RPC<MAX_RPC_SUBSCRIPTIONS, MAX_RPC_RESPONSE> rpc;
rpc.RPC_Subscribe(RPC_Callback{RPC_OTA_METHOD_NAME.data(), &processRPCOTARequest});
Although the subscription call returns success and no error is reported in the logs, the callback is never triggered when an RPC request is sent from the server.

3. Shared Attribute Request

Attribute_Request<1U, NUMBER_OF_MAX_ATTR> attr_request;
constexpr std::array<const char*, 1> REQUESTED_SHARED_ATTRIBUTES = {CCSHA_KEY};
const Attribute_Request_Callback<NUMBER_OF_MAX_ATTR> sharedCallback(&processSharedAttributeRequest, 5000U * 1000U, &requestTimedOutCB, REQUESTED_SHARED_ATTRIBUTES);
attr_request.Shared_Attributes_Request(sharedCallback);

Log: I (00:01:29.278) ThingsBoard: Subscribing the given topic (v1/devices/me/attributes/response/+) failed

4. Provisioning

const Provision_Callback provisionCallback(Access_Token(), &processProvisionResponse, PROVISION_DEVICE_KEY, PROVISION_DEVICE_SECRET, s_DeviceName.c_str(), PROVISION_REQUEST_TIMEOUT_MICROSECONDS, &requestTimedOut);
Provision<> m_Prov;
m_Prov.Provision_Request(provisionCallback);

Result: Returns false and provisioning fails.

Working:

  • MQTT connection
  • Sending telemetry
  • Sending client attributes (not shared)

🔁 Additional Note: When I checkout commit d1709fbaaef0c4b305af35db795905cb09dba3c4, the Shared Attribute Request starts working correctly again. Let me know if any other details are needed to reproduce or debug the issue.

Thanks!

BatuhanKaratas avatar Aug 04 '25 09:08 BatuhanKaratas

I'm not sure it's the same issue, but I think I'm seeing this as well.

I'm not using any fork, just the normal library version 0.15.0.

Strangely when there is no MQTT connection, it actually says

[TB] Subscribing the given topic (v1/devices/me/rpc/request/+) failed

as if it is trying, but when there is an MQTT connection, it simply won't subscribe to v1/devices/me/rpc/request/+. I confirmed this by watching the MQTT traffic in Wireshark.

AndreKR avatar Sep 26 '25 20:09 AndreKR

Oookay, I found something strange.

If I initialize like this:

OTA_Firmware_Update<> ota;
Server_Side_RPC<> rpc;
const std::array<IAPI_Implementation*, 2U> apis = { &rpc, &ota };
ThingsBoard tb(mqttClient, MAX_MESSAGE_RECEIVE_SIZE, MAX_MESSAGE_SEND_SIZE, Default_Max_Stack_Size, Default_Max_Response_Size, apis.cbegin(), apis.cend());

then it works.

But if I swap them around:

const std::array<IAPI_Implementation*, 2U> apis = { &ota, &rpc };

with &ota first, then &rpc, then I no longer get a subscription to v1/devices/me/rpc/request/+.

AndreKR avatar Sep 26 '25 21:09 AndreKR

I noticed the same issue while trying @MathewHDYT 's fork. I think it probably stopped working at https://github.com/MathewHDYT/thingsboard-client-sdk/commit/8a6038cde3285c0c51cdb203d328d3221fd4642b because the use of the Container class, but I can't confirm it. Dear @MathewHDYT, have you any plan to continue supporting the code? Thank you.

alkonosst avatar Nov 20 '25 16:11 alkonosst