DeviceChain
English
Download
Integrations · The Things Stack v3

The Things Stack integration for DeviceChain

If your LoRaWAN devices report to The Things Stack, a custom webhook on the application can forward each uplink to DeviceChain. DeviceChain stores what your payload formatter produced, or what a payload decoder on the device profile decodes, as ordinary measurements, so the readings reach history, live state, dashboards and rules like any other. The device never connects to DeviceChain.

The Things Stack v3

How it is wired

You create an integration in the console with the sender type The Things Stack v3, choose whether devices are matched by DevEUI or by device id, scope it to device types, and copy its bearer token. The token is generated by the server, shown once, and stored only as a keyed digest.

In The Things Stack you add a custom webhook with the JSON format, set its base URL to the integration's URL, send the token in an Authorization header, and enable the uplink message event with the path /uplink-message. The platform also reads the paths /up, /uplink and /uplinks.

The Things Stack v3

What the platform reads

Without a payload decoder on the device's profile, the platform stores the formatter's output, so set a payload formatter on the application or on the device; the LoRaWAN Device Repository offers one for many sensors. Without either, the uplink is counted as undecoded instead of stored. With a payload decoder on the profile, DeviceChain decodes the frame itself.

When confirmed downlinks are in use, the downlink_ack, downlink_nack, downlink_sent and downlink_failed events are read too; enable them on the webhook with paths that start with downlink. A message posted to any other path, such as a join accept, is answered with 204 and ignored. The message time is the uplink's received_at, which must be present and not older than 366 days.

The Things Stack v3

Matching devices

Add each device in DeviceChain with its DevEUI as a lorawan.deveui alias, or with its device id as a tts.device-id alias if you chose to match by device id. A device outside the integration's scope, or no device at all, means the message is not stored.

The Things Stack v3

Commands

When the operator switches LoRaWAN downlink on, a published lorawan_downlink connector names the Things Stack application, and a command to a device with a tts.device-id alias is queued there as a downlink. Its parameters are the raw port and payload, or typed values that an encoder on the command definition turns into bytes.

An unconfirmed downlink succeeds when the network server queues it, which is not an acknowledgement from the device. A confirmed downlink waits for the device to acknowledge it; an uncertain failure, or no answer by its deadline, leaves the outcome unknown.

The Things Stack v3

Trust

The bearer token speaks for every device of the scoped types that has an alias for it, and there is no payload signature, so use TLS, scope the integration narrowly and rotate the token if it may have been exposed.

Not yet

What it does not do.

Inbound integrations: The Things Stack v3 → · Transport matrix → · All integrations →