Convert LoRaWAN Sensor Codec Formats and Import to E2C…

How to Convert LoRaWAN Sensor Codec Formats and Import to E2C Field

Document Version: V1.0

Revision History

Document Version

Updated

Description

V1.0

2026-08-20

Initial operation-focused release covering codec conversion, import, testing, and publishing.

Document Header

Field

Value

Product

E2C Field

Document Type

Knowledge Base Article — How-to Guide

Intended Audience

E2C Field administrators and deployment engineers who have a LoRaWAN sensor whose payload codec is not already available in E2C Field

Prerequisites

A Windows PC, the E2C Trinity Codec Converter, the manufacturer's raw codec source folder, a sample uplink payload for the selected sensor model, and administrator access to E2C Field

Converter Version

E2C Trinity Codec Converter V1.0.0

Tested Software

E2C Field V2.0.3.0

Estimated Time

20 minutes

Terms and Abbreviations

Term or Abbreviation

Full Name

Definition

Codec

Coder-decoder

A translator that converts a sensor's compact payload into readable data fields.

HEX

Hexadecimal

A base-16 representation used for the raw bytes in a LoRaWAN payload.

LNS

LoRaWAN Network Server

The service that manages LoRaWAN devices and processes their network traffic. E2C Field uses an embedded ChirpStack LNS.

LoRaWAN

Long Range Wide Area Network

A low-power wide-area networking protocol usually used by battery-powered sensors.

Payload

The application data bytes sent by a LoRaWAN sensor.

TOML

Tom's Obvious, Minimal Language

The configuration-file format required by E2C Field for an imported payload codec.

1. Overview

Use this procedure when the payload codec for a LoRaWAN sensor is not already available in E2C Field. You will place the manufacturer's raw codec source beside the E2C Trinity Codec Converter, generate a .toml codec file, import the file into E2C Field, test it with a known uplink payload, and publish it.

After you complete the procedure, the codec appears in E2C Field and can be selected when you create a device profile for the corresponding sensor.

2. Before You Start

Prepare the following items:

  • A Windows PC with e2c-trinity-codec-converter.exe v1.0.0. Download it from E2C Field APP Download.
  • The manufacturer's raw codec source folder for the sensor model you are adding:
  • For a Milesight sensor, download the SensorDecoders folder from Milesight SensorDecoders.
  • For a Dragino sensor, download the dragino-end-node-decoder folder from Dragino End Node Decoder.
  • A sample uplink payload in hexadecimal format that is known to belong to the exact sensor model. Obtain it from the sensor manufacturer's documentation or a controlled test device.
  • Administrator access to the E2C Field web interface on the Robustel gateway.

Important: Do not rename or reorganize files inside the manufacturer's source folder. The converter scans the folder structure from its current directory.

3. Step-by-Step Instructions

3.1 Workflow Overview

Step

What You Will Do

Estimated Time

1

Place the converter and raw codec source folder in the same directory

5 minutes

2

Select the vendor and model, and generate a .toml codec file

5 minutes

3

Import the generated codec file into E2C Field

5 minutes

4

Decode a known payload and publish the codec

5 minutes

3.2 Step 1: Prepare the Converter Directory

Purpose: Allow the converter to find the manufacturer's raw codec source.

  1. Create or open a working directory on the Windows PC.
  2. Place e2c-trinity-codec-converter.exe in that directory.
  3. Place the manufacturer's complete raw codec source folder in the same directory as the executable.
  4. Confirm that the executable and source folder are at the same directory level, as shown below.

Figure 3-1 Converter executable and manufacturer source folders in the same directory

Use the following directory structure:

File or Folder

Purpose

Requirement

e2c-trinity-codec-converter.exe

Runs the conversion tool

Required

SensorDecoders

Contains Milesight decoder sources

Required when converting a Milesight codec

dragino-end-node-decoder

Contains Dragino decoder sources

Required when converting a Dragino codec

3.3 Step 2: Generate the TOML Codec File

Purpose: Package the selected manufacturer's decoder into the .toml format accepted by E2C Field.

  1. Double-click e2c-trinity-codec-converter.exe.
  2. In Vendor, select the sensor manufacturer. In this example, select Milesight.
  3. In Model, select the exact sensor model. In this example, select AM102.
  4. Review Output File and confirm the proposed filename and directory.
  5. Click Generate Codec TOML.
  6. In the Log panel, confirm that the first result line is [SUCCESS] and that the log identifies the selected vendor, model, and output path.
  7. In the converter directory, confirm that the generated .toml file exists. For this example, the output file is milesight-am102-codec.toml.

Figure 3-2 Successful codec conversion and generated TOML file

3.4 Step 3: Import the Codec into E2C Field

Purpose: Load the generated codec definition into the E2C Field payload codec library.

  1. Log in to the E2C Field web interface on the Robustel gateway.
  2. Go to LNS Configuration > Payload Codecs.
  3. Click Import Codec.
  4. Select Import from file.
  5. Select the .toml file generated in Step 2. For this example, select milesight-am102-codec.toml.
  6. Confirm that E2C Field displays a green check mark beside the filename and fills in Name, Brand, and Series.
  7. Review the JavaScript Code Preview. Do not publish the codec yet.

Figure 3-3 Imported codec details and JavaScript code preview in E2C Field

3.5 Step 4: Test and Publish the Codec

Purpose: Prove that the imported codec can decode a known payload before making it available on the gateway.

  1. In the Import Codec dialog, open the Uplink Test tab.
  2. In Input Payload (HEX), paste a sample hexadecimal uplink payload for the exact sensor model. The sample hexadecimal code can usually be found in the specifications of the sensor.
  3. Click Run Decode.
  4. In Output Console, confirm that the result is structured JSON with readable field names and values. The exact fields depend on the sensor model and payload.
  5. If the output is correct for the known sample, click Publish.

Figure 3-4 Successful uplink test with readable JSON output

Important: Publish the codec only after a known payload produces the values documented by the sensor manufacturer. A syntactically valid JSON result alone does not prove that the values are correct for a different model or firmware revision.

4. Verification

Verify the result in both the import dialog and the payload codec library:

  1. Before publishing, check Output Console in the Uplink Test tab.
  • What to observe: The console contains structured JSON rather than an error message.
  • Success criterion: The decoded fields and values match the manufacturer's expected result for the sample payload.
  1. After clicking Publish, return to LNS Configuration > Payload Codecs.
  • What to observe: The imported codec is available under the expected name, brand, and series.
  • Success criterion: You can select the codec when creating the device profile for the matching LoRaWAN sensor.

5. Troubleshooting

Symptom

Possible Cause

Resolution

Where to Check

The required vendor or model does not appear in the converter

The manufacturer source folder is missing, is not beside the executable, or does not contain the selected model

Close the converter, restore the complete source folder beside e2c-trinity-codec-converter.exe, and reopen the converter

Vendor and Model lists

The .toml file is not generated

The converter cannot resolve or parse the selected source

Read the Log panel, correct the reported source-folder issue, and click Generate Codec TOML again

Converter Log panel

E2C Field does not accept the selected file

The selected file is not the generated .toml output

Return to the converter directory and select the generated file whose name ends in -codec.toml

Filename row in the Import Codec dialog

Output Console shows Input payload cannot be empty

No payload was entered

Paste a sample hexadecimal uplink payload into Input Payload (HEX), then click Run Decode

Uplink Test > Output Console

The decoder returns an error or unexpected values

The payload does not belong to the selected model, or the selected vendor/model is incorrect

Verify the payload source and model, regenerate the codec for the correct vendor and model, reimport it, and repeat the uplink test

Converter Log and Uplink Test > Output Console