[SOLVED] The Things Stack plug-in and fport

Hello, I’m working on a NodeJS decoder for data being forwarded via webhook from The Things Network. The data in payload is received and I can access it in the nodejs decoder setup in Thinger.io plug-in.

There is however one piece of data that is accessible to be in the native TTN decoder I can’t seem able to access in the thinger plug-in, that is the “fport” number.

In my case I use fport to define the type and structure of the data in the payload, allowing me to maintain just one main decoder rather than different decoders for different TTN applications.

Question: is the fport data available to the nodejs decoder?

I tried this below, but it didn’t work.

module.exports.uplink = function(payload)
{
    const buffer = Buffer.from(payload, 'base64');
    let processed = {};
    processed.fport = payload.fport;
    return processed;
};

Cheers.

Hi, fport, along with other information is stored automatically in each device property, which is required for using later the downlink

Anyway, you can access the raw information from TTN by adding another parameter to the uplink function, i.e., raw:

module.exports.uplink = function(payload, raw)
{
    const buffer = Buffer.from(payload, 'base64');
    let processed = {};
    processed.fport = raw.uplink_message.f_port;
    return processed;
};

Something like this should work (but not tested).

Hi Alvaro, thanks for your input. I tested this and was able to retrieve/store fport. I should be able to use this to optimize the decoder for different sensors and applications on the TTN side.

1 Like