Quick Start

Set up and connect a Raspberry Pi to the cloud and publish a text message/email alert!

Install IoTFlows Remote Access

This package installs Node-RED, connects your device to the cloud, and allows you to remotely access the Node-RED running on your device or to ssh to your device from anywhere.

Prerequisites

To install IoTFlows Remote Access, you will need a supported version of Node.js.

  • If your operating system supports apt: sudo apt update sudo apt install npm sudo apt install nodejs

IoTFlows Console Setup

  1. Create an account in IoTFlows Console.

  2. Add a device and generate a Remote Access Key.

IoT Device Setup

Run the following commands on your device:

sudo npm install -g --unsafe-perm @iotflows/iotflows-remote-access
sudo iotflows-remote-access

Enter the Remote Access Key username and password. If the setup is successful, you will see a blinking green light in the console:

If you see the green light, your device has been successfully connected to the Cloud!
  1. In IoTFlows Console, create a Remote Connection for Node-RED or SSH and follow the instructions to remotely access your device.

  2. After rebooting your device, IoTFlow Remote Access will auto start on boot.

    • To stop the service: sudo systemctl stop iotflows-remote-access.service

    • To start the service: sudo systemctl start iotflows-remote-access.service

    • To disable the service: sudo systemctl disable iotflows-remote-access.service

Publish an Alert from your device

1. Create a Device API KEY:

From the side navigation tab of the device page, top on Create Device API Key. Set the name as Node-RED. Save the username and the password in a secured location., it will not be shown again.

2. Create an Alert Channel:

Navigate to the Alerts tab. Tap on Alert Channels and create a channel (to learn more go to Creating an Alert Channel). Select the alert channel. You should see the Alert Channel Topic, which you will need in the next steps.

Tap on the gear icon next to the alert channel and go to Manage Alert Channel Notifications. Set your personal preferences for receiving an alert from this channel (Go to Managing Alert Channel for details). Note that to receive a text message, you should verify your phone number first, which can be done in the Profile Button on the top right side of the screen.

3.Connect to Node-RED on your device:

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

You can change these credentials from the console (Go to Changing Raspberry Pi Username and Password for more details).

4.Configure Alert Channel Node in Node-RED:

From the nodes in the left navigation bar, drag and drop the alert channel out node. Go to Downloading IoTFlows Node-Red Nodes for installing instructions.

Double-click on the alert channel out node, and then double click on the edit button.

Here we will add the device client that will be used to publish your data.

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 device client should now be displayed as your server.

Next, we will click the refresh button in the Topic and select the Alert Channel that we will like to publish to.

Once everything is complete, click Done.

Publish an Alert from Node-RED:

  • Drag and drop an inject node.

  • Drag and drop a function node.

  • Connect the inject to function to alert channel out node, respectively.

  • Double-tap the function node and write this code:

msg.payload =
{
"severity_level": "MAJOR",
"subject": "An alert subject",
"description": "Description of the alert",
};
return msg;

Severity levels could be the following

  1. MAJOR

  2. MINOR

  3. INFORMATIVE

Important: Alert severities need to be CAPITALIZED when publishing. Failure to do so will result in you not receiving alert notifications, as well as not being able to filter results properly.

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

Tap the button of the inject node and you should receive an alert based on your alert channel notification preference!

Congratulations! You just securely connected a new Raspberry Pi to the cloud and published an alert to an alert channel!