The Things Networks parser experts

Job ID: 37695959

Budget: $30 – $250 USD

I am looking for someone who has experience with The Things Network, and know how to make parsers to decode payloads from the sensors that sends data to TTN.



Attached you can find a payload description of one of the sensors.



In this particular case, we have a parser that we use in Notix (alternative to TTN) and it works fine.

I need help in this first case to make this parser work in the things network.



Here is a example of payload from the sensor: 09849BECB25834AE841D2E074A1A130DB7A92BB815C5DADFA39323D9488AB9A1ECCD8FB26AAEC4699BCF0BE48EBCCE40



Here is the javascript parser that we use in Niotix:



module.exports = function (payload, meta) {

const port = meta.lora.fport;

const buf = Buffer.from(payload, 'hex');



let offset = 0;



let unix_timestamp = null;

let status_code = null;

let volume = null;

let volume_period_1 = null;

let volume_period_2 = null;

let volume_period_3 = null;

let volume_period_4 = null;

let volume_period_5 = null;

let volume_period_6 = null;

let value_period = null;



if(offset < buf.length) {

unix_timestamp = buf.readUInt32LE(offset);

offset += 4;

}



if(offset < buf.length) {

status_code = buf.readUIntLE(offset);

offset += 1;

}



if(offset < buf.length) {

volume = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_1 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_2 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_3 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_4 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_5 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

volume_period_6 = buf.readUInt32LE(offset) / 1000;

offset += 4;

}



if(offset < buf.length) {

value_period = buf.readUInt32LE(offset);

offset += 4;

}



return {

unix_timestamp: unix_timestamp,

status_code: status_code,

volume: volume,

volume_period_1: volume_period_1,

volume_period_2: volume_period_2,

volume_period_3: volume_period_3,

volume_period_4: volume_period_4,

volume_period_5: volume_period_5,

volume_period_6: volume_period_6,

value_period: value_period

};

}
Related categories: JavaScript JSON Internet of Things (IoT)