The Things Stack keeps a queue of downlink messages per device. Applications can keep pushing downlink messages or replace the queue with a list of downlink messages.
You can schedule a downlink using the CLI, MQTT or HTTP webhooks.
This guide shows how to interact with the downlink queue from the command-line interface (CLI).
Command-line interface only
The instructions below use the command-line interface (CLI).
If there are more application downlink messages in the queue, the Network Server sets the LoRaWAN
FPending bit to indicate end devices that there is more downlinks available. In class A downlink, this typically triggers the device to send an uplink message to receive the downlink message. In class C, the Network Server automatically transmits all queued downlink messages.
We define some user parameters that will be used below:
APP_ID="app1" DEVICE_ID="dev1" PAYLOAD="01020304" PRIORITY="NORMAL" F_PORT="42"
Make sure to modify these according to your setup.
Push and replace downlink queue
To push downlink to the end of the queue:
ttn-lw-cli end-devices downlink push $APP_ID $DEVICE_ID \ --frm-payload $PAYLOAD \ --priority $PRIORITY \ --f-port $F_PORT
You must pass an
FPort with the
--f-port flag. Confirmed downlinks can be set using
To replace the existing queue with a new item:
ttn-lw-cli end-devices downlink replace $APP_ID $DEVICE_ID \ --frm-payload $PAYLOAD \ --priority $PRIORITY \ --f-port $F_PORT
The Things Stack limits the application downlink queue on 10k messages per end device. When this limit is reached, no more scheduled downlinks can be placed in the queue and The Things Stack will drop them. In order to avoid hitting the application downlink queue limit and loosing downlinks, we advise scheduling downlink messages in batches.
To see currently scheduled downlink messages:
ttn-lw-cli end-devices downlink list $APP_ID $DEVICE_ID
To clear scheduled downlink messages:
ttn-lw-cli end-devices downlink clear $APP_ID $DEVICE_ID