Payload Parser

Payload Parser

The Payload Parser handles the raw payload sent by the devices in order to extract the measured variables. For example, it can be used to transform an HEX payload sent by a device into temperature and battery levels.  

You can also use it to handle the payload in real-time, allowing the conversion of a value to the desired unit. For example, if your data contains a temperature in F, you can use the parser to convert it into C before inserting the data into the Bucket.

You can learn about the differences between Payload Parser and Analysis.

TagoIO can run up to two parsers: one that is defined by the Connector (added during the creation of the device) and your own parser (optional).

The parsers are executed in sequence. First the one from the Connector, then your parser.

The connector type is defined based on your selection from the list of devices (Add Device step). It contains the script necessary to work with that device.  

Parser settings to enable the parsers

The script contained inside the parser from the Connector is not visible.

How is the Payload Parser triggered?  

The payload parser is automatically triggered every time the device sends data to TagoIO (no need to setup anything). Your payload parser is the first step that gets triggered before saving data in the bucket, so if your code has an error it will be returned directly to the device HTTP post response. 

There are some concepts about global variables and context that you may want to learn.

A parse example

For this example, let's connect a toaster to Tago.

A toaster could send data to TagoIO when your bread is toasted in the following format:

The value above could represent XX YYY ZZ.  Where:

XX00 - Interrupted, 01 - Successful
YYYTemperature in Fahrenheit
ZZError code or 00 - No error

That value is good enough for machines or engineers, but for humans, it doesn't mean anything and also it's not optimized for the Tago Dashboard. Therefore, we need to parse this payload.

Let's code the Payload Parser to transform that payload into real variables. First, click on your Device and go to the Payload Parser tab.

On the Payload Parser tab you will see the code editor. Then, you can write the following code:

Save, and you are ready. Now, every time the toaster sends those variables, the parser will transform it in real variables, and you can use them to build Dashboard, Analysis, or Action.

Learn more about  Building your own parser function.

    • Related Articles

    • Payload Parser - Context & global variables

      If you are going to create your own parser, you need to understand how context works. When you start writing your own Payload Parser, you can use certain globals variables in your code. Think of these global variables as variables that you can access ...
    • Building your own parser

      In this tutorial, you will learn how to convert (parse) a raw payload sent by a device into actual measurable variables.  Data flow structure You can create parses for devices that weren't found in our list of Devices, so that you had to use a ...
    • Parser vs. Analysis Comparison

      The Payload Parser was created to handle raw payload sent by the devices in order to extract the measured variables or execute simple operations. Analysis is much more powerful, including access to buckets and external services. Also, there is a cost ...
    • Filtering Out Variables with Parser Code

      When your device sends data from a device to TagoIO, a parser code may be added to your device (located in the 'Payload Parser' tab) to extract and create the variables in the buckets using TagoIO format.  If you want to save space in your register ...
    • Connector Overview

      Connectors enable you to create a device with built-in behaviors that allow it to communicate with a Network very easily. They also help you automate and scale your devices, once you create a device using a connector, that device will also run the ...
    Additional Links

       Check the System Status


        Future and past Webinars