Publishing Data Stream from Node-Red Manual
From the nodes in the left navigation bar, drag and drop the output mqtt node.

Double click on mqtt node, click on the pencil/edit button and set these parameters to configure the connection:

- Connection Tab Parameters:
Parameter | Value |
Server | mqtts.connect.iotflows.com |
Port | 443 |
Enable secure (SSL/TLS) connection | Checked |
Client ID | Your-Device-API-Key-Username |
Keep alive time (s) | 60 |
Use clean session | Checked |
Use legacy MQTT 3.1 support | Checked |

- Security Tab Parameters:
Parameter | Value |
Username | Your-Device-API-Key-Username |
Password | Your-Device-API-Key-Password |

Node-Red Security Parameter

Node-Red Security Parameters from IoTFlows
After the configuration is done, press the ADD
Once it has been added, click DONE.
Publish a Data Stream from Node-RED:
- Drag and drop an inject node.
- Drag and drop a function node.
- Connect the inject to function to mqtt node, respectively.

- Double-tap the function node and write this code:
msg.topic = "YOUR-DATA-STREAM-MQTT-TOPIC";
msg.payload =
{
"data": "Data from sensor",
"data_stream_id": "YOUR-DEVICE-DATA-STREAM-ID",
"client_id": "YOUR-DEVICE-CLIENT-ID"
}
return msg;


- From the top right corner of Node-RED, tap Deploy.

- Tap the button of the inject node and you should receive a data stream.

Last modified 2yr ago