The Things Network

DEPRECATED - Create Generic LoRaWAN Device Instead!

TheThingsNetwork integration is discontinued and has been replaced by the native integration of LoRaWAN devices! Please do not use the TTN integration anymore. It is no longer being developed and is unstable!

We now have something much better:

With Native Integration for LoRaWAN devices you can develop your payload decoders directly on Datacake. We also offer Ready-To-Go templates for standardized LoRaWAN products and integration for the following LoRaWAN network servers:

  1. TTN / TheThingsNetwork

  2. TTI / TheThingsIndustries

  3. Kerlink Wanesy

  4. Loriot

  5. Chirpstack

For more information, please refer to the following chapter:


This tutorial will guide you through the steps necessary to connect your TTN LoRaWAN devices to the Datacake Cloud.

In the end you have added a TTN device to the Datacake Cloud and can use it for the following things:

  • Create Dashboard

  • Use rules for alerting by e-mail, SMS

  • export data

  • Use Smartphone App

Create a user account

For this tutorial you need to register on the Datacake Cloud. So if you don't have a user account yet, please open the following link:

Log In

Once you have created your account, the Datacake Portal will open in the Fleet View. You should see the following content in your browser:

If you are not automatically logged in, please use the following link to log in to the Datacake platform via email and password.

You already have a Datacake account? Great! Then you can simply log in as usual using the link above.

Create your first device

Your TTN device requires a corresponding counterpart on the Datacake platform. For this reason we now create a so-called API device. Please click on the button "Add Device".

Now you will be asked for the type of device to be created. Please select "API" here (marked red).

Now enter a name for your first Datacake device. Use the blue marked text input field for this.

To create the device, complete the process and to continue with the necessary configuration, please confirm your entries by clicking on the "Add Device and configure" button.

Create Fields

The next step is to create fields in the database, which we fill with the measured values of your device via TTN integration.

Since we are already in the Configuration View, scroll down until you see the "Fields" section (Marked Green).

Here you click on the "Add Field" button (Marked Red) and you should see the following modal:

In this dialog the necessary information for the respective field must be created. In the following example we will create a field for a temperature value. This looks something like the following:

Name (Red)

Assign a name to your fields. This setting sets a plain text name that will later be visible everywhere in the portal. You can also change this name at a later time.

In this example we've been using the name "Temperature Celsius" as the field will hold a temperature reading in °C.

Identifier (Green)

By means of the "Identifier" the field is uniquely described and is also created in the database under this index. This value can only be defined during creation. You cannot change it afterwards.

In this case we set it to TEMPERATURE_C.

Type (Blue)

There are different field types for storing your measured values. In this example we use the type "Float", because we want to store a number with decimal places.

Formula (Pink)

The "Formula" setting can currently be ignored.


To confirm your entries and create the field, please use the "Save" button. The modal closes and you should now see your field listed in the list of fields.

Further information

If you want to learn more about the topic "Fields", please use the following link. Here you will also find information about the different field types and their differences as well as other useful information.

Activate TTN Integration

Now we activate the TTN integration. Below the Fields-Section you will find the Section, where all available integrations are listed. Just scroll down a little in the Configuration View.

To activate the TTN integration, just click on the "Configure" button. The following view will appear:

Set TTN Device-ID

In order for the integration to find your device in the TTN Console, the information of the Device ID must be entered in the configuration modal (Marked Red).

You can find this ID in the device overview in the TTN Console. The following screenshot shows you where: Copy this ID and paste it into the field.

Mapping Data

TTN or LoRaWAN devices send their data in a format that generates very small amounts of data. However, this format is not suitable for direct use in modern Web systems.

For this reason, TTN offers an option for creating converters that convert such small amounts of data into a corresponding, Web-compatible format.

TTN Payload Converter

You can find the settings for the converter in your TTN Console.

The converter is set in the area marked in green. This is done by means of a small JavaScript program, which you can either define yourself or which is included by the manufacturer of your TTN LoRaWAN device.

If you cannot find this converter, use Google to search for it. If your search is not successful or you have problems at this point, please contact our support. We are happy to help you.

Example Data Structure

In order for you to be able to use the data from your devices, we expect them to be sent to Datacake Integration in a specific format. The following example describes a compatible payload.

