Home Assistant Community Add-on: Node-RED

I set up the node-red watchdog automations described in this video. (It’s been linked here before)

it’s helped me. Might try it out. but if you’re having to restart node-red every time, might be something else going on.

the only variation I added was to make the Home Assistant automation repeat every 5 minutes where the condition is that the node-red sensor is ‘unknown’. I was having issues where node-red would be disconnected from Hass.io after a Hass.io update, requiring node-red restart or at least going in and republishing the flows. For some reason the automation as written from the video wouldn’t catch it every time until I forced it to recheck the sensor.

- id: '1534662494492'
  alias: Restart NodeRed Watchdog
  trigger:
  - entity_id: sensor.node_red
    from: OK
    platform: state
    to: unknown
  - minutes: /5
    platform: time
    seconds: 0
  condition:
  - condition: state
    entity_id: sensor.node_red
    state: unknown
  action:
  - data:
      addon: a0d7b954_nodered
    service: hassio.addon_restart

I had the same issue as you described.
I fixed it by editing the yaml and adding single quotes to the states.

from: ‘OK’ etc.

For some reason the automation dialog doesn’t add them to strings…

I have noticed that after hassio restart my nodered is accesible and to revive it I can stop and start flows.

Thanks a lot for that awesome and helpful post. I always wondered why my node red stopped working with home assistant from time to time.

Is there any way to check why a login to the addons webgui is no more possible?
I have updated to hassio 0.79 today, nodered addon is the latest version as well.

Now i can`t login to the webgui anymore but it does not give me any error message. I have already checked the logs i am aware of.

  • addon starts up correct
  • gui loads correct
  • restarted the addon several times
  • rebooted hassio

Only thing i can see in the logs that could be wrong is this:

INFO: API token is incorrect in the Node-RED configuration, fixing…

Rechecked and changed the user login data several times but its no more working.

Any ideas ?

UPDATE:

My fault… my new antivirus blocked the password because its not ssl encrypted

Nevertheless can someone tell me where this info message comes from ?

Hi Frenck,

I tried installing “node-red-node-serialport” and get the following error. I tried loading it via the palette manager as well with no luck. Is there way to install?

[email protected] install /opt/node_modules/serialport
prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=8.11.4 runtime=node arch=arm platform=linux)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.14.66-v7
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /opt/node_modules/serialport
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of marked@^0.3.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install 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-10-01T00_56_14_161Z-debug.log
FATAL: Failed installing npm package node-red-node-serialport
[cont-init.d] 81-npm-packages.sh: exited 1.
[cont-finish.d] executing container finish scripts…
[cont-finish.d] 99-message.sh: executing…


Make is not installed by default, make sure to include it in the add-on config.

Thanks for that.

I added “make” to the config like so, saved and restarted:

  "system_packages": [
"make"

],

Was this what you meant?

Went to install it again and look a different error now.

1 Oct 23:20:19 - [info] Installing module: node-red-node-serialport, version: 0.6.8
1 Oct 23:21:06 - [warn] Installation of module node-red-node-serialport failed:
1 Oct 23:21:06 - [warn] ------------------------------------------
1 Oct 23:21:06 - [warn]

[email protected] install /config/node-red/node_modules/serialport
prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=8.11.4 runtime=node arch=arm platform=linux)
make: Entering directory ‘/config/node-red/node_modules/serialport/build’
CXX(target) Release/obj.target/serialport/src/serialport.o
make: g++: Command not found
make: *** [serialport.target.mk:96: Release/obj.target/serialport/src/serialport.o] Error 127
make: Leaving directory ‘/config/node-red/node_modules/serialport/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.66-v7
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /config/node-red/node_modules/serialport
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install 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-10-01T13_21_05_900Z-debug.log

Do I also need to add g++ to the system packages?

Try to read the log, line by line, and see if you can find stuff… I highlighted something for you…

1 Like

I’m back to having Node-Red connection errors. I’ve already tried using the ip address and that doesn’t work either. I have no idea how this happened.

1 Oct 19:05:27 - [error] [server:Home Assistant] Home assistant connection failed with error: Connection to home assistant could not be established with config: http://hassio.local:8123 <password redacted

Here’s a copy of the config with the usernames and passwords changed.
Config
{
“log_level”: “info”,
“credential_secret”: “XXXXXXXXXXXXX”,
“users”: [
{
“username”: “xxxxxxxxx”,
“password”: “xxxxxxxxx”,
“permissions”: “*”
}
],
“http_node”: {
“username”: “xxxxxxxx”,
“password”: “xxxxxxxxxx”
},
“http_static”: {
“username”: “xxxxxxxxx”,
“password”: “xxxxxxxxxx”
},
“port”: 1880,
“ssl”: false,
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”,
“require_ssl”: false,
“system_packages”: [],
“npm_packages”: [],
“init_commands”: []
}

Hi Frenck,

I did add g++ to the system packages before your posting but that wasn’t then end of it.

I did manage to install the serial after adding the following packages

“system_packages”: [
“make”,
“g++”,
“gcc”,
“python”,
“linux-headers”,
“udev”,
“ffmpeg”
],
“npm_packages”: [
“serialport”
],

Then loading node-red-node-serialport via the palette manager.

Thanks for your help.

1 Like

Hi Dennis,

I’m no expert but I was getting this error a bit. Every time I get this issue and doesn’t go away after just a simple node-red restart I do a host restart.

When you restart node-red and look at your log can you see that node-red gets a new API key?

This has been posted multiple time, you should not have modified the url: Home Assistant Community Add-on: Node-RED

Node-Red is connecting again.

I restarted both Node-Red and Hassio several times and that did not work. I restored to an earlier Snapshot and that seemed to work.

The current connection for the server node is using a base url of http://hassio/homeassistant
I had tried both [http://hassio.local:8123] and [http://192.168.1.xxx:8123]

For the record, I didn’t modify the url until after the connection was broken. I have no idea how this happened.

I have issues with connection HA and Nodered. As a cure I migrate from node-red-contrib-home-assistant to node-red-contrib-home-assistant-websocket and it helps.
@everyone - I need help, how to remove node-red-contrib-home-assistant from addon?

Today, HA+NR stopped working for me. I think I figured out how to temporarily fix it, but not the permanent fix.

Temp fix: Copy the “pass” value (long hexadecimal string) from config/node-red/flows.json into NR’s API Pass for the Home Assistant server:


And re-Deploy.

For me, this has to be done every time that NR is restarted, because on every restart, I get “INFO: API token is incorrect in the Node-RED configuration, fixing…” which in turn updates the “pass”. I think I have the NR “projects” set up, and it’s been noted before that this is problematic. So perhaps this is a factor. I might try to make a fresh install without projects at some point.

For a permanent fix, I hope @frenck will find the above useful and suggest something.

Hope that helps

  • Benjamin

thanks for the fix above , Ha + NR broke for me also today morning ,
Waiting for a permanent fix

Please see:

1 Like

Thanks,
Fixed now

Sorry dint read the previous commets,

1 Like

Hi,
as the cloud service will soon be only usable if you pay for it. I wanted to see, if I get the connectivity between home assistant and alexa done via node-red.

I already installed node-red within hassio addon. Installed the alexa things within node-red and also installed the alexa node-red skill. But now I am totally lost what to do to get these to things connected to each other. Is there any kind of tutorial or so to explain that? What I want, is more or less the same functionality as I had before. To control all my lights and other stuff via alexa.

Regards
Lukas