In this tutorial, you will learn how to convert (parse) a raw payload sent by a device into actual measurable variables. 

We're assuming you couldn't find your device in our connector list (listed devices have a Parser already included for them) and already have a device receiving data using one of our Custom Devices

If you haven't added your device using any of the Custom Devices yet, make sure you do it by following one of the tutorials below (select your network).

  • TTN Documentation;
  • Everynet Documentation;
  • Loriot Documentation;
  • Sigfox Documentation;

Each device sends data using their specific format, usually a hexadecimal raw payload like 0x0F55028A, this hexadecimal is great for devices, but for end users, raw payloads should be converted to actual variables like temperature or humidity.

In our generic payload conversion example, we will use a four byte hexadecimal payload. The first two bytes represent the values for temperature, and the last two are the values for humidity. In this case, the temperature and humidity are multiplied by 100.

In order to create your unique payload parser, go to your device (Click on 'Devices' and select your device) and then reach the tab Payload Parser .

The parsers are slightly different for each LoRaWAN provider because each one sends the payload and additional data using different names/variables. We have several examples for different networks, and more will be added soon. 

For this tutorial, we're assuming that you're using TTN. But you shouldn't see much difference if using another provider. 

Select the TTN Parse Example from the Snippets list.

The current code of your payload parser will be replaced by a generic TTN example. 

In most scenarios, you won't need to change anything besides the payloadParse function.

Then, search for the payloadParse function in the code. This function is exactly the same for any LoRaWAN network. 

We use the slice function to get just a fraction of the buffer. buffer.slice(0,1) means that we're only getting the first byte.

For connectors like TTN, Everynet and Loriot, they send a variable like "ttn_payload". The value of this variable is then converted to JSON and parsed. If you want to see the content of "ttn_payload", leave your payload parser empty.

Every time your device sends data to TTN and it reaches TagoIO, the payload will be parsed to temperature and humidity variables. From here, you can easily add these variables to your dashboard.

You can always edit the data object to add new variables. If your parser returns any error, you should see a variable called  parse_error in your bucket.

Node.JS provides a lot of in-build functions for Buffers that helps you get your parse running really fast. Check it out here:

Common functions are:

More information about Payload Parser can be found here.