Convert LoRaWAN Sensor Codec Formats and Import to E2C…

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

Document Version: V1.1

Revision History

Document Version

Updated

Description

V1.1

2026-10-23

Added rules for sensor decoders of brands other than Milesight and Dragino. Supplemented data source: The Things Network LoRaWAN Devices repository.

V1.0

2026-08-20

Initial release.

Document Header

Field

Value

Product

E2C Field

Document Type

Knowledge Base Article — How-to Guide

Intended Audience

E2C Field administrators and deployment engineers

Applicable Scenario

The LoRaWAN sensors in use are not natively supported by E2C Field, but codec data for the corresponding brand and model is available in the designated GitHub data source.

Converter Version Requirement

≥V1.0.0

E2C Field Version Requirement

All Versions

Estimated Time

5 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 codec for a customer's LoRaWAN sensor is not already built in to E2C Field, but the codec data for that sensor brand and model is available in one of the three specified GitHub data-source folders. You will download the complete folder from the relevant GitHub source, place it 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.
  • A complete codec data folder downloaded from the specified GitHub data sources:
  • If the target sensor is a Milesight model, check whether it is included in Milesight SensorDecoders. If it is included, download the complete SensorDecoders folder.
  • If the target sensor is a Dragino model, check whether it is included in Dragino End Node Decoder. If it is included, download the complete dragino-end-node-decoder folder.
  • If the target sensor belongs to another brand, check whether it is included in The Things Network LoRaWAN Devices. If it is included, download the complete lorawan-devices folder.
  • A sample uplink payload in hexadecimal format that is confirmed to belong to the exact sensor model. Obtain it from the sensor documentation or a controlled test device.
  • Administrator access to the E2C Field web interface on the Robustel gateway.

Important: Download the complete source folder. Do not keep only the subfolder for a single model. Do not rename, delete, or reorganize any files or folders inside the source folder. The converter parses the data based on the current directory structure.

3. Step-by-Step Instructions

The following sections use importing the Milesight AM102 sensor into E2C Field as an example to demonstrate the detailed procedures. The workflow is identical for other brands/models and other supported products.

3.1 Workflow Overview

Step

What You Will Do

Estimated Time

1

Place the converter and the codec data folder in the same directory

1 minute

2

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

2 minutes

3

Import the generated codec file into E2C Field

1 minute

4

Decode a known payload and publish the codec

1 minute

3.2 Step 1: Prepare the Converter Directory

Purpose: Allow the converter to find the complete codec data folder downloaded from the specified GitHub data 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 complete codec data folder in the same directory as the executable.
  4. Confirm that the executable and the data folder are at the same directory level, as shown below.

Figure 3-1 Converter executable and codec data 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

lorawan-devices

Contains decoder sources for other brands

Required when converting a codec for other supported brands

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 codec data folder is missing, is not beside the executable, or does not contain the selected model

Close the converter, restore the complete data folder besidee2c-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 data

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

ConverterLog 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 theImport Codec dialog

Output Console showsInput payload cannot be empty

No payload was entered

Paste a sample hexadecimal uplink payload intoInput 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

ConverterLog and Uplink Test > Output Console