Callback processing of Sigfox data - help

I have built the callback integration of a sigfox device (using the Sigfox Plugin) as described in the documentation. My expectation is for Thinger to process raw data from sigfox and place in a data bucket for further analysis. The callback processor works as expected (according to the Test Uplink feature) but the data does not appear in any bucket. What am I missing?

Also, according to the documentation, the callback config auto enabling should create the data bucket automatically - this does ´not appear to be happening…

/jim

Hi @Jims, by default, the sigfox pluings calls an HTTP device on the platform, that can be both created manually or auto-provisioned depending on your settings. It also initializes the underlying data bucket that will store device data. Note that this process does not work when you test the uplink feature, as it just tests that your processing is fine according to your test input that will arrive from Sigfox.

In order to get the auto-provisioning working, and see actual data in your bucket, you must configure your Sigfox callback settings to point to your Thinger.io Sigfox plugin, and let a Sigfox device send some information according to the configured payload. If you dont have a device by hand, you can also call the Sigfox Integration callback by yourself using Postman, curl, or a similar tool.

Le me know if you need more information, or an example to get it working.

Bests

Thanks. Can you please supply an example since I believe I have set up my Sigfox devices correctly … still doesn’t work…

Regards

Jim

Hi @Jims,

here you have a complete example of the Sigfox plugin working in the way you described, with processing, auto-provisioning, etc. I call this plugin from an API tester to simplify the example. Notice that when calling the plugin API I am replacing the placeholders {device} and {time}to send something relevant, but this is something Sigfox automatically replaces when the device sends real data.

Hope this help!

Thanks… this brings me a little further. From the log I can now see that the callback script is not being executed properly:

The script is simple:

module.exports.uplink = function(payload){
  const buffer = Buffer.from(payload.data, 'hex');
    payload.lastMsg = buffer.readInt8(0);
    payload.moduleTemp = buffer.readInt16LE(1)/273.066;
    payload.temperature = buffer.readInt16LE(3)/273.066;
    payload.humidity = buffer.readInt16LE(5)/595.7818;
    return payload;
}

Any suggestions?

Jim

According to the error message, it seems that the uplink function is not receiving an string on payload.data. Would need to know the payload you are sending, and how.

Hi Alvaro
the callback is now self provisioning the data bucket but the processing is not happening …
Here is the sigfox callback:

and here is the callback processing:

This is the contents of the bucket:

and the most recent log:

The payload is as described in the Sigfox callback i.e. a HEX string and is received correctly … the only issue (as far as I can see is that the Thinger callback is not being processed. I have tried to change data source for the bucket but this has no effect.
Hope yo have some suggestions…

Jim

Sorry, contents of bucket here:

Hi @Jims,

There are some problems in your implementation (maybe there are some misunderstandings). Lets go step by step. In the sigfox callback you are configuring to send a JSON payload like the following (as we can see in the log) (#1):

{
  "lastMsg" : {
    "lastMsg" : 0
  },
  "moduleTemp" : {
    "moduleTemp" : 4915
  },
  "dhtTemp" : {
    "dhtTemp": 6307
  },
  "dhtHum" : {
    "dhtHum": 22639
  }
}

So, first question here is why do you create an object for every value, using later the same key?. This is why you see in the bucket columns with a proper name, i.e., “DhtTemp”, and then, in each row, instead of having just the value they contain another JSON Object with the same name… I would convert your JSON to (#2):

{
  "lastMsg" : 0,
  "moduleTemp" : 4915,
  "dhtTemp" : 6307,
  "dhtHum" : 22639
}

It is more compact and readable. So, your Sigfox callback payload should look like:

{
  "lastMsg" : {customData#lastMsg},
  "moduleTemp" : {customData#moduleTemp},
  "dhtTemp" : {customData#dhtTemp},
  "dhtHum" : {customData#dhtHum}
}

Then, our Sigfox callback processing on Thinger.io will be receiving the information that you configure on Sigfox callback, so, you should process it accordingly. I think that you assumed that the Sigfox payload would be included in payload.data and it is necessary to process it from hex, and this is not the case unless you configure it. If you take a look to our Sigfox example, we are configuring the payload to be like:

{
  "data" : {data}
  ....
}

It basically sends to thinger the raw hex received directly from the device, just to do some raw processing on thinger side, i.e, hex parsing, etc. This is why the example is taking the information from payload.data and extracting values from the hex string received there. This is not your case, as it seems you do not require such conversion. With the data payload mentioned in #2 you are already extracting the values from the device payload (using the Sigfox placeholders), and sending it converted to JSON format to the platform. So, in our case, we do not require to extract it from hex on Thinger side, as we will receive it as this payload #2:

{
  "lastMsg" : 0,
  "moduleTemp" : 4915,
  "dhtTemp" : 6307,
  "dhtHum" : 22639
}

Taking this into account, if we want to modify such payload, perform some calculations on it, and so on… we can write our uplink function as:

module.exports.uplink = function(payload){
    payload["moduleTemp"] = payload["moduleTemp"]/273.066;
    payload["dhtTemp"] = payload["dhtTemp"]/273.066;
    payload["dhtHum"] = payload["dhtHum"]/595.7818;
    return payload;
};

So, we have to be aware of what kind of payload we configure on Sigfox Callback, how it is coming to Thinger.io, and what kind of processing we require. In this example I am assuming you are sending values as measure*273.066 or measure*595.7818 sent as integeres, and you need later do the inverse to extract the float values.

Hope it makes sense to you.

Hi Alvaro
this helped a lot! I made these changes but it still did not work. Studying the log I could see that the callback was being deployed correctly but no data was appearing in the auto generated bucket. I disabled the bucket and pointed the device to another existing bucket and that worked. I think I understand the process now and thank you again…

Jim

Hi, I recommed you to delete both the auto-generated device and auto-generated bucket, as they will be initialized again. Maybe you did some chages to both bucket or http device…