Hey @mdede439,
I just took a pass through the tutorial. Although it’s perhaps a bit confusing, the step that has you create the Datacake route doesn’t actually tell you to include a JSONata expression (see Route Tutorial - Blues Wireless Developers).
The reason the route fails with a JSONata expression is because the Decoder code looks for a data.body, and that body property doesn’t exist after JSONata processes the JSON. You can tweak the Decoder code to get it to work with the JSONata expression though. I just tried this out this Decoder with the tutorial’s JSONata expression and it worked fine.
function Decoder(request) {
var data = JSON.parse(request.body);
var device = data.device; // this is your Device UID
var decoded = {};
decoded.temp = data.temp;
decoded.humidity = data.humidity;
decoded.location = "(" + data.tower_lat + "," + data.tower_lon + ")";
decoded.time = data.when;
return [
{
device: device,
field: "TEMP",
value: decoded.temp
},
{
device: device,
field: "HUMIDITY",
value: decoded.humidity
},
{
device: device,
field: "LOCATION",
value: decoded.location
},
{
device: device,
field: "TIME",
value: decoded.time
}
];
}
Hopefully that makes sense, and if you have any other questions let us know.
TJ