TTN V3 formatters: input vs. frm_payload

Hello,

I’m migrating from TTN V2 to V3. I successfully migrated an application (with 3 sensors) and a gateway. I’m now facing issues with formatters.

Here are my questions:

  1. If I understand well frm_payload is coded in Base64 and is what is sent as the input to the formatters. Is that right?

  2. How can I test the formatters? In the application default formatter it is written You can use the “Payload formatter” tab of individual end devices to test uplink payload formatters and to define individual payload formatter settings per end device. However, when I go to the device formatter, I can’t find a place to test formatters.

  3. What is the way to transform a frm_payload as found in Live Data (i.e. AQDmAiUEAXAFAAcOVQ==) to an input object of the formatter with Javascript? Knowing that I understand that the input object has two fields; namely bytes and fPort)?

With the following extract of my formatter:

function decodeUplink(input) {
var bytes = input.bytes;
return DecodeElsysPayload(bytes);
}

I get empty decoded_payload.

Thanks for your support!

If required, I can share the complete V2 formatters

My question seems to be related to https://www.thethingsnetwork.org/forum/t/payload-formatter-migration/53079

In which I mention that v3 will run a v2 payload formatter without alteration …

No, and it wasn’t in v2 either - it gives you a byte array.

The instructions you have quoted are correct but the navigation isn’t obvious. Go to a device. Click on the Payload Formatters option on the Horizontal menu - it’s between Location and General Settings. The one on the left hand menu is for the application which doesn’t have any test boxes to use…

That is Base64 which you do not need to decode because it already is, as above.

That’s using the v3 interface, so you will have to return using the new v3 structure (first example in the grey box from your decode link above). You can’t mix & match.


I’d recommend as per my recommendations on the other thread - CopynPasta your v2 formatter and then start with a few lines of code to get your head in to the game.

Thanks Mick for your answer. Indeed I was confused by the following paragraph of the migration documentation. The sentence …then your uplink payload formatter function in The Things Stack should be:… let me thought that using decodeUplink(input) has to be done while I now understand that it is only optional.

I still have an issue finding the Payload Formatter test menu. See the attached image I have for devices.

device-payload-formatter

That’s my big brother - Mr Jagger - I’m Marshall Nick McCloud (New York horse riding cop).

As you are the second person to come to that conclusion, paging Mr @benolayinka - can you look at the wording on the payload formatter instructions to make to absolutely clear that you don’t have to change anything if you don’t want to at this stage.

You’ll need to change the formatter type to device …

1 Like

Thanks… Nick! Everything seems clear now. I just have to switch TTN unsupported NodeRED nodes to MQTT now. Which shouldn’t be a big deal! Have a good afternoon in NY.

1 Like

Glad you got it figured out. Will update the payload formatter documentation to make it clear that

  • V2 payload formatters CAN be run without modification
  • BUT V2 and V3 payload formatters can’t be mixed
  • The payload formatter tester is only visible in “Device payload formatter” mode

EDIT: Updated doc: Add v2 payload formatter note · TheThingsIndustries/lorawan-stack-docs@4a4f8b2 · GitHub

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.