Community Hass.io Add-on: Node-RED

hassio-repository
hassio-addon
Tags: #<Tag:0x00007f203d894ae0> #<Tag:0x00007f203d894978>

#509

The add-on comes out of the box pre-configured with the websockets version.

No, the add-on does not support that. If you want that kinds of functionality, you’d have to build your own reverse proxy to handle it for you.


#510

Hi @chris1 : the addin does not ask for a username just the API password which I was assuming is the password in the configuration.yaml file.


#511

Hi Frenck,

I do see the websockets addon included, do you mean I should be using that version instead?


#512

That add-on takes care of the authentication for you. This is a feature of Hass.io.

The add-on has the websockets version out of the box.

A little side note: I’m kinda sensing you are not using the add-on. If you have questions about node-red that is not add-on related, please do so, in a separate topic.


#513

Thank you for the prompt comments Frenck and you are probably correct about my issue, I’m just concern that in the Node-red addon I keep getting the below error every one second. I’m trying to understand why this is happening.
“Home assistant connection failed with error: Connection to home assistant could not be established with config: https://192.168.1.40:8123/ <password redacted>”


#514

I’m suddenly unable to login to NodeRed. I keep getting a ‘Login failed’. Both the username and password set in the addon config and the username and password of my HassOS installation are not working. It worked a few days ago, and in the meantime I didn’t update anything that I’m aware of. Any idea where I need to look for a solution? Maybe it’s the ‘ˆ’ or the ‘*’ in my password, but this doesn’t explain why the password set in the config, which I tried with simple passwords, does not work.

-edit-

After resetting my Home Assistant user and setting a password without special characters I can login again.


#515

[copy pasted from discord]

Hi all ! I also got issues with node-red. For some reason, the addon stopped working after a restart and gives me the following error:

SyntaxError: Error parsing /usr/lib/node_modules/npm/node_modules/safe-buffer/package.json: Unexpected number in JSON at position 1119

I can’t figure the location of the file that causes issue … the log looks like this:

[services.d] starting services
[services.d] done.
module.js:130
throw e;
^
SyntaxError: Error parsing /usr/lib/node_modules/npm/node_modules/safe-buffer/package.json: Unexpected number in JSON at position 1119
at JSON.parse ()
at readPackage (module.js:126:52)
at tryPackage (module.js:136:13)
at Function.Module._findPath (module.js:218:20)
at Function.Module._resolveFilename (module.js:546:25)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:55:14)
at Module._compile (module.js:653:30)

Anyone got some idea on how to fix that ?


#516

I’m trying to use the websocket node to connect to a Traccar websocket with SSL. Unfortunately I’m getting a EPROTO error, which turns out to be a bug in node.js. There are quite a few tickets mentioning this issue in their tracker, and it turns out it’s only going to be fixed in version 10.x. However I’ve noticed that Node-Red are still recommending 8.x over 10.x. For this reason I guess you’re not going to be packaging with node.js 10.x any time soon.
With this limitation, what other methods can I use to get enhanced information over what the device_tracker entity can provide (Traccar geofence notifications)

OK, I know I’ve mentioned two different addons, but hopefully as you maintain both I can be forgiven!
Thanks.


#517

In the upcoming month the next release of Alpine Linux is expected (on which this add-on runs). Alpine Linux will ship 10.x…


#518

OK cool, thanks. Waiting a month is better than trying to come up with a hacky compromise.


#519

:tada: Release v1.2.0

This release updates a couple of parts of the add-on, including nodejs and the Home Assistant Websocket node.

The add-on now ships with node-red-node-serialport straight of the box. I’ve seen many people struggle to get it installed, so from now on, it is just part of the add-on. :tada:

Furthermore, I’ve seen people having connection issues, mostly caused by having a conflicting Home Assistant node installed. This release takes care of those conflicting nodes for you. :ambulance:

Full Changelog

