I have node-red running in a docker container on a Synology box. Then I added a home assistant install in user settings palette. Is the one I installed the right one? I did “node-red-contrib-home-assistant-websocket”. I think this might be an “alpha” version. Should I have installed “node-red-contrib-home-assistant-ws” instead? If so, should I uninstall the one I installed? I think I read there was trouble uninstalling this.
that one, if you look at the ws
version you will see it has not been updated in years. 5 years 3 months was the last time it was updated
Yes, I saw that the “ws” one was old, but I thought it might be a really stable version. This “websocket” one says I have to install some sort of custom integration in home assistant and I wasn’t sure about using this one. I’ve never done a custom integration so I will have to figure that out too. I’m a newbie. Plus, I am always wary of “custom” things and whether they are trustworthy.
At least, I apparently don’t have to worry about uninstall this “websocket” one.
You’ll need the hacs companion for certain functionality. You can create an entity, for instance, in nodered and have it show up in home assistant. For that you need the companion.
In general the HA nodes are pretty much fully functional without it.
To add it’s the same dev as the HA websocket nodes.
I’ll have to read up more about hacs, but I think it isn’t obvious how to set up when using a docker container on synology. (no add-ons)
Did you mean to say “HA nodes are NOT pretty much functional without it”? If they are pretty much function without it, why add it? What functionality does it add?
HACS offers a faster update push, meaning it’s faster to get an update out. I presume that functionality is what is most likely to change.
I’m off to try to figure out how the heck to get hacs going. I don’t know anything about where “terminal” is or how to use “terminal” (which is shown in a lot of examples) and I can’t do “add-ons” in home assistant and the link for getting it doesn’t seem to work. Not sure if it does work when it is using nabucasa.
Off to research…
(disappointing it isn’t simple since lots of people seem to use it)
It’s really simple, you need to install the terminal/ssh addon. Start the terminal addon, wait for it to start then click go to web ui. Then enter
wget -O - https://get.hacs.xyz | bash -
Once it’s finished, go to integrations page and add it like any other integration. You’ll need to set up an account on github.
NO addons. And if I remember from many, many years ago, ssh is kind of a security risk.
… time passes …
I managed to get HACS added on. Created folder in home assistant config subfolder “custom_components/hacs” and downloaded and unzipped hacs.zip. Then restarted home assistant docker container and opened home assistant in browser again. Then hacs showed up in integrations. Then had to give permissions from my github account to hacs. (that last part worries me some. don’t know what I gave away…)
But hacs seems to be there now.
On to the next step…
… time passes …
Got Node Red Companion installed through HACS.
Managed it without terminal or ssh commands.
Now back to Node Red and see what happens next…
Well, I thought things were going pretty well, but now when I try to set the Home Assistant url in Node Red, I get an error message. “Error retrieving translations”.
Any clue what that is about before I search the web? Is it because I have home assistant set up for https and nabu casa? It didn’t let me put the nabu casa url in. “localhost” or the local IP resulted in the same error message.
Nothing is ever easy.
… time passes …
I’m guessing it is a permissions issue. I’m not able to change the permissions there on first blush. How does one set up a user for node red and make the container use that user?
… time passes …
I see that my admin user is the owner of HACS folder, but “root” is the owner of code red folder.
I know root is probably dangerous, but that is all I know. I’m guessing that node red is not running as root and that is the source of the problem. And because my admin user isn’t root, it can’t change the folder permissions.
If you are using Node Red as a standalone Docker container (NOT the addon) this is a good guide for setting everything up. Its the one I followed and everything works well.
Other things with your docker networking is Home Assistant should be run in “host” networking mode, where Node Red should be in bridge networking mode. Therefore, to reference the Home Assistant server, using “Localhost” or 127.0.0.1 will not work, and you need to spell out the IP of the machine it is on. Also, don’t use the external URL because you want this to be up if you have a network outage. If your home assistant instance is running on a machine with IP 192.158.0.145, your base URL in Node Red in the Home Assistant server node would be http://192.168.0.145:8123
However, Synology almost always throws a curve into a problem, so if it still doesn’t work after following the guide someone more familiar with synology would probably have to weigh in.
Thanks for the tips. I made it the “host” networking node. I’ll work on changing that. I ended up using the IP of the machine so that should be good. I’ll look into the link you provided. Thanks. Have to run an errand so will be back to try more later.
I mean running Node Red in host networking mode as well will work, but it shouldn’t be necessary and opens up all the ports to it. I don’t like using host networking mode unless absolutely necessary - Home Assistant is the only docker container I have that runs in host networking mode.
Also, make sure you create the “long lived” access token in Home Assistant, and copy the whole thing over to Node Red. When I first set it up, I thought I copied all of it, but there was more after a period that I missed and it didn’t work at first.
Also, as far as the Node Red companion in HACS, that’s only needed if you plan to use a few of the extra nodes - entity or webhook I believe are the only ones. Its not needed for the call service, event state, or current state nodes which are the ones you use the vast majority of the time for Node Red automations. The entity node would create a device on the Home Assistant side that is controllable through Node Red. The webhook node (which I never used) would “Output the data received from the created webhook in Home Assistant”
I have the Node Red companion HACS addon now, but for a long time ran everything fine without it.
Can HA run on NOT “host” networking? Maybe I should change it?
I’m pretty sure the whole access token was copied. It didn’t complain about that part as far as I know.
On HACS, ok, but I have it installed now and it is recognized by HA and is the menu on the left. Since you have the HACS “addon”, I assume that means you are NOT running in Synology Docker Container. (but I thought from what you wrote that you WERE)
Home Assistant needs host networking mode for many of its integrations to work- which communicate over various different ports/methods. Some run it in bridge mode, but it can cause problems and I wouldn’t recommend it.
HACS is not an addon. It is not part of the official or community addons, and unlike these other addons, it can be installed in a container/core install like the one we are both using. I am running Home Assistant container on Docker over Ubuntu (NOT synology) but it works mostly the same way other then the quirks synology throws into the mix.
Well, I have it really screwed up now. I decided to start over with NodeRed. So I removed the token from my Home Assistant user, then shutdown the nodered container, then deleted it. Then reloaded the registry for nodered (I think I got the same one as before). I downloaded it and launched it. I tried the bridge, put in a timezone, and mapped a path to an existing folder. Then the container launched and got error messages saying it was restarting over and over. I tried it again with host instead of bridge and it didn’t make any difference.
I think when I did it before, I found a video somewhere showing sort of what to do. I think I manually downloaded the nodered zip file and unzipped it in the target folder. Then ran the registry and launch steps. But of course, I don’t remember where I found that video before (or even if it was a video). First time of doing something like this is always confusing and you never know exactly what you did…
The link you provided seems to start with the nodered container already running.
So any idea what I’m doing wrong. I’m not even sure why it is restarting. I might not know where to look to find information on it.
… time passes …
Ok, I found the log for the node red container.
I see that is a “permission denied” when it tried to copy a .js file to the /data folder. I think that happened when I did it before. I think I gave EveryOne full permissions to get past the problem.
But how do I know what the user is that runs the container? So far, I haven’t found anything that says what Docker is doing by default for the user.
… time passes …
I made permissions for the nodered folder explicit and gave read and write to everyone, just to get past the problem. And it DID work.
I’ll go back again, I think, and try it with bridge because I think I used host last time I tried.
… time passes …
Apparently when I used bridge, it won’t work. Don’t know why. But it DOES work with host. I’ll try one more time with bridge and look closer at what happened.
It said, “Hmmm… Can’t reach page” refused to connect
… time passes …
Well… I don’t know why, but it all seems to be working now. I don’t understand what user is running the container, nor how to put on more restrictive permissions, nor why it failed the first time I did it, but now the Node Red container can be accessed on 1880 and successfully deploys.
And there are probably some other things I don’t understand with node red and home assistant too.
At least I can now explore node red and see if I like what it does.
Sounds like a frustrating process. I’m assuming it’s some synology issue why node red has to run in host networking mode. Mine works fine in bridge mode.
From a permissions perspective, the node-red user in the docker container will always map to whatever user has UID 1000. Many docker containers allow you to change that user mapping with environment variables but node red doesn’t seem to have that option. On a normal Linux system, user 1000 is usually the first user created, and the one you run everything under, so you don’t have permission issues and permissions by the container and volume on the host matchup. On a NAS, that usually isn’t the case.
I’m not an expert on this but see the links below- one on node red permissions and another from the synology forum.
See the post near the bottom from Brent
Running home assistant container is hard enough, but I think your container install over synology OS is just going to keep making everything that much more difficult for you unfortunately. You may want to look at running home assistant container on a different machine using a normal Linux OS down the road to make things easier.
I don’t mind the work. I don’t get frustrated. I’ve done programming since 1966. If I got frustrated, I wouldn’t have made it this long (though admittedly, I don’t work any more)
I view it as a chance to learn more about the Synology box. And the fewer kinds of boxes the better.
I’ve got it working now, as far as I can tell. That is all I care about. Glad to get more use out of the Synology. As long as doesn’t use too much resources. So far, it looks fine.
I’ve already spent a fair amount of time on the Synology forum. I’ll check your link. And thanks for the permissions link. I was there earlier and didn’t see the “permissions and persistence”, but I probably didn’t know what to look for at that point.
Very good, you are much more patient then I would be