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.