LORIOT Integration
LORIOT Integration receives device data from the LORIOT LoRaWAN network server through an HTTP Push output of a LORIOT application. An uplink data converter takes the device payload out of each LORIOT message and turns it into device data, including telemetry and attributes. For downlink, ThingsBoard sends commands to the device through the LORIOT REST API. In ThingsBoard, the integration type is called Loriot.
Use LORIOT Integration when:
- Your LoRaWAN devices are registered in a LORIOT application, and you want their data in ThingsBoard without writing a parser for the LORIOT message format.
- You need to send commands from ThingsBoard to those devices, for example when a shared attribute changes.
Architecture
Section titled “Architecture”- Receive data. The device sends an uplink through a LoRaWAN gateway to LORIOT. The HTTP Push output of the LORIOT application sends the message as an HTTP request with a JSON body to the integration endpoint.
- Check the request (optional). If you turn on the headers filter, the integration rejects requests without the expected headers with
403 Forbidden. - Unwrap and decode. The uplink converter takes the device payload and the network details, such as
eui,fPort, andrssi, out of the LORIOT message. Your decoder turns the payload into telemetry and attributes, and the converter adds the network details you selected. If Allow create devices or assets is on, ThingsBoard creates the device on its first message. - Send a command (optional). The Rule Engine passes a message to the integration. The downlink converter encodes it, and ThingsBoard sends it right away to the LORIOT REST API as a
txcommand. LORIOT delivers it to the device in the next receive window.
Prerequisites
Section titled “Prerequisites”- Access to ThingsBoard Cloud with integrations enabled for your tenant. The ThingsBoard endpoint must be reachable from the internet, because LORIOT calls it.
- Permission to create integrations and data converters, and to edit rule chains for downlink.
- A LORIOT account. If you do not have one, create it first.
- A LoRaWAN device registered in a LORIOT application. Without hardware, test the uplink with
curland enroll a test device for downlink.
Prepare LORIOT
Section titled “Prepare LORIOT”In LORIOT, devices belong to an application, and the application forwards device data to its outputs. Here you create the application, look up its server and ID, and enroll a device. The HTTP Push output comes later: it needs the integration endpoint, so you add it after creating the integration.
Create a LORIOT Account
Section titled “Create a LORIOT Account”- Go to the LORIOT website. Under Free Community Public Server, click Register Now.
- Select a region, for example Europe ⇾ Amsterdam, NL.
- On the login page, click Register a new account.
- Fill in First Name, Last Name, Country, E-Mail, and Password. Accept the Terms of Service and click Create a free account.
- Sign in. The LORIOT dashboard opens.
Create a LORIOT Application
Section titled “Create a LORIOT Application”- In the LORIOT dashboard, click Applications in the left menu.
- Click + New LoRaWAN® Application.
- Enter a Name, for example
ThingsBoard. Set Device Capacity to the number of devices you plan to connect, and click Create.
Locate the Server and Application ID
Section titled “Locate the Server and Application ID”The integration needs both values to create the output automatically and to send downlinks.
- Server — the cluster code in the server selector in the upper-right corner of the LORIOT dashboard, for example
EU2for Amsterdam orEU1for Frankfurt. Enter it in lowercase in ThingsBoard, for exampleeu2. - Application ID — the value in the Application ID column on the Applications page, for example
BE010A45.
Enroll a Device
Section titled “Enroll a Device”Register your device in the application. Without hardware, enroll a test device with the EUI that the curl example in Test Uplink uses, so that LORIOT accepts downlinks for it.
- In your LORIOT application, click Enroll Device in the left menu.
- Select LoRaWAN® 1.0.x and keep Over the Air Activation.
- Under Device Details, enter a Device name, for example
my-device, and select Class A. - Set Device EUI to the EUI of your device, or to
BE7A000000000552for the test device. Autogenerate creates a new EUI: then use it in thecurlexample too. - Under Activation, JoinEUI is filled in automatically. Enter the AppKey of your device, or leave it empty for the test device.
- Skip Location and click Create Device.
Set Up LORIOT Integration
Section titled “Set Up LORIOT Integration”Create the uplink converter and the integration, then add an HTTP Push output that points at the integration endpoint.
Create the Uplink Data Converter
Section titled “Create the Uplink Data Converter”LORIOT Integration uses the Typed uplink converter. ThingsBoard selects it for the Loriot integration type, and you cannot change it later. Before your decoder runs, the converter unwraps the LORIOT message: the decoder gets the device payload bytes as payload, and the network details as metadata (see Decoder Inputs). The converter then adds the metadata keys you list in Telemetry and Attributes to the result. For the full reference, see Typed uplink converter.
If a ready-made decoder exists for your device model, take it from the library instead of writing one: see Use a Library Converter.
The decoder in this guide is the default LORIOT decoder. It skips messages that are not uplinks (cmd other than rx or gw) and maps:
- Bytes 0–3 ⇾ attribute
sn. - Byte 4 ⇾ telemetry
battery. - Bytes 5–6, divided by 100 ⇾ telemetry
temperature. - Byte 7 ⇾ telemetry
saturation.
-
Go to Integrations ⇾ Data converters and click + Add data converter ⇾ Create new converter.
-
Converter type — keep Uplink.
-
Integration type — select Loriot.
-
Keep Create new. Library loads a decoder for a specific device model instead.
-
Name — enter a name, for example
Loriot Uplink Converter. -
Main decoding configuration:
- Entity type — keep Device.
- Device name — keep
Device $eui.$euiis replaced with the device EUI, so the device is named, for example,Device BE7A000000000552. Any metadata key works as$key. - The decoder editor shows the function header
function payloadDecoder(payload, metadata)and opens in TBEL. Replace the body with the decoder below. Use the TBEL / JS toggle to switch to JavaScript.
/*** Decodes the incoming payload and returns a structured object containing telemetry data and attributes.** @param {byte[]} input - The raw payload received as an array of bytes.* @returns {Object} output - The structured output with decoded telemetry and attributes.*/function decodePayload(input) {var result = { attributes: {}, telemetry: {}};// Serial number (SN) from the first 4 bytes of the payload.result.attributes.sn = parseBytesToInt(input, 0, 4);// Timestamp of the LORIOT message, in milliseconds.var timestamp = metadata.ts;var values = {};// Battery level from the 5th byte.values.battery = parseBytesToInt(input, 4, 1);// Temperature from the 6th and 7th bytes, divided by 100.values.temperature = parseBytesToInt(input, 5, 2) / 100.0;// Saturation from the 8th byte.values.saturation = parseBytesToInt(input, 7, 1);result.telemetry = {ts: timestamp,values: values};return result;}// Decode only uplinks: cmd "rx", or "gw" when gateway info is included.// Other LORIOT messages carry no device payload.// An empty array produces no output.if (metadata.cmd != 'rx' && metadata.cmd != 'gw') {return [];}var result = decodePayload(payload);// Uncomment to override values set in the main configuration window:// result.type = 'DEVICE'; // 'DEVICE' or 'ASSET'.// result.name = 'Temperature Sensor'; // Device or asset name (the value must be unique).// result.profile = 'IndustrialSensorProfile'; // Device or asset profile name.// result.customer = 'MyCustomer'; // Customer to assign the created entity to.// result.group = 'SensorsGroup'; // Entity group to add the created entity to.return result;/*** Decodes the incoming payload and returns a structured object containing telemetry data and attributes.** @param {number[]} input - The raw payload received as an array of bytes.* @returns {Object} output - The structured output with decoded telemetry and attributes.*/function decodePayload(input) {var result = { attributes: {}, telemetry: {}};// Serial number (SN) from the first 4 bytes of the payload.result.attributes.sn = parseBytesToInt(input, 0, 4);// Timestamp of the LORIOT message, in milliseconds.var timestamp = metadata.ts;var values = {};// Battery level from the 5th byte.values.battery = parseBytesToInt(input, 4, 1);// Temperature from the 6th and 7th bytes, divided by 100.values.temperature = parseBytesToInt(input, 5, 2) / 100.0;// Saturation from the 8th byte.values.saturation = parseBytesToInt(input, 7, 1);result.telemetry = {ts: timestamp,values: values};return result;}// Decode only uplinks: cmd "rx", or "gw" when gateway info is included.// Other LORIOT messages carry no device payload.// An empty array produces no output.if (metadata.cmd != 'rx' && metadata.cmd != 'gw') {return [];}var result = decodePayload(payload);// Uncomment to override values set in the main configuration window:// result.type = 'DEVICE'; // 'DEVICE' or 'ASSET'.// result.name = 'Temperature Sensor'; // Device or asset name (the value must be unique).// result.profile = 'IndustrialSensorProfile'; // Device or asset profile name.// result.customer = 'MyCustomer'; // Customer to assign the created entity to.// result.group = 'SensorsGroup'; // Entity group to add the created entity to.return result;/*** Parses a slice of bytes into an integer (big-endian).*/function parseBytesToInt(input, offset, length) {var result = 0;for (var i = offset; i < offset + length; i++) {result = (result << 8) | (input[i] & 0xFF);}return result;}To adapt:
- Byte layout — change the offset and length of each
parseBytesToInt()call to match your payload. - JSON payload — if LORIOT decodes the payload for you, the message has a
decodedobject, andpayloadholds that object as JSON. Read it withdecodeToJson(payload)in TBEL, orJSON.parse(String.fromCharCode.apply(String, payload))in JavaScript. - Device name — change the Device name pattern, or set
result.namein the decoder.
-
Advanced decoding parameters — the fields are pre-filled for LORIOT. Keep them, or edit the lists:
- Device profile name, Device label, Customer name, Device group name — empty by default. Like Device name, they accept
$keyplaceholders. Without a profile name, ThingsBoard uses thedefaultprofile. - Telemetry —
battery,fСnt,rssi,snr,data,decoded,encdata. The converter adds these metadata keys to the telemetry. A key that the decoder already returns keeps the decoder value. - Attributes —
eui,fPort,frequency,dr. The converter adds these metadata keys to the attributes. - Update only keys list —
eui,fPort,frequency,dr. ThingsBoard stores these keys only when their value changes.
- Device profile name, Device label, Customer name, Device group name — empty by default. Like Device name, they accept
-
Click Test payload decoder and check the result (see Test the Decoder).
-
Click Add.
Decoder Inputs
LORIOT sends each uplink as a JSON message like this one:
{ "cmd": "rx", "seqno": 3040, "EUI": "BE7A000000000552", "ts": 1792652400000, "fcnt": 42, "port": 1, "freq": 868100000, "rssi": -87, "snr": 9.5, "toa": 61, "dr": "SF7 BW125 4/5", "ack": false, "bat": 255, "offline": false, "data": "00bc614e5f092950"}The converter unwraps it into two inputs:
| Variable | Type | Content |
|---|---|---|
payload |
byte array | The device payload. If the message has a decoded object, it is that object as JSON. Otherwise, it is the hex string data as bytes, or the encrypted encdata as bytes if LORIOT does not decrypt the payload. Without any of these fields, payload is empty. |
metadata |
object | The fields of the LORIOT message under the keys below, plus payloadFormat (JSON or BINARY), integrationName, every request header as Header:<name> with the name in lowercase, and the key–value pairs from the integration’s Metadata field. A key from the integration’s Metadata replaces an unwrapped key with the same name. |
| Metadata key | LORIOT field | Example |
|---|---|---|
cmd |
cmd |
rx |
eui |
EUI |
BE7A000000000552 |
ts |
ts |
1792652400000. The current time if the message has no ts. |
fСnt |
fcnt |
42 |
fPort |
port |
1 |
frequency |
freq |
868100000 |
dr |
dr |
SF7 BW125 4/5 |
rssi, snr |
rssi, snr |
-87, 9.5. If the message has a gws array, the values of the gateway with the strongest signal. |
battery |
bat |
255 |
seqno, ack, offline, toa |
same names | 3040, false, false, 61 |
data, decoded, encdata, gws |
same names | The raw fields, when present. |
Test the Decoder
Click Test payload decoder below the editor. The dialog shows the last message that the converter received, or a LORIOT sample message, already split into Payload and Metadata. To test with the message from Decoder Inputs:
- Click Updated RAW payload.
- Replace Payload with the message. Keep Metadata: it holds the integration metadata, such as
integrationName. Click Apply. - Payload now shows
ALxhTl8JKVA=, the bytes of00bc614e5f092950, and Metadata shows the unwrapped keys, includingcmd=rx. Click Test.
The output shows the decoded data:
{ "attributes": { "sn": 12345678 }, "telemetry": { "ts": 1792652400000, "values": { "battery": 95, "temperature": 23.45, "saturation": 80 } }}If the output is empty or shows an error, fix the decoder and test again.
Use a Library Converter
The Converters library holds ready-made decoders for many LoRaWAN device models. They come from the thingsboard/data-converters repository, from the LORIOT folder of each model.
- In the Add data converter dialog, select the Loriot integration type, then switch Create new to Library. The Uplink data converter step of the integration wizard offers the same choice.
- Select the Vendor and the Model of your device.
- Name is filled in as
Loriot Uplink Converter for <Vendor> <Model>. Keep it or enter your own. - Review the decoder and the Advanced decoding parameters, and click Add.
A library decoder can work differently from the default one. Some entries use the generic decoder format, function decoder(payload, metadata): they receive the whole LORIOT message as payload and parse it themselves, and Advanced decoding parameters shows only the Update only keys list. The test button is then called Test decoder function, and the test payload is the whole LORIOT message. Check the decoder of your model before you use it.
Create the Integration
Section titled “Create the Integration”- Go to Integrations ⇾ Integrations and click + Add integration.
- Basic settings:
- Integration type — select Loriot.
- Name — keep the default
Loriot integrationor enter your own. - Enable integration and Allow create devices or assets — keep both on, so the device is created on its first message.
- Click Next.
- Uplink data converter:
- Click Select existing and choose
Loriot Uplink Converter. - Alternatively, click Create new to write a decoder here, or Library to load one for your device model.
- Click Next.
- Click Select existing and choose
- Downlink data converter:
- Click Skip. Add a downlink converter later if you need to send commands.
- Connection:
- Copy the HTTP endpoint URL. You need it for the HTTP Push output.
- To let ThingsBoard create the output for you, turn on Create Loriot Application output now (see Create the HTTP Push Output). Otherwise, leave the other parameters at their defaults. See Connection Settings for details.
- Click Add.
Connection Settings
Section titled “Connection Settings”| Parameter | Default | Description |
|---|---|---|
| Base URL | Address of the ThingsBoard server you are signed in to, for example https://thingsboard.cloud |
Used to build the endpoint URL. Must be a public address. Required. |
| HTTP endpoint URL | — | Read-only. Format: {Base URL}/api/v1/integrations/loriot/{integrationKey}, where integrationKey is a UUID assigned at creation. Accepts JSON bodies only. |
| Create Loriot Application output | Off | When the integration starts, it signs in to the LORIOT API and adds an HTTP Push output with the HTTP endpoint URL to the application, unless one already exists. Shows Credentials. |
| Send downlink | Off | Sends downlinks through the LORIOT API. Shows Downlink URL and Application Access Token. See Configure Downlink. |
| Server | eu1 |
Shown with either option above. LORIOT server, for example eu2. Required. |
| Domain | loriot.io |
Shown with either option above. The API address is https://{Server}.{Domain}/. |
| Application ID | — | Shown with either option above. ID of the LORIOT application, for example BE010A45. Required. |
| Credentials | Basic | With Create Loriot Application output. Basic signs in with your LORIOT account Email and Password. Security token sends a LORIOT API Token instead. |
| Downlink URL | https://{Server}.{Domain}/1/rest |
With Send downlink. Filled in from Server and Domain until you edit it. Required. |
| Application Access Token | — | With Send downlink. Access token of the LORIOT application, sent as a Bearer token. Required. |
| Enable security | Off | Accepts only requests that carry every listed Header with the exact Value in the Headers filter. See Secure the Endpoint. |
| Execute remotely | Off | Runs the integration as a separate process outside the ThingsBoard cluster. ThingsBoard generates an Integration key and Integration secret for it. LORIOT needs a public endpoint, so the standard setup keeps this off. See Remote Integration. |
| Replace response status from ‘No-Content’ to ‘OK’ | Off | In Advanced settings. Answers 200 OK instead of 204 No Content when the converter returned data. |
| Description | — | In Advanced settings. Free-text description. |
| Metadata | — | In Advanced settings. Key–value pairs added to the metadata of every message from this integration. |
The integration answers 204 No Content to an accepted request, 400 Bad Request on a converter script error, 403 Forbidden when the security check fails, and 500 Internal Server Error on other errors.
Create the HTTP Push Output
Section titled “Create the HTTP Push Output”The output tells the LORIOT application where to send device data. Create it in the LORIOT portal, or let ThingsBoard create it through the LORIOT API.
- In LORIOT, go to Applications and click your application.
- In the left menu, click Output, then click Add New Output.
- Select HTTP Push and click Continue.
- Optionally, enter an Output Name. Paste the HTTP endpoint URL of the integration into Target URL for POSTs, and click Continue.
ThingsBoard creates the output each time the integration starts, unless the application already has an HTTP Push output with the same URL. It needs access to the LORIOT API, which your LORIOT plan may not include.
- Open the integration in Integrations ⇾ Integrations and click Toggle edit mode (pencil icon).
- Turn on Create Loriot Application output.
- Enter the Server and Application ID (see Locate the Server and Application ID).
- Under Credentials, keep Basic and enter the Email and Password of your LORIOT account, or select Security token and enter a LORIOT API Token.
- Click Apply changes. The output appears in the Output list of the LORIOT application.
If the integration cannot create the output, it does not start, and its Events tab shows an error that begins with Failed to start Loriot integration.
Secure the Endpoint
Section titled “Secure the Endpoint”Anyone who knows the endpoint URL can send data to it. Add a secret header to the output and check it in ThingsBoard: the integration then rejects every request without the right value with 403 Forbidden, before the converter runs.
- In ThingsBoard, open the integration and click Toggle edit mode (pencil icon).
- Turn on Enable security.
- In Headers filter, click Add. Enter a Header, for example
Authorization, and a long random Value. A request must carry every header in the list. The header name is not case-sensitive. The value match is exact and case-sensitive. - Click Apply changes.
- In LORIOT, open the application, click Output, and click the ThingsBoard HTTP Push output.
- Click the pencil icon. Under Custom Headers, enter the same header name as the Key and the same Value, click Add New Custom headers, and click Save changes.
With Create Loriot Application output, ThingsBoard creates the output with the value of a filter header named exactly Authorization as the output’s authorization value. Other headers in the filter are not copied to the output.
Test Uplink
Section titled “Test Uplink”Send an uplink from the device, or simulate one with curl, then confirm that ThingsBoard decoded it and created the device.
Send a Test Uplink
Section titled “Send a Test Uplink”With a device: power on a LoRaWAN device registered in your LORIOT application and let it send an uplink.
With curl: send the example LORIOT message from Decoder Inputs straight to the integration. This skips LORIOT, so you can check the converter and the integration before a device is available. Replace $HTTP_ENDPOINT_URL with the HTTP endpoint URL of the integration:
curl -v -X POST "$HTTP_ENDPOINT_URL" \ -H "Content-Type: application/json" \ -d '{"cmd":"rx","seqno":3040,"EUI":"BE7A000000000552","ts":1792652400000,"fcnt":42,"port":1,"freq":868100000,"rssi":-87,"snr":9.5,"toa":61,"dr":"SF7 BW125 4/5","ack":false,"bat":255,"offline":false,"data":"00bc614e5f092950"}'If you turned on Enable security, add the header, for example -H "Authorization: $HEADER_VALUE". The integration answers 204 No Content.
Verify the Result
Section titled “Verify the Result”- Integration events — go to Integrations ⇾ Integrations, open the integration, and click the Events tab. The message appears as an event of type Uplink with status OK. Click
⋅⋅⋅in the Message column to see the LORIOT message. - Converter events — open
Loriot Uplink Converterin Integrations ⇾ Data converters and click the Events tab. In and Metadata show the LORIOT message and the integration metadata as they arrived, before unwrapping. Out shows the decoder result. - Device — go to Devices & assets ⇾ Devices. The integration has created the device
Device BE7A000000000552with thedefaultprofile. Open it and check:- Latest telemetry —
battery=95,temperature=23.45, andsaturation=80from the decoder, andfСnt=42,rssi=-87,snr=9.5, anddata=00bc614e5f092950from the Telemetry list.batterykeeps the decoder value, not thebatvalue255of the message. - Attributes (Client attributes) —
sn=12345678from the decoder, andeui,fPort,frequency, anddrfrom the Attributes list.
- Latest telemetry —
Configure Downlink
Section titled “Configure Downlink”ThingsBoard sends each downlink right away as a LORIOT API call. Nothing is queued in ThingsBoard: if the call fails, ThingsBoard records an error and drops the command. LORIOT queues the downlink and sends it to a Class A device after the device’s next uplink.
For each downlink, the integration:
- Runs the downlink converter on the Rule Engine message.
- Checks the encoder result:
metadata.EUImust have 16 hex digits, andmetadata.portmust be from1to223. - Sends
POST {Downlink URL}with the Application Access Token as aBearertoken and a JSON body like{"cmd":"tx","EUI":"BE7A000000000552","port":1,"appid":"BE010A45","data":"01"}.datais hex, andconfirmedis added when the encoder sets it.
For the full encoder reference, see Downlink data converter.
Get an Application Access Token
Section titled “Get an Application Access Token”- In LORIOT, open the application and click Access Tokens in the left menu.
- Copy an existing token, or click Generate another authentication token and copy the new one.
Create and Assign the Downlink Converter
Section titled “Create and Assign the Downlink Converter”Add a downlink converter to the integration and turn on Send downlink with the access token.
- Open the integration in Integrations ⇾ Integrations and click Toggle edit mode (pencil icon).
- In the Downlink data converter field, click Create new. The Downlink converter type and Loriot integration type are preselected.
- Enter a name, for example
Loriot Downlink Converter. - Main encoding configuration opens in TBEL with a generic encoder. It builds a JSON object from
temperatureUploadFrequencyandhumidityUploadFrequencyand sets an MQTTtopic, not theEUIandportthat LORIOT needs. Replace it with the encoder below. For JavaScript, use the TBEL / JS toggle and the JavaScript tab. - To record downlink events, click the debug button next to the name, select All messages, and click Apply.
- Click Add.
- Enable downlink: turn on Send downlink. Enter the Server and Application ID if they are empty, check the Downlink URL, and paste the token into Application Access Token.
- Click Apply changes.
Encoder used in this guide. It turns the shared attribute powerState into a one-byte command: 01 for on, 00 for any other value. It reads the device EUI and port from the eui and fPort client attributes, which the rule chain adds to the metadata as cs_eui and cs_fPort. A message without powerState produces no downlink.
/** Encoder **/
// Send a command only for the powerState shared attribute, for example {"powerState": "on"}.if (msg.powerState == null) { return [];}
return { contentType: "TEXT", // One byte as a hex string: 01 turns the device on, 00 turns it off. data: (msg.powerState == "on" ? "01" : "00"), metadata: { // Device EUI and LoRaWAN port, added by the rule chain from the client attributes. EUI: metadata.cs_eui, port: (metadata.cs_fPort != null ? metadata.cs_fPort : 1), // data is already hex: send it as is. isHexEncoded: true }};/** Encoder **/
// Send a command only for the powerState shared attribute, for example {"powerState": "on"}.if (msg.powerState == null) { return [];}
return { contentType: "TEXT", // One byte as a hex string: 01 turns the device on, 00 turns it off. data: msg.powerState === "on" ? "01" : "00", metadata: { // Device EUI and LoRaWAN port, added by the rule chain from the client attributes. EUI: metadata.cs_eui, port: metadata.cs_fPort != null ? metadata.cs_fPort : 1, // data is already hex: send it as is. isHexEncoded: true }};To check the encoder, click Test encoder function. Replace the Message with {"powerState": "on"}, add cs_eui = BE7A000000000552 and cs_fPort = 1 to Metadata, and click Test. The Output panel shows:
{ "contentType": "TEXT", "data": "01", "metadata": { "EUI": "BE7A000000000552", "port": "1", "isHexEncoded": true }}With {"temperature": 25}, the output is [], and nothing is sent.
The integration reads these fields from the encoder result:
| Field | Required | Description |
|---|---|---|
data |
Yes | Payload for the device. Without isHexEncoded, the integration sends the hex of the text, so "on" becomes 6f6e. |
contentType |
Yes | JSON, TEXT, or BINARY. For raw bytes, use TEXT with a hex string and isHexEncoded. With BINARY, the integration reads the decoded Base64 bytes as UTF-8 text, so bytes above 7F are changed. |
metadata.EUI |
Yes | Device EUI: 16 hex digits without dashes. Otherwise the downlink fails with Device EUI is missing in the downlink metadata! or Device EUI, 16 hex digits (without dashes)!. |
metadata.port |
Yes | LoRaWAN port, from 1 to 223. Otherwise the downlink fails with Port is missing in the downlink metadata! or Port should be on the range from 1 to 223!. |
metadata.isHexEncoded |
No | true — data is already a hex string and is sent as is. |
metadata.confirmed |
No | true — LORIOT sends a confirmed downlink. |
To send several downlinks from one message, return an array of results.
Configure the Root Rule Chain
Section titled “Configure the Root Rule Chain”The encoder needs the device EUI and port. Add them to the metadata with an originator attributes node, then pass the message to the integration.
- Go to Data processing ⇾ Rule chains and open the Root Rule Chain.
- From the Enrichment section, drag an originator attributes node onto the canvas:
- Name — for example
Retrieve eui and fPort. - Client attributes — add
euiandfPort. - Add originator attributes to — select Metadata. The node adds client attributes with the
cs_prefix:cs_euiandcs_fPort. - Click Add.
- Name — for example
- From the Action section, drag an integration downlink node onto the canvas:
- Name — for example
Downlink to Loriot. - Integration — select
Loriot integration. - Click Add.
- Name — for example
- Connect the message type switch node to
Retrieve eui and fPortwith the Attributes Updated relation. - Connect
Retrieve eui and fPorttoDownlink to Loriotwith the Success relation. - Click Apply changes.
Test Downlink
Section titled “Test Downlink”- Go to Devices & assets ⇾ Devices and open
Device BE7A000000000552, created in Test Uplink. - On the Attributes tab, select Shared attributes and click +.
- Enter Key
powerState, keep the String type, enter Valueon, and click Add.
Verify the Downlink
Section titled “Verify the Downlink”- Converter events — open
Loriot Downlink Converterin Integrations ⇾ Data converters and click the Events tab. In shows the message{"powerState":"on"}withcs_euiandcs_fPortin its metadata. Out showsdata01and theEUIandport. - Integration events — open the integration’s Events tab. Two events of status OK appear: Downlink: ATTRIBUTES_UPDATED for the message from the Rule Engine, and Downlink for the call to LORIOT, with the encoder
metadataandpayloadin its message. A failed call appears as a Downlink event with an error. - LORIOT — check either view:
- Device — open the device, go to LoRaWAN® Parameters, and scroll to Sequence Numbers. FCntQueue =
1shows a queued downlink that waits for the next uplink of the device. - Log — in the application, click Log in the left menu. A green HTTP entry with the device EUI and
cmdtxshows that LORIOT accepted the downlink.
- Device — open the device, go to LoRaWAN® Parameters, and scroll to Sequence Numbers. FCntQueue =
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| No events on the integration Events tab | The application has no HTTP Push output with the endpoint URL, the integration is disabled, or ThingsBoard is not reachable from the internet. Or debug mode is off: it records events for 15 minutes after you turn it on. | Check the Output list of the LORIOT application and copy the HTTP endpoint URL again. Turn on Enable integration. Turn debug mode on again. |
| Uplink events with status FORBIDDEN, and no converter events | The header in the LORIOT output does not match the Headers filter. | Enter the same header name and value in the output’s Custom Headers and in ThingsBoard. |
The integration does not start, with an error that begins with Failed to start Loriot integration |
Create Loriot Application output is on, and the API call failed: wrong Server, Application ID, or credentials, or no API access in your LORIOT plan. Maximum Application Output Limit Reached. is also shown when LORIOT does not find the application. |
Check the Server and Application ID, and the credentials. Or turn the option off and create the output manually. |
| Uplink events with status ERROR | The decoder failed, for example on a message without data. |
Check the Error column in the converter events. Keep the cmd check from this guide’s decoder, and match the byte offsets to your payload. |
| Uplink with status OK, but no device or data | The decoder returned an empty array, for example because cmd is neither rx nor gw. |
Check In and Out in the converter events. |
| Device not created | Allow create devices or assets is off. | Open the integration, click Toggle edit mode (pencil icon), turn the option on, and click Apply changes. |
The frame counter key looks like fCnt, but a widget or search with fCnt finds nothing |
The default key fСnt has a Cyrillic С. |
Use the key from Latest telemetry. Or remove fСnt from Telemetry and add values.fCnt = metadata['fСnt']; to the decoder, with the metadata key copied from the converter’s Metadata event. |
Telemetry data holds the hex payload |
data is in the default Telemetry list. |
Remove data, decoded, and encdata from Telemetry if you do not need the raw payload. |
| Wrong telemetry values | The byte offsets or scaling do not match the device payload, or LORIOT sends a decoded JSON object instead of data. |
Compare data in the converter’s In event with the payload specification of your device. For decoded, parse payload as JSON. |
| Downlink: ATTRIBUTES_UPDATED event, but no Downlink event | Send downlink is off, no downlink converter is assigned, or the encoder returned []. |
Turn on Send downlink and assign the converter. Check Out in the downlink converter events. |
| No downlink events at all | The rule chain does not route attribute updates to the integration. | Check the Attributes Updated relation and the Success relation to the integration downlink node. |
Device EUI is missing in the downlink metadata! |
The originator attributes node is missing, adds the attributes to the message instead of the metadata, or the device has no eui client attribute. |
Connect Retrieve eui and fPort with Add originator attributes to set to Metadata. Check the device’s client attributes. |
Port should be on the range from 1 to 223!, or a number format error for the port |
metadata.port is outside 1–223, or not a number. |
Set port to the port your device listens on. |
| Downlink ERROR with a LORIOT error response | The Application Access Token, Application ID, or Downlink URL is wrong, or the device is not enrolled in the application. | Copy the token again, check the Server, Application ID, and Downlink URL, and enroll the device. |
| The device receives other bytes than expected | data was sent as the hex of its text, or as BINARY. |
Return a hex string with contentType TEXT and isHexEncoded true. |
To read debug events, open the integration or converter, click Events, and select an event: In is the received data, Out is the converter result, and Error holds the error text.
See Also
Section titled “See Also”- Integrations overview — how integrations, converters, uplinks, and downlinks fit together.
- Typed uplink converter — the converter for LoRaWAN network servers.
- Converters library — ready-made decoders for device models.
- Downlink data converter — encoder reference.
- integration downlink node — route Rule Engine messages to an integration.
- originator attributes node — add attributes of the message originator, such as the device EUI, to the metadata.
- message type switch node — route messages by type, for example attribute updates.
- Remote Integration — run the integration outside the ThingsBoard cluster.
- TBEL — built-in functions and syntax for converter scripts.
- thingsboard/data-converters — source of the converters library.
- LORIOT documentation — applications, outputs, and the network server API.
Was this helpful?