The Things Stack
Last updated
Last updated
The Things Stack is a LoRaWAN network server that provides secure connectivity and management for LoRaWAN devices in production. Widgelix can be integrated with The Things Stack using webhooks. A webhook is an HTTP request (callback) that transfers data when triggered by an event. Once you create a webhook, Widgelix can read/write data from/to its endpoint.
In Widgelix, click on Device in the left menu. The Devices page will be displayed, showing all the devices added to your organization.
Click on the device name for which you want to configure its connectivity.
On the Device page, click on the Settings tab.
In the Connectivity section, click on the light blue rectangular area displaying a disconnected adapter/The Things Stack icon and the text 'Not Configured'. The Things Stack is selected by default.
The Network Server model will be displayed.
Click on The Things Stack in the list of network servers. The Things Stack is selected by default.
Configuring uplinks enables The Things Stack to forward uplink messages from the end devices to Widgelix. Widgelix exposes an HTTP(S) endpoint, and its base URL is as follows:
https://app.widgelix.com/v1/input-node/ttn
When an uplink event occurs in The Things Stack, the uplink payload will be sent to Widgelix.
In the Uplink section, turn on the Secure option.
Copy the API Key by clicking the Copy button. You will need this key in the Configuring The Things Stack section.
Configuring downlink settings enables Widgelix to send downlink messages to end devices via The Things Stack.
In the Downlink section, configure the following:
Device ID - This is the ID of the device to which you want to send the downlink message. You can find it in the End devices list within your The Things Stack application, and it's typically prefixed with 'eui' (e.g., eui-0004a30b00xxxxxx
).
URL - The server address for The Things Stack, https://eu1.cloud.thethings.network
for example. To find the server address for different The Things Stack deployments, please refer to the Server Addresses section in The Things Stack documentation.
Application Id - The Application ID associated with this device in The Things Stack.
API Key - The API key you have created with write downlink application traffic rights in The Things Stack. Read the Creating Downlink API Key section to learn more about that.
Port - The frame port (fPort) of the downlink. The default value is 0.
Webhook Id - The Webhook ID you have given in The Things Stack for this integration.
The Things Stack offers a webhook template for Widgelix that you can instantiate to set up a new webhook. The webhook you will create enables you to forward your LoRaWAN device data from The Things Stack to Widgelix.
On The Things Stack, click on Integrations and then click on Webhooks.
On the Webhooks page, click on the + Add webhook button.
Scroll down the page and choose the Widgelix webhook template.
On the Setup webhook for the Widgelix page, configure the following mandatory settings.
In the Webhook ID text box, enter a unique name for your webhook, avoiding spaces in the name.
In the API Key text box, paste the API Key you have copied from the Widgelix in the previous section.
After configuring, click on the Create Widgelix webhook button.
You will be navigated to the Webhooks page and your newly created webhook can be found in the webhooks list.
Now Widgelix can accept uplinks from your LoRaWAN end device.
To confirm, navigate to the Devices page on Widgelix, and then click on your device's name. You'll be able to see that your device is online (check the 'Last seen' status) and that the dashboard is populated with incoming uplink data (if you have added any widgets to the dashboard).
To send downlinks from Widgelix, first, you should create an API key with the downlink traffic writing rights in The Things Stack console.
In your The Things Stack application, click on API keys in the left menu.
Click on the + Add API key button.
On the Add API Key page, under Rights, click on the Grant individual rights option, and then select the Write downlink application traffic option. Afterwards, click the Create API Key button.
The API key information modal will be displayed. Click on the Copy button to copy the API key. Make sure to save the copied API key in a text file because you will need it to configure the downlink settings in Widgelix.
After copying the API key, click on the I have copied the key button.
Make sure to save the API key now, as it won't be recoverable once you navigate away from this page.
You will be navigated to the API keys page, where you can see your newly created API Key ID with the 'write downlink application traffic' rights.