Setting up Node-red on Home Assistant in a Synology docker container

I’ve googled but can’t see how to install node-red on Home Assistant when it’s installed on a Synology via docker. Can anyone point me in the right direction? Thanks

You don’t install Node-Red ON home assistant.

You install Node-Red in another container, and use the home-assistant nodes in node-red (install using palette manager) to connect to your home-assistant instance.

Thanks - I’ve downloaded the docker image, again I’ve googled around but can’t see what to put in the volumes and environment tabs as I try to install the item in pallet manager but I don’t think it can save anywhere…

Here’s a basic rundown of how that works.

a volume bind mount is simply a way to store data persistently on the host.

from the documentation on the docker image for node-red:
https://hub.docker.com/r/nodered/node-red-docker/

Running a Node-RED container with a host directory mounted as the data volume,
you can manually run npm install within your host directory. Files created in
the host directory will automatically appear in the container’s file system.

$ docker run -it -p 1880:1880 -v ~/.node-red:/data --name mynodered nodered/node-red-docker

~/.node-red is on the host, and /data is in the container. so based on that information, create a directory on your host (does not need to be .node-red, you can create a directory called ‘bob’ and your command would be -v /bob:/data

Thanks for this. If I put no “volume” settings in the synecology container, node red works but I can’t save anything. IF I add to the Volumes tab /docker/nodered (local file location) and then /data (container folder) the boot up of the container crashes with the below. Any ideas? Tough one to crack, most items I’ve tried are a lot easier to ge up and running in docker.

node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS “–userDir” “/data”
2018-03-30 09:14:31 stdout > [email protected] start /usr/src/node-red
2018-03-30 09:14:31 stdout e[?25l[e[90m…e[0m] \ : e[34;40mverbe[0m e[35mconfige[0m Skipping project config: /usr/src/node-rede[K [e[90m…e[0m] \ : e[34;40mverbe[0m e[35mconfige[0m Skipping project config: /usr/src/node-rede[K [e[90m…e[0m] \ : e[34;40mverbe[0m e[35mconfige[0m Skipping project config: /usr/src/node-rede[K [e[90m…e[0m] / : e[34;40mverbe[0m e[35mconfige[0m Skipping project config: /usr/src/node-rede[K e[Ke[?25h
2018-03-30 09:14:27 stdout e[0m
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m /usr/src/node-red/npm-debug.log
2018-03-30 09:14:26 stdout e[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Please include the following file with any support request:
2018-03-30 09:14:26 stdout e[0m
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m There is likely additional logging output above.
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m npm owner ls node-red-docker
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Or if that isn’t available, you can get their info via:
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m npm bugs node-red-docker
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m You can get information on how to open an issue for this project with:
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS “–userDir” “/data”
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Tell the author that this fails on your system:
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m not with npm itself.
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m If you do, this is most likely a problem with the node-red-docker package,
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Make sure you have the latest version of node.js and npm installed.
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Failed at the [email protected] start script ‘node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS “–userDir” “/data”’.
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Exit status 1
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0m e[0me[35mcodee[0m ELIFECYCLE
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0m e[0me[35mnpm e[0m v3.10.10
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0m e[0me[35mnodee[0m v6.12.0
2018-03-30 09:14:26 stdout e[0me[37;40mnpme[0m e[0me[31;40mERR!e[0m e[0me[35margve[0m “/usr/local/bin/node” “/usr/local/bin/npm” “start” “–” “–userDir” “/data”
2018-03-30 09:14:26 stdout e[37;40mnpme[0m e[0me[31;40mERR!e[0me[35me[0m Linux 3.10.102
2018-03-30 09:14:26 stdout
2018-03-30 09:14:26 stdout at Function.Module._load (module.js:438:3)
2018-03-30 09:14:26 stdout at tryModuleLoad (module.js:446:12)
2018-03-30 09:14:26 stdout at Module.load (module.js:487:32)
2018-03-30 09:14:26 stdout at Object.Module._extensions…js (module.js:579:10)
2018-03-30 09:14:26 stdout at Module._compile (module.js:570:32)
2018-03-30 09:14:26 stdout at Object. (/usr/src/node-red/node_modules/node-red/red.js:104:20)
2018-03-30 09:14:26 stdout at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-sync.js:40:7)
2018-03-30 09:14:26 stdout at copyFileSync (/usr/src/node-red/node_modules/fs-extra/lib/copy-sync/copy-file-sync.js:24:16)
2018-03-30 09:14:26 stdout at Object.fs.openSync (fs.js:642:18)
2018-03-30 09:14:26 stdout at Error (native)
2018-03-30 09:14:26 stdout Error: EACCES: permission denied, open ‘/data/settings.js’
2018-03-30 09:14:26 stdout
2018-03-30 09:14:26 stdout ^
2018-03-30 09:14:26 stdout return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
2018-03-30 09:14:26 stdout fs.js:642
2018-03-30 09:14:25 stdout
2018-03-30 09:14:25 stdout > node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS “–userDir” “/data”
2018-03-30 09:14:25 stdout > [email protected] start /usr/src/node-red

permission denied. you need to adjust your volume permissions. You have a couple of choices. Find out what UID/GID node red runs as and set permissions accordingly on the host, or chmod 777 that volume on the host

Either way, you want to make sure you have the latest:v8 tag on node-red

1 Like

That’s the one, thanks it’s now working.

Hi @CousinLarry,

Sorry but i’m new about node-red, Which are the option to include node-red in HA?

How did you config node-red in your synology docker, and how in HA to show it?

thanks

You don’t do anything to add node-red to home assistant. Home Assistant is unaware of node red. You run node-red and communicate over the API. You don’t have to change home assistant configuration for node red.

Hi,

So now that i have running node-red docker, what can i do, which are the advantages or aims using node-red in HA?

imagen

thanks

You create automation flows?

I’m curious why you would install it if you had no ideas why…

Hi,

Till today, i created automations by programming a yaml file.

I red in internet time ago, that is possible to combine node-red and HA, to design automations, this is the reason why i decided install it. Also, because i’m using docker and would like to know if it’s complicated or not.

I was watching some videos in youtube, the aims of using node-red and HA, so i’m trying to learn it :slight_smile:
https://www.youtube.com/watch?v=kQttmmrXY3Q

https://www.youtube.com/watch?v=9qbddDF8nPo

https://www.youtube.com/watch?v=jOO-PkebwEM

that’s all.

thanks

NonSynology if that matters;
I’m running Home Assistant image from docker and installed node red seperate container. Does this work ? I got it to work if I took the base_url out of configuration.yaml and didn’t mount a persistant volume ? But now I can’t get to work at all? Really need a persistent volume if making automations in node red no?

Yeah?

That’s how I run it.

You will want to preserve those node red flows won’t you?

If you want any semblance of sanity, yes.

Ran into some other posts elsewhere that said to get to work had to remove the mounted volume.
My compose yml looks like:
nodered:
container_name: nodered
restart: unless-stopped
image: nodered/node-red-docker:v8
depends_on:
- hass
#user: “admin”
#devices:
# - /dev/ttyUSB0
volumes:
- ${DOCKER_CONFIG}/nodered/data:/data
# - /etc/localtime:/etc/localtime:ro
ports:
- “1880:1880”
- “9123:9229”
links:
- mqtt:broker

Installed the node-red-contrib-home-assistant

1 Like

I really have no idea what you mean by this.

what “volume” are you referring to?

volumes:

  • ${DOCKER_CONFIG}/nodered/data:/data

But that is LITERALLY the one volume you would NEED mounted in order to retain data.

Does the path even exist? You need to mount a volume that actually exists on the host system. That’s how it works.

[https://github.com/node-red/node-red-docker/issues/8](http://)

That link has literally nothing to do with using docker on another system. It was for a pi.

A. Make sure the directory exists and your docker user has permissions to it (make it chmod 777, it doesn’t matter)

B. Mount it in the compose.

1 Like