Drogue IoT Cloud setup

We will need to create a new application inside Drogue Cloud and register a device with it. We will also enable the TTN integration so that application and device will be synchronized with the TTN system.

Create a new application

Simply create a new application using drg, enabling the the TTN integration for the application by adding the .spec.ttn section:

Application name

By default, the Drogue IoT application name will also be used as the TTN application name. The name must be unique in both systems. You have the ability to override the application name, when synchronizing with the TTN system. However, this only makes things complicated. So try to come up with a name that should still be free.

drg create app my-app --spec '{
    "ttn": {
        "api": {
            "apiKey": "...", (1)
            "id": "my-app-alias", (2)
            "owner": "my-user-name", (3)
            "region": "eu1" (4)
        }
    }
}'
1 The API key, generated earlier.
2 (Optionally) An alternative application name in the TTN system. By default, this is the Drogue application name.
3 The name of the TTN user, selected when creating the TTN account.
4 The cluster region, selected when creating the TTN account.

Create device with TTN integration

Next, create a device and enable the TTN synchronization:

drg create device my-device --app my-app --spec '{
    "ttn": {
        "app_eui": "0000000000000000",
        "dev_eui": "0123456789ABCDEF", (1)
        "app_key": "0123456789ABCDEFGHIJKLMNOPQRSTUV", (2)
        "frequency_plan_id": "...", (3)
        "lorawan_phy_version": "PHY_V1_0",
        "lorawan_version": "MAC_V1_0"
    }
}'
1 A 8 byte device identifier. This could be provided by the device manufacturer or randomly generated by the user.
2 A 16 byte application key. IMPORTANT This should be changed to a secret value.
3 An ID of the TTN supported frequency plans, e.g. EU_863_870_TTN. Also see: https://www.thethingsindustries.com/docs/reference/frequency-plans/

You can easily generate values for dev_eui or app_key from the command line like

openssl rand -hex 16 | tr [a-z] [A-Z]

while changing the the appropriate byte size as needed.

Checking the results

Once you created the TTN settings, you should see a .status.ttn section for both of the resources. This section should show the state of the reconciliation process.

If both resources are successfully reconciled, you can proceed.