Changed

  • Upgrades node-red-contrib-home-assistant-websocket to 0.3.1
  • Upgrades RPi.GPIO to 0.6.3
  • Fixes PT_GNU_STACK header in nodejs patch after installing RPi.GPIO
  • Upgrades nodejs to 8.14.0-r0
  • Update google-tts-api to 0.0.4 (#81) (@heytcass)
  • Adds node-red-node-serialport to the default node set
  • Auto removal of conflicting node packages on startup

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck or https://buymeacoff.ee/frenck


#520

Thanks for the update! The conflicting Home Assistant Node was actually the issue I was running into where NR wouldn’t reconnect after rebooting HA. I manually fixed this a couple of days ago by exporting my flows, removing NR, and deleting the NR folder in /config in HA. Glad you got it figured out!


#521

HI Frenck.

I had read through the notes and made the changes to the user names and passwords as per the recomendation. I have resorted to reset the config to the default and changing the credential secret to my existing password.

As of last night after upgrading the add-on to version 1.2.0, I was able to start and gain access back into Node Red. Unfortunately after getting home from work tonight, I noticed automations weren’t firing, and I am greeted with the same error message, which keeps repeating. If I restart the add-on, I get the same error message.
The only pattern i can see is that occasionally the add-on starts successsfully and I can use the addon before the error message appears after a short amount of time roughly 5 minutes, although last night I used NR for maybe an hour.

Here is the rror msg I recieve and my add-on config

[email protected] start /opt
node $NODE_OPTIONS node_modules/node-red/red.js “–settings” “/etc/node-red/config.js”

Error loading settings file: /etc/node-red/config.js
TypeError: Cannot read property 'length' of undefined
    at Object.<anonymous> (/etc/node-red/config.js:27:19)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/node_modules/node-red/red.js:115:20)
    at Module._compile (module.js:635:30)


{
  "log_level": "info",
  "credential_secret": "redacted_password",
  "http_node": {
    "username": "",
    "password": ""
  },
  "http_static": {
    "username": "",
    "password": ""
  },
  "port": 1880,
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": false,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": []
}

I have also renamed the directory /config/nodered/node_modules in case that was the cause, but I still recieve the errors.

Any suggestions

Edit: I thought that maybe I was having problems due to the various versions of the Node-Red I have used over the last year.

As an attempted fix,

  1. I made a backup of my config\node-red directory
  2. Uninstalled the Node-Red add-on
  3. Deleted the \config\node-red directory from my hassio directory
  4. Reinstalled the add-on
  5. Copied back my original flows.json file & restarted the addon

Apart from a few missing nodes which I reinstalled from the palette manager, everything seems to be running OK


#522

Is there any way to stop the hassio addon from gathering (or at least storing) information on attached USB/Serial devices ?

Last night I removed an old USB Zigbee stick from my Hassio box and found that Node-RED no longer started.
After some digging I found it was due to the addon looking for /dev/ttyAMA0 (which obviously no longer existed).
The only way I could find to get around it was to uninstall and then re-install the addon.


#523

Hi,
After ”to long” time I migrated to this addon instead of an old fork. Very smooth migration and no problem to import (just changed to use internal auth and created the user as specified in the conf).

However, all of my flows that used the poll state node didnt fired when recieved to the switch node (i did pull sensors and luminance and based of the value the lamps goes on/off).

I did some quick debugging and could see that in the old setup i could use ”msg.payload.data.state” and find the string. Now in the new addon (with all upgrades) the message was only msg.payload.

So after I changed to look after that everything was working again. So to the question :sunglasses: has that change of payload something to do with some change in ”node-red-contrib-home-assistant-websocket”?

I hope above pretty clear :slight_smile:
Br


#524

I’m running Hass.io 0.83.3, supervisor 140, HassOS 1.12. Whenever I try to upgrade to Node-RED 1.2.0 I get the “something went terribly wrong” message. I’ve tried phildapunk’s “attempted fix” steps twice, but no luck.

Reverting to 1.1.0 via a restored snapshot works fine.

My config:

{
  "log_level": "info",
  "credential_secret": "<redacted>",
  "http_node": {
    "username": "",
    "password": ""
  },
  "http_static": {
    "username": "",
    "password": ""
  },
  "port": 1880,
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": []
}

#525

I have been trying to install the hassio addon today, which appears to install correctly. I have tried many times and failed to access the WebUI, but when looking at the node-RED logfile it appears it get stuck before starting as in the following log file. I am using the default config, apart from adding the credential_secret and disabling SSL. Any advice would be appreciated

s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 00-banner.sh: executing…

