Not sure how this works on synology’s docker implementation, but when creating the container you’ll need to add
--device=/dev/ttyACM0
so that the device is passed through from the host to the container.
Not sure how this works on synology’s docker implementation, but when creating the container you’ll need to add
--device=/dev/ttyACM0
so that the device is passed through from the host to the container.
make sure you’re running the docker container with high privilege. If using the docker frontend GUI, it’s a check box that says “Execute container using high privilege”.
Hi Tinkerer, thanks for your help. I’m not sure if it’s visible in the Docker running HA. I mean, what I’ve done is SSH to port 22 of my Synology IP, and doing so, that’s what I get for ‘ls -al /dev/ttyACM0’:
crw------- 1 root root 166, 0 Nov 2 16:37 /dev/ttyACM0
I guess this means reading and writing permission only for admin/root user?
If that’s not what I was supposed to try and there’s another way to do SSH inside the container please let me know because, as you can see, I’m quite a newbie regarding all that stuff, sorry!
Furthermore, the log displays this:
[homeassistant.setup] Error during setup of component zwave
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/openzwave/option.py”, line 78, in init
raise ZWaveException(u"Can’t find device %s : %s" % (device, traceback.format_exception(*sys.exc_info())))
openzwave.object.ZWaveException: "Zwave Generic Exception : Can’t find device /dev/ttyACM0 : [‘NoneType: None\n’]"
Hi marthocoo, thanks for helping!. That is what I was thinking, but I don’t know how to interact with the container!!
Hi squirtbrnr, I really appreciate your help. It seems a privileges issue, but I cannot find the checkbox you are indicating. I am using docker app form synology with a container for HA but, it seems I cannot change anything from the container or I don’t know where to look at. I mean, this is my conatiner GUI:
The settings options only include duplicate, import or export!
Thanks again!
Looks like it’s one of the options when you are on the images page and hit “Launch”. The next dialog has the option “Execute container with high privilege”. See: https://www.synology.com/en-global/knowledgebase/DSM/help/Docker/docker_container.
Try:
sudo chgrp homeassistant /dev/ttyACM0
sudo chmod 660 /dev/ttyACM0
@Tinkerer Won’t work, he has to somehow pass it through to the container. On synology it looks like executing in “high privilege” is the same as Docker’s -- privileged
option.
look at what marthocoo posted. you have to stop the container then go into the edit options to find the checkbox.
It is a permissions issue. you can solve it one of two ways: execute the container with high privileges or issue the following command on your Synology over SSH:
sudo chmod 777 /dev/ttyACM0
The downside is every time you reboot your Synology or unplug the Z Wave stick and plug it back in (or it changes to /dev/ttyACM1) you have to re-run the command over SSH. That’s why I just execute the container with high privileges.
OK, I’ve tried it but I didn’t have a homeassistant group created, only administrators or users group. So I have tried with users but it didn’t do the trick (after stopping and restarting).
So I’ll try what squirtbrnr is saying, Thanks!
As my HA is almost new, I think I can try to create a new container from the latest software version image and thus creating it new with the high privilege option. I’ll report how it went! Thanks again!!
Thank guys!! Problem solved!!. And I didn’t have to launch another container because when stopped you can access to ‘edit’ and change privileges to high and that did the trick!! My zwave stick is now up and running. Thank you marthocoo, squirtbrnr and tinkerer even if I thought it was permissions related, I could have been DAYS to solve it, appreciate it sincerely!.
If you delete the old and create a new container you won’t lose any of your config as long as you specify the same volume info.
For what it is worth, I created the following docker-compose.yml file
(I use z-wave stick AND the NAS built-in DDNS AND the NAS built in Synology SSL certificate created by “Let’s Encrypt”)
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant
volumes:
- /volume1/[Redacted]:/config
- /etc/localtime:/etc/localtime:ro
- /usr/syno/etc/certificate/_archive/[Redacted]:/certificate:ro
devices:
- /dev/ttyACM0:/dev/ttyACM0
restart: always
network_mode: host
I then SSH into my NAS, and changed directory to where this file is stored, and created it with:
sudo docker-compose up -d
in my configuration.yaml
zwave:
usb_path: /dev/ttyACM0
#Using the certifiate generated by NAS > Control Panel > Security > Certificate > Let's Encrypt
#In combination with DuckDNS NAS > Control Panel > External Access > DDNS > Customize
http:
# Secrets are defined in the file secrets.yaml
api_password: !secret http_password
server_port: 8123
# Uncomment this if you are using SSL/isTLS, running in Docker container, etc.
base_url: !secret fqdn
ssl_certificate: /certificate/fullchain.pem
ssl_key: /certificate/privkey.pem
cors_allowed_origins:
- https://google.com
- https://www.home-assistant.io
trusted_networks:
- 127.0.0.1
ip_ban_enabled: True
login_attempts_threshold: 5
With this it is as neat as I could get it.
Newbie trying to crash the party here…any help would be very much appreciated.
I’m in a similar boat of trying to get a brand new Aeotec Z-Stick Gen5 running on a DS918+. I’ve tried this a couple of times on my own and to simplify the trouble shooting I’ve burned it all down and have a clean Docker install, and I’m only trying to get the Z-stick working. Here’s what I’ve done and my results so far:
zwave:
usb_path: /dev/ttyAMC0
sudo docker exec -it home_assistant_1 bash
ls -al /dev/ttyACM0
crw------- 1 root root 166, 0 Aug 20 16:13 /dev/ttyACM0
--device=/dev/ttyACM0
bash: --device=/dev/ttyACM0: No such file or directory
Any idea what I’m doing wrong? (or if I’ve just completely missed a setup tutorial somewhere?)
Should I be trying to use a docker-compose.yml file described by @shark711 ? (I have no idea how to use those, any pointers on where to start?
Thanks everyone!
The command --device=/dev/ttyACM0
is part of the docker run command you issue from a ssh login into the NAS, not the docker container. So the pseudo full command would be something like:
sudo docker run --name=homeassistant -privileged --device=/dev/ttyACM0 homeassistant/home-assistant:latest
You’ll also have to link the config directory and any other folders as well using the -v
switch
Thank you very much. I’m up and running, in my case my exact command looked like:
sudo docker run --name home-assistant --restart=always --net=host --privileged -itd -v /volume1/docker/homeassistant/config:/config --device /dev/ttyACM0 homeassistant/home-assistant
(to give full credit your post directed my bumbling a little better and I finally found Phil Hawthorne’s guide)
So, after doing some more digging/basic learning I have one more question: Is it true that I cannot add a device to an existing docker container? I will always need to delete and launch a new container in order to adjust what devices Home Assistant has access to?
yes and no. you can only attach a hardware device using the --device=
command from a command line. the gui version of docker does not allow it, nor show it attached once it is running. If you use sudo docker create
followed by sudo docker run <container_name>
then you don’t need to add the -itd
switch to the command and you can take the container down/up without having to recreate it every time. Also, privileged mode allows the container root access to system level stuff like /dev
which can be used in conjunction with adding the device to the container.
Hi, afraid I am rather blank at this, but I am trying to set up Home Assistant on my Synology NAS and using an Aeotec Z-Wave stick. I have tried both Phil Hawthorne’s instructions (but that fails since I get the message that I don’t have permissions to create the homeassistant/config folder, even though logged on as admin) and running the setup from Docker like taggr, but getting the same issue when trying to add the Aeotec stick by modifying the configuration file, which I undertand is not a feasible approach. Feeling rather flat on a Friday night from not figuring this out. Any advice?
Do you have that set up in a docker? If you do, you need to “mount” the Local USB device in the docker list of devices. I don’t think you can do that from the Synology GUI (I checked mine and didn’t see it anywhere in there), so you’d need to get ssh access to execute docker-compose
If you run that command, it will check the present working directory for a docker-compose.yml
file, so make sure you create that first.
This is what mine looks like, notice the devices
section. In the volumes
you only need the config line, i.e. first line in there.
This will automatically download the homeassistant/home-assistant
image and configure and start it up.
docker-compose.yml
:
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant
volumes:
- /volume1/Configuration/Home Assistant:/config
- /etc/localtime:/etc/localtime:ro
- /usr/syno/etc/certificate/_archive/[Redacted]/:/certificate:ro
devices:
- /dev/ttyACM0:/zwaveusbstick
restart: always
network_mode: host
Make sure you have SSH access
In DSM Homepage > Control Panel > Terminal & SNMP > Terminal (tab)
[✓] Enable SSH Service
If you on Linux/Mac you can use the native ssh command, or using something like PuTTY if you on Windows
Login with you DSM admin user and password
Then execute
sudo docker-compose up -d
After home-assistant starts up, you then only need to go to:
Configuration > Integration > Z-Wave’s CONFIGURE
The above docker-compose.xml
file mounts it to /zwaveusbstick
, which is the default location the home-assistant integration checks. You no longer need to add it in configuration,yaml
file