HA on Synology using Docker with ZHA integration and Conbee2 USB stick

What’s your docker run command or how do you map the device to the zwavejs2mqtt container? Also is there any other container currently running that also has the device mapped to it?

Hi,

I created this container using the GUI and let in run in Priviledged Mode.
My 2 USB devices is found at the moment as Conbee2 stick as /dev/ttyACM0 and Z-Wave stick as /dev/ttyACM1.
With the help of Tim and You I was able to associate them permanently to /dev/ttyACM10 and /dev/ttyACM11 as above conversation.
HA sees the Conbee2 stick as /dev/ttyACM10 and works fine,

The question is why Z-Wave2mqtt container doen not see ACM10 and ACM11?

The picture is when trying to map the stick using the Z-wave2mqtt GUI.

//AseKarlsson

Instead of selecting from the dropdown, try to just manually type /dev/ttyACM11 into the control panel settings page and click save.

If that still doesn’t work, you’ll probably have to use the device option instead of priviledged mode to map the device into the container.

Thanks Tim,

Tried to manually change to /dev/ttyACM11 and save, no error message but on next refresh of the page it is back to /dev/ttyACM1 again.

The Device option, how can that be used with Synology GUI?
Tried with Enviromental options:
Variable: Device
Value: /dev/ttyACM11

Did not work and also tried to install the docker using:
docker run --rm -it -p 8091:8091 -p 3000:3000 --device=/dev/ttyACM11 --mount source=zwavejs2mqtt,target=/usr/src/app/store zwavejs/zwavejs2mqtt:latest
but here I got error that it could not find the gateway.

//AseKarlsson

I feel like there is some synology specific thing I am missing here. There’s some ideas on this thread Aeotec Z-wave stick Gen5 on Synology installation . Maybe you need to install an extra driver for the zstick? I’d be interested to hear @squirtbrnr thoughts on this with a successful zstick setup on synology.

It doesn’t appear you can use the synology gui here. The device option can’t be specified as an Environment variable.

I’ve never been able to use the Docker app GUI on Synology when setting up HA with a device. The option does not exist in the GUI. If you have a device such as Zwave or Zigbee stick, you must use the command line to create and run the container. Also, I’ve never been able to get the device working without using the device flag and the privileged flag. An alternative to using the privileged flag is doing a chmod on the device at the host level with 777 so any user can access the device. But this does not survive a reboot of the host or unplug and plug in the device.

As for a specific driver, I know DSM 7 removed a lot of drivers and requires a driver to be loaded to get the Zwave stick to be recognized. I think the zigbee sticks are still automatically recognized. I’m still running the latest DSM 6 and don’t have any issues with loading the Zwave stick. I’m on mobile right now but I’ll post my docker run command later.

If you want a better gui to manage docker, I’d look into installing portainer.

I used portainer for about a week and just decided to learn to use the command line. My next step is learning docker compose because that has more configuration options such as linking containers that are dependent on other containers and then it’s a simple command of “down” and “up”.

You can put a compose file together right in portainer as a stack, and it will let you know if it has any errors as you go along. Portainer will save the contents of the compose files all in one place and make updating the containers pretty easy.

Here’s a good write up about it.

My compose for zwavejs2mqtt is higher in the thread here HA on Synology using Docker with ZHA integration and Conbee2 USB stick - #5 by mwav3 I put the compose right into portainer to manage the whole process.

Hi,

I fixed earlier the removed drivers from DSM 7.

Both sticks are shown fine by Synology as both ttyACM0 and ttyACM1.

The linking ConBee2 → ttyACM10 and Z-Wave → ttyACM11 is fine as well and all 4 can be shown by Synology.

HA Container installed using GUI without –device switch, but using privileged mode instead.

The Conbee2 stick can be reached from HA as both ttyACM0 or ttyACM1 (depending on what address it got after reboot) but always as ttyACM10 = Great!

Z-Wave2mqtt container (also installed in priviledged mode) can see both ttyACM0 and ttyACM1 and the Z-Wave stick is one of those (depending on what address it got after reboot).

Also tried to install the Z-Wave2mqtt docker using command line specifying –device=/dev/ttyACM11 but I get an error that it cannot be reached.

So the big question is why Z-Wave2mqtt cannot see the “aliases” ttyACM10 and ttyACM11?

Thanks,

AseKarlsson

Here are some thoughts and various ways to test them:

