Photon with thingsboard integration

photon
Tags: #<Tag:0x00007fe228e5fa58>

#1

Hi,

I am trying to integrate particle photon with thingsboard IoT platform.
I can easily push data to thingsboard platform and read it there but I am struggling with control of particle.

I did one baby step which is trying to control my computer.
To do so I have to send message to thingsboard:

curl -v -X GET https://cloud.thingsboard.io/api/v1/ZD4SrkUvct5tqGe9cTnV/rpc/

and in response I receive message:
{“id”:44,“method”:“setValue”,“params”:“54.00”}

Now i created Webhook with GET request but i cannot get response.

I am calling in loop code this command:

Particle.publish(“SmartBlanket3_TB_GET”, PRIVATE);

but cannot reach answer with that commands:

void setup() {
  // Subscribe to the integration response event
  Particle.subscribe("hook-response/SmartBlanket3_TB_GET", myHandler, MY_DEVICES);
}

void myHandler(const char *event, const char *data) {
  // Handle the integration response
blkt4ActTemp = random(1,5);
}

At the moment I tried to round some number in handler but it doesn’t work because it doesn’t change. It seems that I have to do something wrong.

How can I run properly this handler to round number?
What is the easiest way to get this string {“id”:44,“method”:“setValue”,“params”:“54.00”} in my particle?


#2

Would be good to see how you are actually doing that in your loop().

Also showing how your webhook looks and checking console.particle.io/events would be helpful.
console.particle.io/integrations/[yourWebhook] may also provide some info about the call history of your webhook.

To understand your properly we’d need more info.


#3

How are you setting up the RPC in thingsboard? what are the related rules?