Publishing a Data Stream

Publishing a Data Stream from Node-RED in Raspberry Pi

In this example, you will see how to publish Data Streams from your Raspberry Pi Node-Red application.

If you have not done so, start at 1. Create a Device Client, if you have, continue to 2. Create a Data Stream‚Äč

NOTE: One Node-Red device client is sufficient for cloud communication in Data Streams, Alerts and Actions.

1.Create a Device Client:

From the side navigation tab of the device page, click on Create Client. Set the name as Node-RED (or any publishing client). Save the Client ID and the Password in a secured location.

2.Create a Data Stream :

From the side navigation tab of the device page, click on Create Data Stream. Set the name, description, and units to the type of data that you will be receiving.

3.Connect to Node-RED on your Raspberry Pi:

From the side navigation tab of the device page, activate the Node-RED Connection, and connect to Node-RED.

Activate Node-Red Remote Access
Connect to Device Node-Red Remotely

Once you are in the Node-Red page, the default credentials are:

  • username: admin

  • password: password

IMPORTANT: We strongly recommend that you change the username and password

To change Node-Red credentials, click on the Credentials button on the device page.

4.Configure the Data Stream Out Node in Node-RED:

From the nodes in the left navigation bar, drag and drop the datastream out node.

Double-click on the datastream out node and click on the edit button for the server

Here we will add the client that will be used to publish data into our table.

NOTE: If you have previously configured any nodes with your Client Id and Password, your node should already be configured, if not you need to add your Client Id and Password by clicking the edit button in the Server row, for more information on setting up a client go to Creating a Device Client.

Your client should now be displayed as your server.

Next, we will click the refresh button in the Topic row and select our Data Stream

Click Done.

5. Publish Data Stream to IoTFlows Console

Next, you connect any sensor that is receiving data into the data streams out node and click Deploy.

For the purpose of simplicity, we will use an inject node and trigger it to publish a data stream when it is clicked.

Insert inject node and connect it the data streams out node

Double-click on the inject node and configure it to publish a value of 10 in 5 seconds intervals.

Click Done.

Click Deploy and click your inject node. You will now be able to see data streams published in your IoTFlows Data Streams table.