I have installed FIWARE on my machine (Ubuntu 18.04) and I am currently trying to work with the IoT Agent, using the HTTPBindings.js (my data is sent via LoRaWAN and I've changed the parseData function in order to use my own data "protocol" [id=1&temp=12&humidity=10], which brings me here to ask 2 questions for someone who is more experienced and can help me with:
function parseData(req, res, next) {
let data;
let error;
let payload;
let obj;
try {
let newPayload = new Buffer.from(payload, "base64").toString("ascii");
var ps = newPayload.split("&").reduce((accum, x) => {
const kv = x.split("=");
return { ...accum, ...{ [kv[0]]: kv[1] } };
}, {});
data = ulParser.parse(newPayload.replace(/&/g, "|").replace(/=/g, "|"));
} catch (e) {
error = e;
}
if (error) {
next(error);
} else {
req.ulPayload = data;
config.getLogger().debug(context, 'Parsed data: [%j]', data);
next();
}
}
After changing this function, I can't get the data to be updated in the orion/v2/entities.. Would someone explain me how does this work?
How can I add a proxy to us
enter code here
e in the Wirecloud? I've created it using the FIWARE servers, but testing on my own, I do not have this.
Thank you in advance.
docker-compose.yml
for Wirecloud in the following tutorial – Jason FoxHTTPBindings.js
file from the Ultralight IoT Agent is assuming comms is over HTTP, not LoRa. As your regex conversion suggests, theulParser.js
will read data in assuming Ultralight syntax, but if the binding is listening for the wrong protocol any measures will not be successfully received. – Jason Fox