Installing Node-RED

Updated: May 3, 2020



Time to cook: 30min

Difficulty: +++++



Node-Red is a powerful and user-friendly way to add automation to your connected home. The installation of Node-Red is available on the openHabian image as an add-on software component. So this recipe can be seen as an add-on on top of the Smart HUB recipe.


Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.


 

Ingredients


  • A Raspberry Pi with OpenHabian installed

Prerequisites


  • Nihil

Tools


  • Nihil


The Building Plan


Installing Node-RED


  • login to your Raspberry-Pi with openHABian installed using an SSH connection

  • start the openHabian config by entering the following command:


sudo openhabian-config





  • Select Optional Components (20)

  • Select Node-Red (25)


The installation of Node-Red is started. Respond to the installation options. After a few minutes, the installation will be completed.


Node-Red will be accessible from your openHABian landing page.





Alternative, you can start and stop Node-Red from the command prompt:


Stopping & starting node-red



node-red-stop

node-red-start



Securing Node-Red


The Node-Red environment has great dashboard nodes to visualize sensor data and control your devices from an intuitive UI. If you are going to expose the Node-Red environment to the outside, to allow remote control, it is important to secure your environment.


A first step in securing your Node-Red environment is to set a password for accessing the Node- Red administration and the UI interface.


Install the command line administration tool


  • login to your Raspberry-Pi with openHABian installed using an SSH connection

  • enter the following commands

  • cd /home/openhabian

  • sudo npm install -g node-red-admin

  • create a pwd file:

  • node-red-admin hash-pw


This will result in a hash password. Use this to configure the settings.js file in the folder /home/openhabian/.node-red to setup the authentication


Configure the settings.js file in /home/openhabian/.node-red




// Securing Node-RED

// -----------------

// To password protect the Node-RED editor and admin API, the following

// propertycan be used. See http://nodered.org/docs/security.html for details.

adminAuth: {

type: "credentials",

users: [{

username: "admin",

password: "enter your passwd hash file here",

permissions: "*"

}]

},



What's next?

The connected house cookbook includes a number of recipes which make use of the powerful Node-Red environment. You might want to test one out.

}

}


6 views0 comments