ThingsBoard PE Feature
Only ThingsBoard Professional Edition supports Platform Integrations feature.
See Get ThingsBoard PE to install ThingsBoard PE.
TheThingsNetwork is LoRaWAN network designed for connecting your devices using LoRaWAN stack. After integrating TheThingsNetwork with the Thingsboard, you can connect, communicate, process and visualize data from devices in the Thingsboard IoT platform.
The first step is to create an application in TheThingsNetwork console. Go to console, open Applications section, press add application button and fill required fields.
Handler registration - used to identify region where application will be registered. In our example it will be eu region.
Our device submits data in binary format. We have 2 options where to decode this data:
In this tutorial, we will make an initial transformation into JSON with TTN decoder and then use Thingsboard converters for correct data processing. In real life scenario, it is up to you where to decode/encode data, because it is possible to do this on any side.
After application registered in TTN, go to payload_formats, select decoder function. We will take the first byte as a temperature value from a device and transform it into JSON.
Press Save payload function
Next step is a Device creation in the TTN. Open Devices page and press register device
Press Register button.
In the TheThingsNetwork, we already make all required configuration (register device, decoder function, and register application). Now we can start configuring the Thingsboard.
First, we need to create Uplink Data converter that will be used for receiving messaged from the TTN. The converter should transform incoming payload into the required message format. Message must contains deviceName and deviceType. Those fields are used for submitting data to the correct device. If a device was not found then new device will be created. Here is how payload from TheThingsNetwork will look like:
We will take dev_id and map it to the deviceName and app_id map to the deviceType. But you can use another mapping in your specific use cases. Also, we will take the value of the temperature field and use it as a device telemetry.
Go to Data Converters and create new uplink Converter with this function:
For sending Downlink messages from the Thingsboard to the device inside TTN, we need to define downlink Converter. In general, output from Downlink converter should have the following structure:
Go to Data Converters and create new downlink Converter with this function:
This converter will take version field from the incoming message and add it is a payload field in the outbound message. Destination device is a thermostat_a device.
Next we will create Integration with TheThingsNetwork inside the Thingsboard. Open Integrations section and add new Integration with type TheThingsNetwork
Lets verify our integration. Go to the device thermostat_a page in TheThingsNetwork. Scroll to the Simulate Uplink section. Our device will publish temperature 0F (15). So enter 0F into payload field and press Send button.
Go to Device Group -> All -> thermostat_a - you can see that
For testing Downlink Messages, we will update our Root Rule Chain to send downlink message when device attribute is changed. Open and edit Root Rule Chain. Add Integration Downlink Action node and connect it with the Message Type Switch Node using relation Attributes Updated
Go to Device Group -> All -> thermostat_a -> attributes section. We will add Shared attribute with name version and value v.0.11
By making this step, we triggered downlink message to the device thermostat_a and this message should contains version field value. Open TTN Console, navigate to tb_platfrom application, to the section Data. And we see that Downlink message was received.
With this integration you can also configure Downlink converters and trigger required actions using Rule Engine nodes.
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Installation guides - Learn how to setup ThingsBoard on various available operating systems.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Advanced features - Learn about advanced ThingsBoard features