Community Hass.io Add-on: Node-RED

hassio-repository
hassio-addon
Tags: #<Tag:0x00007f203aeff540> #<Tag:0x00007f203aeff400>

#426

Please share you add-on configuration, so we can help you troubleshooting.


#427

Hello,
sure:

{
  "log_level": "info",
  "credential_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "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": []
}

Thank you for your time.


#428

I used the token in the config node since i have nodered on different pi than my hassio with zwave nodes…


#429

Aaah that makes sense! :smiley: Interesting usecase btw! :+1:


#430

@bigmike That config looks fine! You should be able to login with the same username/password as you use on the Home Assistant frontend.

If that doesn’t work, could you share the first part of the add-on log, it contains like a banner with a kinds of version information (shown as soon as the add-on starts).


#431

@frenck
EDIT: So I tried several times to log in, but failed… Is there anything suspicious in my log?

Thank you.

Here we go:

[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.0.0
 Flow-based programming for the Internet of Things
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 amd64 / Resin OS 2.3.0+rev1 / HA 0.81.1 / SU 138 / 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] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-npm-packages.sh: executing... 
[cont-init.d] 81-npm-packages.sh: exited 0.
[cont-init.d] 82-user-scripts.sh: executing... 
[cont-init.d] 82-user-scripts.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
> [email protected] start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
30 Oct 12:00:59 - [info] 
Welcome to Node-RED
===================
30 Oct 12:00:59 - [info] Node-RED version: v0.19.4
30 Oct 12:00:59 - [info] Node.js  version: v8.12.0
30 Oct 12:00:59 - [info] Linux 4.8.17-yocto-standard x64 LE
30 Oct 12:00:59 - [info] Loading palette nodes
30 Oct 12:00:59 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
30 Oct 12:01:00 - [warn] ------------------------------------------------------
30 Oct 12:01:00 - [warn] [node-red-contrib-generic-ble/generic-ble] Error: Cannot find module 'bluetooth-hci-socket'
30 Oct 12:01:00 - [warn] ------------------------------------------------------
30 Oct 12:01:00 - [info] Settings file  : /etc/node-red/config.js
30 Oct 12:01:00 - [info] Context store  : 'default' [module=memory]
30 Oct 12:01:00 - [info] User directory : /config/node-red/
30 Oct 12:01:00 - [warn] No active project : using default flows file
30 Oct 12:01:00 - [info] Flows file     : /config/node-red/flows.json
30 Oct 12:01:00 - [info] Server now running at http://127.0.0.1:1880/
30 Oct 12:01:00 - [info] Starting flows
30 Oct 12:01:00 - [info] Started flows
30 Oct 12:01:00 - [info] [mqtt-broker:9827949b.9aa3a8] Connected to broker: mqtt://192.168.100.220:1883
30 Oct 12:01:00 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
(node:551) UnhandledPromiseRejectionWarning: Error: WebSocket is not open: readyState 3 (CLOSED)
    at WebSocket.send (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/websocket.js:314:19)
    at e.sendMessage (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3434)
    at /opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3603
    at new Promise (<anonymous>)
    at e.sendMessagePromise (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3520)
    at Object.e.getUser (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:12594)
    at HaWebsocket.startListening (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:72:18)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:551) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:551) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#432

@frenck: Thanks a lot. Works like a charm.
Node Red is amazing - Started using it last night, and the learning curve was right up my alley. Already has generic movement sensor -> lights on/off flow. So generic that I can hook up any new sensor-light groups without changing the rest of the flow a bit.


#433

Im sure im not the only one, but when i couldnt log in to node red i looked at the node-red part of the forums not the hassio section.


#434

? Not sure what you are trying to say there m8.


#435

This is where i went looking for info on node-red

https://community.home-assistant.io/c/third-party/node-red


#436

Yes that part of the forums is for Node-RED specific, since this is just about the Hass.io add-on, I’ve categorized it in this part (just like every other add-on). Unfortunately, it is not possible for an topic to be in 2 different sections as the same time.


#437

I was having issues logging in as well (not sure why?); however, I just created a new user through the hassio UI and used those credentials with no issue.


#438

I always get the following error messsages:

30 Oct 13:25:46 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
30 Oct 13:25:46 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant

I also was not able to get the previous version on Node Red running. Any suggestions?


#439

Please provide the add-on startup banner, since it contains all kinds of version information.
Maybe an (password redacted) version of your configuration as well?


#440

@frenck, when HA is restarting, any way to have the HA events nodes to not keep changing states from disconnected - connecting - connected, until HAS comes back up? I have a flow (patterned from here) that runs on HA restart to re-assign last states. It waits for the ‘connected’ status on msg.status.text but since it will come back with ‘connected’ maybe at least 50 times while it is connecting, this will not work anymore. Here’s part of the debug of msg.status.text:

10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[12]
"disconnected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[10]
"connecting"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[9]
"connected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[9]
"connected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[12]
"disconnected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[10]
"connecting"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[9]
"connected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[9]
"connected"
10/30/2018, 8:58:11 AMnode: 1d03c4.44185c3d
msg.status.text : string[12]
"disconnected"
10/30/2018, 8:58:12 AMnode: 1d03c4.44185c3d
msg.status.text : string[9]
"connected"

This will keep going on for a while non-stop until it connects. I hope it would just show “disconnected” and/or “connecting”, and then “connected”, when it is really connected at the end.

