# Downlinks

The **Downlinks** tab allows you to configure and add downlinks. Once created, each downlink can be sent manually to the device.

To add a downlink, click on the **Add Downlink** button. The **Add Downlink** modal opens.

In the **Name** text box, enter a **name** for the downlink.

In the **Comment** text box, enter additional details about that downlink.

There are two options that you can enable by turning on the following toggle buttons:

* **Pass payload data to downlink** - pass the last uplink payload to the downlink.
* **Activate after uplink** - send the downlink after receiving an uplink.

The downlink payload can be configured using either the **Default** or **Custom** options:

**Default**:

In the **Default** tab, you can configure the downlink payload by providing suitable values for each data field. When you enter values, make sure that they are in the valid range and type.

{% hint style="info" %}
These data fields appear in the Add **Downlink** model box only if they have been added to the **device type** under the **Downlink Data**. To ensure the correct functioning of the downlink, a valid **downlink payload formatter** must also be added to the device type under the **Downlink Data.**
{% endhint %}

Click on the **Save** button.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2F9lt3mSCRPLDXSclsSIrD%2Fdevice-31.png?alt=media&#x26;token=c187162a-9d31-4a06-b4a7-79c01750384f" alt="" width="394"><figcaption></figcaption></figure>

**Custom**:

In the **Custom** tab, you can write a custom **downlink payload decoder**, for example, something like this.

```
function decode(payload, params) { 
const red = ('00' + payload.red.toString(16)).slice(-2) 
const green = ('00' + payload.green.toString(16)).slice(-2) 
const blue = ('00' + payload.blue.toString(16)).slice(-2) 
const on = ('00' + payload.on.toString(16)).slice(-2) 
const off = ('00' + payload.off.toString(16)).slice(-2) 
return ${red}${blue}${green}${on}${off} 
}
```

Click on the **Save** button.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2F5GvH0H690fPs2fMu5FoR%2Fdevice-32.png?alt=media&#x26;token=0194b0d3-e7ea-4e4d-9127-da8750f6aac7" alt="" width="393"><figcaption></figcaption></figure>

Once added, the downlink will be displayed in the **Downlinks** tab. Similarly, you can add more downlinks that can be used to control different functionalities of a device.

Click on the **Send** button to send the downlink to the device.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FMcDoLn064NmFIc54UNLo%2Fdevice-33.png?alt=media&#x26;token=c31b2cdc-b8b7-4b58-9441-1a938e84f2a2" alt=""><figcaption></figcaption></figure>