"app_id": "datacake-ttn-app",
"dev_id": "datacake-ttn-device-1",
"hardware_serial": "00A1246E51C41D6A",
"port": 1,
"counter": 0,
"payload_raw": "EQ==",
"payload_fields": {
"temperature": 17
"metadata": {
"time": "2020-02-06T09:51:17.422906848Z"

What Datacake Integration uses here are the so-called "payload fields" (payload_fields). In the example above we can see that the "Temperature" is embedded within these payload fields:

"payload_fields": {
"temperature": 17

This is exactly what we will use to map it to your Datacake device.

Here you can transfer any number of Payload Fields to the Datacake Integration. Payload information of this type could also look like this:

"payload_fields": {
"temperature": 17,
"humidity": 12.32,
"state": "ok",
"co2": 2394,
"battery_v": 2.42

Payload Decoder

function Decoder(bytes, port) {
var temperature = (bytes[0] << 8) | bytes[1];
return {
temperature: temperature / 100,

Set the Mapping

Now back to the Datacake Platform. Next we have to set the mapping of the TTN payload fields to the Datacake fields.

This is done via the "Field Mapping" option (marked red). On the left side, simply enter the desired field as it appears in the TTN Payload Fields. On the right side you select the corresponding Datacake field.

Depending on the number of fields you have, additional mappings can be added using the "Add Field Mapping" button at the bottom left.

Do not forget to confirm your entries with the "Save" button.

Set Webhook

The forwarding of data from the TTN Console is done via Webhook integration. You have to enter a corresponding Datacake URL for the integration as address in the TTN Console. This is done by creating an integration in the application in your TTN Console (the application to which the device is assigned).

To do this, navigate via the TTN Console to the application to which the device has been assigned to.

Next, click on "Integration" (marked red) in the tab bar and then on "add integration" (marked green). You are now asked to select the type of integration:

Now select the type "HTTP Integration". Clicking on the icon takes you to the configuration page for integration:

Now insert the following URL ( in the corresponding input field and set the settings for "Access Key" and "Method" as shown in the screenshot. For the "Process ID" you can choose a free, unique name.

Confirm your entry with the button "Add Integration". The connection between Datacake and TTN is now successfully established.


Your newly created Datacake API device has debugging capabilities. You can find these in the tab bar of the device under the item "Debug".

If you open it, you should see the incoming data if the forwarding was successful.

Use History

Another way to see if data arrives and is stored successfully is to call up the "History" of the device.

To do this, navigate to the "History" item using the tab bar. Now scroll down a little. There you will find a tabular list of all fields in the database. If data has been stored in the database, it is also shown here.

Create Dashboard

The data now runs into the Datacake Cloud and into your first device. Using the WYSIWYG Dashboard Editor we can now create our own dashboard for the device.

To do this, please click on the "Dashboard" menu item in the tab bar of the device. An empty dashboard should appear.

Activate Edit Mode

To edit the dashboard, the editor must be started. This is done by clicking on the Edit button at the right end of the tab bar (marked green in the above screenshot). You should see the following:

In the screenshot above, the right sidebar is marked red. This shows the available widgets that you can drag and drop onto the dashboard.

To place a widget on the dashboard, a "row" widget must first be placed. A first row is ready when you first edit it. This can be found on the screenshot in the area marked in blue.

You can later move the "rows" below each other in vertical order, as well as the individual widgets placed inside a " row". These can be arranged horizontally.

If you want to learn more about dashboards, please use the following link. We will now continue with the editing.

Place Widget

In the following example, we will drag a "Value" widget onto the dashboard and configure it. Select the appropriate widget (marked red) with the mouse and simply drag and drop it onto the existing "row".


To configure the widget and fill it with measurement data, move your mouse cursor over the config icon (marked red) and confirm with a click.

Next you will see the widget's configuration dialog. No matter which widget, the configuration is always opened in the same way. You should see the following:

Now use the red marked drop-down field to select the measured value field from your database whose content should be displayed with this widget.

Once you have selected the field, the other fields will be filled in automatically, provided the information is available in the field. You are welcome to modify or overwrite this information. If the information is not in the field, you must enter it yourself.

Now confirm the configuration by clicking on the "Save" button. The modal closes.

To close the dashboard and leave the editor, use the button at the upper right end of the tab bar.

The dashboard then switches to live mode and displays the current measurement data.

Congratulations! You have now created your first dashboard. As soon as new values are received from the device via TTN integration, they are automatically updated in the dashboard!

If you have created more measurements, you can now drag additional widgets onto the dashboard. Just experiment with the different types or create a graph widget.

For further documentation on the dashboards and widgets please use the following link:

Creating Rules

Now we will show you how to use the rule engine to create rules that send an SMS or e-mail when a defined limit is exceeded.

Please switch to the rule editor using the tab bar.

To create a rule, please click on the button "Add Rule" (marked green in the screenshot above). You should now see the following dialog / modal:

We now simplify this example and attach the following screenshot. Simply insert the rule in your page according to the information shown in the following screenshot.

With this setting you create a rule that sends you an e-mail if the temperature measurement value is greater than 25°C.

You can further customize this rule and/or create additional rules. To learn more about rules and their functions in detail, please use the following link. This will take you to the corresponding documentation.

Now confirm your entries by clicking on the "Save" button. The rule is created in this way and when you switch back to the Rule Engine overview (middle tab bar), you should find your rule listed in the overview.

Datacake App

With the free and native Datacake app you can have your TTN devices on your smartphone. The app mirrors the web dashboard and its widgets on a mobile optimized version. All changes on the web interface are immediately transferred to the app. There is no faster way to get an app!