Hass.io Add-on: Node-RED v1.2.0
Flow-based programming for the Internet of Things
From: Community Hass.io Add-ons
By: Franck Nijhof [email protected]

armhf / HassOS 1.12 / HA 0.82.1 / SU 140 / stable

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing…
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing…
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing…
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 20-config.sh: executing…
[cont-init.d] 20-config.sh: exited 0.
[cont-init.d] 50-remove-conflicts.sh: executing…
[cont-init.d] 50-remove-conflicts.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing…
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-npm-packages.sh: executing…


#526

So, I am faced with the same scenario. After a day or two of a workign Node-Red addon, I am now faced with the error message,

Error loading settings file: /etc/node-red/config.js
TypeError: Cannot read property ‘length’ of undefined
at Object. (/etc/node-red/config.js:27:19)
at Module._compile (module.js:635:30)
at Object.Module._extensions…js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (/opt/node_modules/node-red/red.js:115:20)
at Module._compile (module.js:635:30)

Can anyone tell me, if the error message refers to the values that are saved in the Addon config window.

After uninstalling the the add-on, removing any trace of NR config and nodes from the Hassio config directory, before re-installing to a default config, and setting my credentials I get a working add-on for a period of time.
The only legacy data that is being restored are my flows, and i cannot see how those could affect the add-on config

Is this a permissions problem, or a data problem

** Edit 13/12/18 Following the release of v1.2.1 of the addon, Node Red works again, with no changes ot my add-on config or the config.js file, so I pretty sure there is no problem with my add-on config

** 14/12/18 - Notice my automations arent working. Check and see that the add-on is reporting the same error - Error loading settings file: /etc/node-red/config.js

Alternative solution attempted, were to make a backup of the package file, before replacing the contents with {} . Error message still encountered


#527

After installing node_red-contrib-nefit-easy from the node-red configuration nodes - install tab node-red wont’t come up again. The web-interfaces is unavailable. When i check the log i see te following:

11 Dec 20:52:32 - [info] Installing module: node-red-contrib-nefit-easy2, version: 1.3.0
11 Dec 20:52:54 - [info] Installed module: node-red-contrib-nefit-easy2
11 Dec 20:52:56 - [info] Added node types:
11 Dec 20:52:56 - [info] - node-red-contrib-nefit-easy2:nefit-easy
11 Dec 20:52:56 - [info] - node-red-contrib-nefit-easy2:nefit-easy-config
11 Dec 20:52:56 - [red] Uncaught Exception:
11 Dec 20:52:56 - TypeError: tls.convertNPNProtocols is not a function
at new TLSSocket (_tls_wrap.js:269:9)
at Server. (_tls_wrap.js:852:18)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1570:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-11T19_52_56_108Z-debug.log

[email protected] start /opt
node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
11 Dec 20:53:02 - [info]

What is wrong here? I used the component before. Then there was no problem en could use the installed components en connect to my Nefit Easy.


#528

Apologies that I don’t have time to scroll through all of the posts in this thread. Putting this here to report the failure I’m experiencing. Then I’m going to restore from snapshot my prior working configuration (Lutron is also broken on Hass.io 0.84.1, so I’m reverting to 0.83.3)

I had experienced earlier problems and so backed up my automations (export to clipboard - then to text file) and uninstalled Node-RED. Upgraded to 0.84.1. Did a couple of restarts. When I tried reinstalling Node-RED I get this error.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: Node-RED v1.2.1
 Flow-based programming for the Internet of Things
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 armhf / HassOS 1.12 / HA 0.84.1 / SU 141 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing... 
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 20-config.sh: executing... 
[cont-init.d] 20-config.sh: exited 0.
[cont-init.d] 50-remove-conflicts.sh: executing... 
npm ERR! file /config/node-red/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected end of JSON input while parsing near ''
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-13T18_36_24_218Z-debug.log
FATAL: Failed un-installing conflicting packages
[cont-init.d] 50-remove-conflicts.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.
 
 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] syncing disks.

My config:

{
  "log_level": "info",
  "credential_secret": "<redacted>",
  "http_node": {
    "username": "",
    "password": ""
  },
  "http_static": {
    "username": "",
    "password": ""
  },
  "port": 1880,
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": []
}