Thingsboard Knob Control using RPC call method keep getting the error, Unable to parse response: [object Object]. Set method works fine and only the get method at the start has this error. My message is as below and it looks fine to me. BTW - Switch control widgets works fine using the same code.
Topic: v1/devices/me/rpc/request/"id"
Message: {"method":"getValue","params":null}
Reply: {"Value":255}
if (methodName.equals("getValue")) {
String responseTopic = String(topic);
responseTopic.replace("request", "response");
mqtt.publish(responseTopic.c_str(), get_value().c_str());
}
String get_value() {
StaticJsonDocument<200> doc6;
doc6[String("Value")]=value;
char payload[200];
serializeJson(doc6, payload, sizeof(payload));
String strPayload = String(payload);
return strPayload;
}
I am using Arduino MKR Wifi 1010 to publish the MQTT response. Stuck on this for a long time. Any suggestion on how to fix this error? I do see the value reaches to the dashboard in the audit log. It seems like the knob control can not parse the json object. Is there any way to fix this in serializing the json object?