Skip to main content

reComputer R1000 with FlowFuse

Introduction

FlowFuse enhances Node-RED by adding features for collaborative development, managing remote deployments, supporting DevOps delivery pipelines, and hosting Node-RED applications. It serves as a DevOps platform specifically designed for the development and delivery of Node-RED applications, making it easier for teams to work together and deploy their projects efficiently.

Getting Start

Before you start this project, you may need to prepare your hardware and software in advance as described here.

Hardware Preparation

reComputer R1000

Software Preparation

Installing Node.js for FlowFuse on a reComputer

To prepare your reComputer for FlowFuse, you need to install Node.js. Follow these steps to install Node.js version 20:

  1. Preparing for the Node.js Repository

First, update your package list and install the necessary certificates and tools:

sudo apt update
sudo apt install -y ca-certificates curl gnupg
  1. Setting Up the NodeSource Repository

Next, set up the NodeSource repository on your reComputer:

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
  1. Adding the Node.js Repository

According to FlowFuse documentation, it is recommended to install Node.js version 20. Set the NODE_MAJOR variable to 20:

NODE_MAJOR=20

Add the Node.js repository to your reComputer’s sources list:

echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

Update your package list again to include the Node.js repository:

sudo apt update
  1. Installing Node.js

Finally, install Node.js:

sudo apt install nodejs

Now you have Node.js version 20 installed on your device.

To start using FlowFuse, you'll need to create an account and verify your email. Follow these simple steps:

Create an Account

  1. Visit the Registration Page:

  2. Fill in the Registration Form:

    • Username: Choose a unique username.
    • Full Name: Enter your full name.
    • Email: Provide a valid email address.
    • Password: Create a strong password.
  3. Submit the Form:

    • After filling in all the required fields, click on the 'Create Account' button.
  1. Check Your Email:

    • Go to your email inbox and look for a verification email from FlowFuse.
  2. Open the Verification Email:

    • Open the email and using the code verify email.
  3. Return to the FlowFuse Login Page:

    • Go to the FlowFuse login page.
  4. Enter Your Credentials:

    • Username/Email: Enter the username or email you registered with.
    • Password: Enter your password.
  1. Login:
    • Click on the Login button to access your FlowFuse account. and you may ask to create a team.

Creating an Application in FlowFuse

To organize your Node-RED instances, they are grouped within Applications. Within your Application, you can have one or more Instances of Node-RED. The Instance is a customized version of Node-RED that includes various FlowFuse plugins to integrate it with the platform.

  1. Navigate to the Application Section:
    • On the FlowFuse dashboard, click on Create Application.
  1. Fill in the Application Details:
    • Name: Enter a name for your application.
    • Description: Provide a brief description of your application.
    • Instance Name: Choose a name for your Node-RED instance.
    • Blueprint: Select Blank Workspace as the blueprint.
    • Node-RED Version: Choose the latest Node-RED version from the dropdown menu.
  1. Create the Application:
    • After filling in all the details, click on the Create button.

Creating a Flow in FlowFuse

Let's create a flow in Node-RED to generate a random number and display it on a dashboard. If you're new to Node-RED, you can visit our Node-RED Getting Started guide. Steps to Create a Flow

  1. Open Node-RED Editor:
    • Go to your instance and select the instance you just created.
    • Click on Open Editor to launch the Node-RED editor.
  1. Install Required Nodes:
    • You may not see the random node and gauge node by default. To install these:
    • Go to the top-right menu, select Manage palette.
    • Go to the Install tab.
    • Search for Random and Dashboard nodes and install them.
  1. Create the Flow:
    • Copy the following flow and import it into your Node-RED editor to save time:
[
{
"id": "fd017c5f719054f5",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "45888468a69bbabb",
"type": "random",
"z": "fd017c5f719054f5",
"name": "Random",
"low": 1,
"high": "100",
"inte": "true",
"property": "payload",
"x": 340,
"y": 160,
"wires": [
[
"ce3820147521aaa6"
]
]
},
{
"id": "5e571c440b2340e9",
"type": "inject",
"z": "fd017c5f719054f5",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 160,
"wires": [
[
"45888468a69bbabb"
]
]
},
{
"id": "ce3820147521aaa6",
"type": "ui_gauge",
"z": "fd017c5f719054f5",
"name": "",
"group": "7ac87662e9cf0550",
"order": 0,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Random Number",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 670,
"y": 160,
"wires": []
},
{
"id": "7ac87662e9cf0550",
"type": "ui_group",
"name": "Default",
"tab": "0dc7fe4a8add5b68",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "0dc7fe4a8add5b68",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
  1. Deploy the Flow: -Click on the Deploy button in the top-right corner to deploy your flow.

Adding and Configuring a Device in FlowFuse

  1. To add and configure a device in FlowFuse, follow these steps:
  • In the FlowFuse dashboard, navigate to the Devices section.
  • Click on the Add Device button.
  • Fill in Device Details
  • Click the Add button to create your device.
  1. Copy the Device Configuration
  • After adding the device, you will be presented with a Device Configuration.
  • Under the manual instructions, copy the provided code snippet. You will need these credentials to connect the device with the FlowFuse cloud.

Installing the Device Agent

On your reComputer terminal, run the following command to install the FlowFuse device agent:

sudo npm install -g @flowfuse/device-agent

Configuring the Device Agent

  1. Create Configuration Directory: - Run the following command one by one to create the configuration directory and set the appropriate permissions:
   sudo mkdir /opt/flowfuse-device
sudo chown -R $USER /opt/flowfuse-device
sudo su
cd /
cd opt/flowfuse-device
  1. Create and Edit Configuration File:** - Open a new configuration file named device.yml:
nano device.yml
  • Paste the copied device configuration into this file and save it by pressing Ctrl + X, then Y, and Enter.
  1. Run the Device Agent: - Execute the following command to start the FlowFuse device agent:
flowfuse-device-agent --port=1881

Your device is now configured and connected to the FlowFuse cloud, ready for use.

Deploying the Flow to a Device

To deploy the flow to your device, you need to create a snapshot of your Node-RED instance and push it to the reComputer terminal. Follow these steps:

Create a Snapshot

  1. Navigate to the Application:
    • Go to your FlowFuse application and select the instance you created.
  1. Select 'Snapshot':
    • Click on the Snapshot option in the instance menu.
  1. Create a New Snapshot:
    • Since there are no snapshots yet, you need to create one.
    • Click on Create Snapshot.
  1. Fill in Snapshot Details:
    • Name: Enter a name for your snapshot.
    • Description: Provide a brief description of the snapshot.
    • Set as Target: Tick the box to set this snapshot as the target.
  1. Create the Snapshot:
    • Click on the Create button to create the snapshot. This will capture the current state of your Node-RED instance, including flows, credentials, environment variables, NPM packages (with locked versions), and runtime settings.

Pushing the Snapshot to the Device

To deploy the snapshot to your device, follow these steps:

  1. Go to the Device Section
  • In the FlowFuse dashboard, go to the Devices section.
  1. Select the Device
  • Find the device you created and configured earlier.
  • Tap on the three dots next to the device name.
  • Click on Add Instance.
  1. Add the Instance to the Device
  • Choose the application and instance you created earlier.
  • Click the Add button.
  1. Deploy the Flow
  • Your flow will be deployed to the device within a few seconds. It will run with the configurations and settings captured in the snapshot.
  1. Access the Device
  • Go to your device by navigating to <ip_address_recomputer>:1881/ui in your web browser.

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...