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

Example parsing Status & TemperatureYou can create parses for devices that weren't found in our list of Devices, so that you had to use a connector for Custom device.  Or maybe, you just want to do some math with the data after the system runs its parser from the selected connector.

If you want to learn more about how data packages are sent to TagoIO take a look in Integration


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.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/e6WvSQOUj-07-I4pSYzWjj1ZLtXce_d7edMhTbGxa_I/payload_parser-DJA.png


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 .

We have some script examples to help you to start. Just select the Parse Example from the Snippets list.

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

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

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

Every time your device sends data to your provider 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 an 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: https://nodejs.org/api/buffer.html

Common functions are:

More information about Payload Parser can be found here.