Here’s the code in case you want to try it. Deploy and restart HA to see what it is happening:

[{"id":"c83c2996.c3b4f8","type":"tab","label":"Auto-connect Test","disabled":false,"info":""},{"id":"e8299af3.f60ec8","type":"debug","z":"c83c2996.c3b4f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"status.text","x":377,"y":222,"wires":[]},{"id":"8de7d3b3.cb488","type":"status","z":"c83c2996.c3b4f8","name":"","scope":["1c8e9b32.3717a5"],"x":185,"y":223,"wires":[["e8299af3.f60ec8"]]},{"id":"1c8e9b32.3717a5","type":"server-state-changed","z":"c83c2996.c3b4f8","name":"","server":"861fdf48.62a9d","entityidfilter":"sun.sun","entityidfiltertype":"substring","haltifstate":"","outputinitially":true,"x":216,"y":148,"wires":[[]]},{"id":"861fdf48.62a9d","type":"server","z":"","name":"Home Assistant"}]


#441

Here is the Config:

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

And the startup banner:

 Hass.io Add-on: Node-RED v1.0.0
 Flow-based programming for the Internet of Things
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 aarch64 / HassOS 1.12 / HA 0.81.1 / SU 138 / 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... 
INFO: Password is NOT in the Have I Been Pwned database! Nice!
INFO: Password is NOT in the Have I Been Pwned database! Nice!
[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] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-npm-packages.sh: executing... 
[cont-init.d] 81-npm-packages.sh: exited 0.
[cont-init.d] 82-user-scripts.sh: executing... 
[cont-init.d] 82-user-scripts.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
> [email protected] start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
30 Oct 14:15:54 - [info] 
Welcome to Node-RED
===================
30 Oct 14:15:54 - [info] Node-RED version: v0.19.4
30 Oct 14:15:54 - [info] Node.js  version: v8.12.0
30 Oct 14:15:54 - [info] Linux 4.14.78-v8 arm64 LE
30 Oct 14:15:56 - [info] Loading palette nodes
30 Oct 14:15:57 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
30 Oct 14:22:07 - [info] Settings file  : /etc/node-red/config.js
30 Oct 14:22:07 - [info] Context store  : 'default' [module=memory]
30 Oct 14:22:07 - [info] User directory : /config/node-red/
30 Oct 14:22:07 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Oct 14:22:07 - [info] Flows file     : /config/node-red/flows.json
30 Oct 14:22:07 - [info] Server now running at https://127.0.0.1:1880/
30 Oct 14:22:07 - [info] Starting flows
30 Oct 14:22:08 - [info] Started flows
30 Oct 14:22:08 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
(node:648) UnhandledPromiseRejectionWarning: Error: WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/websocket.js:314:19)
    at e.sendMessage (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3496)
    at /opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3665
    at new Promise (<anonymous>)
    at e.sendMessagePromise (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:3582)
    at Object.e.getUser (/opt/node_modules/home-assistant-js-websocket/dist/haws.umd.js:1:12656)
    at HaWebsocket.startListening (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:72:18)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:648) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:648) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
30 Oct 14:22:08 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant
(node:648) UnhandledPromiseRejectionWarning: #<Object>
(node:648) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:648) UnhandledPromiseRejectionWarning: #<Object>
(node:648) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:648) UnhandledPromiseRejectionWarning: #<Object>
(node:648) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
30 Oct 14:22:08 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
30 Oct 14:22:08 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant

#442

No… and it should be like this. This is what is happening…


#443

Good day. Today in the second half of days suddenly stopped login in Rednode in logs nothing not is written except

30 Oct 18:36:36 - [info]

Welcome to Node-RED

30 Oct 18:36:36 - [info] Node-RED version: v0.19.4
30 Oct 18:36:36 - [info] Node.js version: v8.12.0
30 Oct 18:36:36 - [info] Linux 4.15.0-36-generic x64 LE
30 Oct 18:36:37 - [info] Loading palette nodes
30 Oct 18:36:38 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
30 Oct 18:36:43 - [info] Settings file : /etc/node-red/config.js
30 Oct 18:36:43 - [info] Context store : ‘default’ [module=memory]
30 Oct 18:36:43 - [info] User directory : /config/node-red/
30 Oct 18:36:43 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Oct 18:36:43 - [info] Flows file : /config/node-red/flows.json
30 Oct 18:36:43 - [info] Server now running at http://127.0.0.1:1880/
30 Oct 18:36:43 - [warn] Error loading credentials: SyntaxError: Unexpected token in JSON at position 0
30 Oct 18:36:43 - [warn] Error loading flows: Error: Failed to decrypt credentials
30 Oct 18:36:43 - [info] Starting flows
30 Oct 18:36:43 - [info] Started flows
30 Oct 18:36:44 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
30 Oct 18:39:29 - HA Auth - Failed to authenticate: admin
30 Oct 18:39:51 - HA Auth - Failed to authenticate: admin
30 Oct 18:41:08 - HA Auth - Failed to authenticate: admin
30 Oct 18:43:02 - HA Auth - Failed to authenticate: admin
On the morning all normally logged in.


#444

@dionisgr you need to c hange the config. see: Community Hass.io Add-on: Node-RED


#445

Thanks for the clarification. This post as the missed.