Node-RED - Community Hass.io Add-on for Home Assistant
Clone or download

README.md

Community Hass.io Add-ons: Node-RED

GitHub Release Project Stage License

GitLab CI Greenkeeper badge Project Maintenance GitHub Activity

Bountysource Discord Community Forum

Buy me a coffee

Support my work on Patreon

Flow-based programming for the Internet of Things.

Node-RED in the Home Assistant Frontend

About

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.

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.

  1. Add our Hass.io add-ons repository to your Hass.io instance.
  2. Install the "Node-RED" add-on.
  3. Set a credential_secret, which is used to encrypt sensitive data. This is just a "password", which you should save on a secondary location.
  4. If you do NOT use SSL, be sure to set the ssl option to false.
  5. Start the "Node-RED" add-on.
  6. Check the logs of "Node-RED" to see if everything went well.
  7. Log in with your Home Assistant username/password.
  8. The add-on works straight out the box! No need to configure a server!

Note: The add-on is pre-configured out of the box! There is no need to add/change/update the server connection settings!

Please read the rest of this document further instructions.

NOTE: Do not add this repository to Hass.io, please use: https://github.com/hassio-addons/repository.

Docker status

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

Docker Architecture Docker Version Docker Layers Docker Pulls

Configuration

Note: _Remember to restart the add-on when the configuration is changed.

Example add-on configuration:

{
  "log_level": "info",
  "credential_secret": "KJHhfdhiFRENCKfsdfdsDHFHDJS",
  "http_node": {
    "username": "MarryPoppins",
    "password": "Supercalifragilisticexpialidocious"
  },
  "http_static": {
    "username": "MarryPoppins",
    "password": "Supercalifragilisticexpialidocious"
  },
  "port": 1880,
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [
    "ffmpeg"
  ],
  "npm_packages": [
    "node-red-admin"
  ],
  "init_commands": [
    "echo 'This is a test'",
    "echo 'So is this...'"
  ]
}

Note: This is just an example, don't copy and paste it! Create your own!

Option: log_level

The log_level option controls the level of log output by the addon and can be changed to be more or less verbose, which might be useful when you are dealing with an unknown issue. Possible values are:

  • trace: Show every detail, like all called internal functions.
  • debug: Shows detailed debug information.
  • info: Normal (usually) interesting events.
  • warning: Exceptional occurrences that are not errors.
  • error: Runtime errors that do not require immediate action.
  • fatal: Something went terribly wrong. Add-on becomes unusable.

Please note that each level automatically includes log messages from a more severe level, e.g., debug also shows info messages. By default, the log_level is set to info, which is the recommended setting unless you are troubleshooting.

Option: port

The default port for Node-RED is 1880, but sometimes you'd just like to have it on another port, right? Remember, if you change to port, be sure it is not in use by something else already!

Option: ssl

Enables/Disables SSL (HTTPS) on the web interface. Set it true to enable it, false otherwise.

Option: certfile

The certificate file to use for SSL.

Note: The file MUST be stored in /ssl/, which is the default for Hass.io

Option: keyfile

The private key file to use for SSL.

Note: The file MUST be stored in /ssl/, which is the default for Hass.io

Option: require_ssl

This options can be used to cause insecure HTTP connections to be redirected to HTTPS. This is recommended when you have SSL enabled.

Option: credential_secret

Credentials are encrypted by Node-RED in storage, using secret key. This option allows you to specify your secret key. This can be anything you like, it is just like a password. Be sure to store it somewhere safe. You might need it in the future! (e.g., When restoring a backup).

Note: Once you set this property, do not change it - doing so will prevent Node-RED from being able to decrypt your existing credentials and they will be lost.

Note: This option support secrets, e.g., !secret red_secret.

Option: http_node

To password protect the node-defined HTTP endpoints (httpNodeRoot), the following properties can be used:

  • username
  • password

Note: These options support secrets, e.g., !secret red_password.

Option: http_static

To password protect the static content (httpStatic), the following properties can be used:

  • username
  • password

Note: These options support secrets, e.g., !secret red_password.

Option: system_packages

Allows you to specify additional Alpine packages to be installed to your Node-RED setup (e.g., g++. make, ffmpeg).

Note: Adding many packages will result in a longer start-up time for the add-on.

Option: npm_packages

Allows you to specify additional NPM packages or Node-RED nodes to be installed to your Node-RED setup (e.g., node-red-dashboard, node-red-contrib-ccu).

Note: Adding many packages will result in a longer start-up time for the add-on.

Option: init_commands

Customize your Node-RED environment even more with the init_commands option. Add one or more shell commands to the list, and they will be executed every single time this add-on starts.

Option: i_like_to_be_pwned

Adding this option to the add-on configuration allows to you bypass the HaveIBeenPwned password requirement by setting it to true.

Note: We STRONGLY suggest picking a stronger/safer password instead of using this option! USE AT YOUR OWN RISK!

Option: leave_front_door_open

Adding this option to the add-on configuration allows you to disable authentication on the add-on by setting it to true and leaving the username and password empty.

Note: We STRONGLY suggest, not to use this, even if this add-on is only exposed to your internal network. USE AT YOUR OWN RISK!

Embedding into Home Assistant

It is possible to embed the Node-RED interface directly into Home Assistant, allowing you to access it through the Home Assistant frontend.

Home Assistant provides the panel_iframe component, for these purposes.

Example configuration:

panel_iframe:
  nodered:
    title: Node-RED
    icon: mdi:sitemap
    url: http://addres.to.your.hass.io:1880

FAQ

I'm having all kinds of issues after upgrading to v1.x.x

A lot has changed, since v1.0.0. Maybe you've missed the release/upgrade notes? Please be sure to read them and to follow the upgrade instructions.

https://github.com/hassio-addons/addon-node-red/releases/tag/v1.0.0

I'm unable to log in, after upgrading to v1.x.x

The login uses Home Assistant's authentication system. You can now login using the same username and password as you use to log on to the Home Assistant frontend.

Node-RED could not establish connection

So, this is like the most asked question. It involves messages in the error logs that look like this:

Home assistant connection failed with error: Connection to home assistant could
not be established with config: http://XXXXX.duckdns.org <password redacted>

The solution to this is simple:

  • Click on one of the Home Assistant nodes in your flow.
  • Click on the little edit button, next to the server name.
  • Change the URL to: http://hassio/homeassistant.
  • Save it, and deploy your flow!
  • Now the add-on handles the authentication for you.

The configured certfile is not found

This error is shown when you have enabled ssl in the add-on option, but the SSL certificate files are not found on disk.

Either correct the certfile in case you are using SSL, get an SSL certificate (which you actually should) OR disable the ssl feature by setting the configuration option to false.

Changelog & Releases

This repository keeps a change log using GitHub's releases functionality. The format of the log is based on Keep a Changelog.

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Support

Got questions?

You have several options to get them answered:

You could also open an issue here GitHub.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We have set up a separate document containing our contribution guidelines.

Thank you for being involved! 😍

Authors & contributors

The original setup of this repository is by Franck Nijhof.

For a full list of all authors and contributors, check the contributor's page.

We have got some Hass.io add-ons for you

Want some more functionality to your Hass.io Home Assistant instance?

We have created multiple add-ons for Hass.io. For a full list, check out our GitHub Repository.

License

MIT License

Copyright (c) 2018 Franck Nijhof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.