---
title: Node-RED Guide
description: Connect a Node-RED flow to ControlCom Connect over MQTT-TLS: create a Device, download certificates, configure the MQTT out node, and send a test payload.
source: https://documentation.controlcomtech.com/build/guides/node-red
---

# Using Node-RED with ControlCom Connect

Node-RED is a browser-based, flow-driven editor for wiring devices and services together. This guide walks through
connecting a Node-RED flow to ControlCom Connect over MQTT-TLS: create a Device, download the certificates, configure
the MQTT out node, and send a test payload.

> **Workflow Stage: Connect & Collect**

## Overview

The integration uses MQTT over TLS. The platform issues a per-Device certificate bundle (device certificate, public key,
private key, Amazon Root CA 1 2048). Node-RED's built-in MQTT out node connects to the platform's broker using those
certificates and publishes payloads that the platform routes into the Device's Variables.

## Prerequisites

* Node-RED 2.0.0 or higher. ([installation guide](https://nodered.org/docs/getting-started/installation))
* A ControlCom Connect account with an Organization you can add Devices to.

## Create a Device

1. Go to [https://console.controlcomtech.com/](https://console.controlcomtech.com/) and log in.
2. Navigate to **Administration → Devices**.
3. Click **\[New Device]**.
4. Select **Generic Device**.
5. Enter a name and description.
6. Click **Create**.

![ControlCom Connect Device List Page](https://documentation.controlcomtech.com/images/node-red-connect/device-list-page.png)

*Device list page in ControlCom Connect*

![Creating a new device in ControlCom Connect](https://documentation.controlcomtech.com/images/node-red-connect/create-new-device.png)

*Creating a new device in ControlCom Connect*

## Add a Variable

The Device needs at least one Variable to receive data. For this walkthrough, create a `temperature` Variable:

1. Open the Variables section of the newly created Device.
2. Click **Add Variable**.
3. Fill in:
   * **Variable Name**: `temperature`
   * **Description**: Temperature readings from the device
   * **Topic Property Path**: `temperature` (must match the key used in the MQTT payload)
   * **Type**: `Number`
   * **Unit**: `°`
4. Click **Add Variable**.

![Adding a temperature variable in ControlCom Connect](https://documentation.controlcomtech.com/images/node-red-connect/variable_add_new_modal.png)

*Adding a temperature variable in ControlCom Connect*

## Download Certificates

After Device creation, the platform displays the certificate bundle:

1. Download the device certificate, public key, private key, and Amazon Root CA 1 2048.
2. Tick **"I agree that I've downloaded the files above"**.
3. Click **Continue**.

Store these files securely. You cannot re-download them later.

![Saving device certificates in ControlCom Connect](https://documentation.controlcomtech.com/images/node-red-connect/device-create-save-certs.png)

*Downloading security certificates for your device*

## Connection Details

The next screen shows the MQTT connection parameters. Copy them somewhere safe. You'll plug them into the Node-RED MQTT
broker config.

* **Endpoint**: the MQTT broker URL.
* **Client ID**: the Device's unique identifier.
* **Topic**: the topic to publish and subscribe to.

![MQTT connection details for ControlCom Connect](https://documentation.controlcomtech.com/images/node-red-connect/device-mqtt-connection-details.png)

*MQTT connection details for your device*

## Build the Node-RED Flow

### Configure the MQTT broker

1. In Node-RED, drag an **MQTT out** node onto the canvas.
2. Double-click the node. Click the pencil icon next to **Server** to add a new broker.
3. In the broker config:
   * **Server**: the endpoint from the connection details.
   * **Port**: `8883` for secure MQTT.
   * Tick **Use TLS**.
   * Click the pencil icon next to **TLS Configuration** to add a TLS config.
4. In the TLS config:
   * Upload the device certificate (`*certificate.pem.crt`).
   * Upload the private key (`*private.pem.key`).
   * Upload the CA certificate (`AmazonRootCA1.pem`).
   * Click **Add**.
5. Back in the broker config:
   * Set **Client ID** to the value from the connection details.
   * Tick **Use clean session**.
   * Click **Add**.
6. In the MQTT out node:
   * Set **Topic** to the value from the connection details.
   * Click **Done**.

![Adding a new MQTT server in Node-RED](https://documentation.controlcomtech.com/images/node-red-connect/edit_mqttout_add_server.png)

*Adding a new MQTT server in Node-RED*

![Configuring TLS for MQTT in Node-RED](https://documentation.controlcomtech.com/images/node-red-connect/edit_mqtt_add_new_tls.png)

*Configuring TLS security for MQTT connection*

![Configuring MQTT out node in Node-RED](https://documentation.controlcomtech.com/images/node-red-connect/edit_mqtt_out_node.png)

*Configuring the MQTT out node in Node-RED*

### Send a test payload

1. Drag an **Inject** node onto the canvas; wire it to the MQTT out node.
2. Double-click the Inject node.
3. Delete the `.topic` property. The topic is already set on the MQTT out node.
4. Set the payload type to **JSON** and enter:

```json
{
    "dataArray": [
        {
            "key": "temperature",
            "value": 24.5
        }
    ]
}
```

5. Click **Done**, then click **Deploy**.
6. Click the small button on the left side of the Inject node to send the payload.

![Configuring Inject node with JSON payload in Node-RED](https://documentation.controlcomtech.com/images/node-red-connect/edit_inject_node.png)

*Configuring the Inject node with temperature data payload*

The platform routes the `temperature` key to the matching Variable on the Device. Check the Device detail page to
confirm the value `24.5` arrived.

For more information on payload formats and data transmission, see the [Sending Data](https://documentation.controlcomtech.com/build/sending-data)
documentation.

Once configured, your Node-RED flow will be able to securely connect to the ControlCom Connect platform and send data.

## Best Practices

This section will be developed soon with best practices for using Node-RED with ControlCom Connect.