Scenerio 1:
The Home Assistant container running in privileged mode is locking the ttyACM11 port to it, even though it is not using it. If that happens, the port is not available to the zwave2mqtt container and you will get the error it can’t be reached. To test this, try stopping the Home Assistant container when you start zwavejs2mqtt. If it works, you’ll have to either figure a way to run Home Assistant not in priviledged mode, or make sure that the zwavejs2mqtt container starts before the Home Assistant container.

Scenario 2:
Other possibility is ttyACM11 is just too high of a port number for zwavejs2mqtt to recognize. Based on this post in github https://github.com/zwave-js/zwavejs2mqtt/issues/216 it appears that the port listings in zwavejs2mqtt might be a static list of device names from whatever linux distribution the container was based on, and you have to use one of those. In that case, you can do a mapping with the device flag like so:

--device /dev/ttyACM11:/dev/ttyACM0

This will make the host ttyACM11 device appear inside the zwavejs2mqtt container as ttyACM0, so in the container’s settings, you pick ttyACM0, which is the zstick mapped from the host’s ttyACM11. This is what I do so can confirm it works (at least on ubuntu). My UDEV rule creates a device on the host called /dev/ttyusb.zstick . That is mapped to /dev/ttyACM0 in my container, and I pick /dev/ttyACM0 from the drop down in the zwavejs2mqtt settings.

This mapping may conflict with privileged mode though, so you many not be able to use privileged mode for the zwavejs2mqtt container.

2 Likes

Hi Tim,

Thanks for your reply, Scenario 1 was quick to test.
The HA container does not lock the ttyACM10 and ttyACM11 for itself, they did not show up in Z-Wave2mqtt even if that was started by itself.

For Scenario 2 i need some more time to test.

Thanks,
AseKarlsson

I do not believe privileged mode is required any more if not connecting the device directly to the container. Though that said, the zwavejs2mqtt container may now need privileged mode.

EDIT: I can confirm privileged mode is no longer required if using a udev rule. I have implemented the symlink from ttyACM10 to ttyACM0 using the Vendor ID and a udev rule file and it works just fine.

1 Like

I was playing around and I believe you must use one of the mappings listed from the drop down in zwavejs2mqtt to work.

I just tried this mapping /dev/ttyusb.zstick:/dev/ttyS1 and it worked when I selected /dev/ttyS1 in the zwavejs2mqtt settings. Maybe you want to try that mapping so there is no conflict with the ttyACM0 on the host.

So your mapping in this scenario would be:

--device /dev/ttyACM11:/dev/ttyS1
1 Like

Hi,

I now started HA without priviledged mode and it could not find any of the ttyACM* devices.

Thanks,
AseKarlsson

Hi,
Now when using the command line:
docker run --rm -it -p 8091:8091 -p 3000:3000 --device /dev/ttyACM11:/dev/ttyS1 --mount source=zwavejs2mqtt,target=/usr/src/app/store zwavejs/zwavejs2mqtt:latest

I get the error:
docker: Error response from daemon: error gathering device information while adding custom device “/dev/ttyACM11”: no such file or directory.

Ideas?

Thanks,
AseKarlsson

From a command prompt on Synology, what happens when you run

ls /dev/ttyACM11

If you get an error, the device is not being recognized as ttyACM11. Here’s the difference between a valid USB mapping and one that isn’t:

Screenshot from 2021-09-29 13-52-20

Hi,

Now so unsure.
In the middle of this the DSM version got updated.
Created the 99-HomeAssistant.rules again, but it will not create the ttyACM10 or ttyACM11 directorys under /dev as before so that must be the explanation.

I will come back when I get the Aliases creatad again.
(The strange thing is that Conbee 2 can sill connect to ttyACM10 that does not exist anymore)

Thanks,
AseKarlsson

Yeah getting this to work on synology seems very prone to problems. I see your issue mentioned here on this github issue, with some possible solutions.

In the end, if you can’t get zwavejs2mqtt to work on synology, you may want to just get a cheap raspberry pi and run it on that separate. It can still link back to Home Assistant using the RPI’s IP address in the zwavejs integration.

Thanks All,

I also think this has taken too much time and effort and still breaks on every DSM update.
I removed my Z-Wave Integration and go only Zigbee at the moment.
Thanks Guys for teaching me a lot of Linux during this thread!

Thanks,
AseKarlsson