In this article, you will be instructed on how to create a LoRaWan device TTN integration with TagoIO. With this integration you are able to send data from your devices (uplink) to TagoIO and back to your devices (downlink).TTN & TagoIO Integration

TTN for Beginners

Make sure you already have configured your gateway and an application was created. If you need help  to do that, take a look at this video tutorial .

Adding Integration at TTN 

On the TTN console, go to your already created application, and then go to integrations and click add integration.

Select TagoIO from the integration list.

Here you fill in your Process ID, your access key and the Authorization.

The Authorization field is not required, but it adds security to your integration. Type any secret text there, and type the same text in the verification code when generating the token at TagoIO.

1. Uplink

For your application to authenticate to TagoIO, you need to register your device at TagoIO.

Go to the Tago admin, then go to Device, add a Device, and select the type: LoRaWAN TTN

Look for you specific device in the list, if it is not listed, you still can connect using the Custom TTN Device.

Fill in the required fields and click on 'Create Device'. 

For example, if you selected the 'Custom TTN Device' type, you will be presented with the following screen. Enter a Device Name and the Device EUI in the required fields. 
If you use the Authorization when doing the setup at the TTN, type the same secret text in the Authorization field here.

In some case you have the option 'Install Dashboard' if you want to add one default dashboard and edit it later.

When you're done, click on Create Device.

When your device sends data to TTN, a data package will be forwarded to TagoIO. 

Check the device 'Payload Parser' tab to see how the information is extracted from the payload. A standard parse  is added to this device, feel free to edit it in order to remove variables or do anything else.

More about Payload Parser can be found here.

2. Downlink

To send data back to your device, just go to the device list, select the device, and go to the Configuration Parameters tab. Shot 2018-06-18 at 09.53.49-64I.png

Here you can use two parameters for different data format.

It will send the raw payload to your device.
the payload fields value needs to be a valid JSON Object, and TagoIO will send that object to your device.

You can choose between these two data formats, or you can send both.

When your data is sent to TTN and scheduled to send to your device, your parameter will be marked as sent (Yes). To send the message again, set the switch to as not sent (No).