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

Try following this guide

You need to list the full attributes to ideally find a value that uniquely identifies the two different sticks, like a vendor ID or something.

udevadm info --name=/dev/ttyACMx --attribute-walk

To list the all the attributes

Then go to /lib/udev/rules.d

Use vi to create a .rules file. Try this:

sudo vi 99-hass.rules

Try these udev rules. You will have to replace what is between the {} with the attributes you found from the udevadm info command. Then after the == in quotes will be the attributes value from the corresponding attribute you found.

Here’s the .rules file contents (assuming zwave first then zigbee second)- one I specified vendor and product, yours could vary.

KERNEL==“ttyACM*”, ATTRS{serial}==“0000:00:1d.7”, SYMLINK+=“ttyACM4”
KERNEL==“ttyACM*”, ATTRS{idVendor}==“1a86”, ATTRS{idProduct}==“7523”, SYMLINK+=“ttyACM5”

This should hopefully statically set the zstick to ttyACM4 and the zigbee stick to ttyACM5 (even if they are swapped around)

Hopefully that works but if not you might have to modify the .rules file to be more like the one from the Openhab forum linked above.

Thanks Tim,

I found both ATTRS{serial} and ATTRS{idVendor} for both devices, idVendor i think is the way to go for me.
Can i make SYMLINK+=“ttyACM10” and “ttyACM11” of these or is there an upper limit in numbers?
Must the .rules file start with 99-?
If this works and I have to delete my Conbee2 Integration and add it again as “ttyACM10” will my devices and entities still be intact in HA?

This would be my file content:
KERNEL==“ttyACM*”, ATTRS{idVendor}==“1cf1”, SYMLINK+=“ttyACM10”
KERNEL==“ttyACM*”, ATTRS{idVendor}==“0658”, SYMLINK+=“ttyACM11”

Thanks,
AseKarlsson

That should be fine. I saw older kernels the limit is 32, newer is 256, so 10 and 11 should be no problem, unless I’m missing some unique synology thing.

Mine does and the example one in the openhab forum does. I dont know if it has to, but I would start it with 99.

You can keep the mapping into the docker container whatever it was before. This should prevent the need from reinstalling the integration. You map the device from host to container.

So just do

--device /dev/ttyACM10:/dev/ttyACM0

This will map the ttyACM10 on the host to ttyACM0 in the Home Assistant docker container, which should be what it was before and keep everything in tact.

Looks good to me. Give it a try, you can always change it or delete it if there is an issue.

1 Like

Hi Tim,
If this works I gladly delete my old ttyACM0 Integration and start over and map to the new ttyACM10, its only 38 entities at the moment.
This would be so much easier in the future to not have to add the --device option every time i update my docker container…
squirtbrnr, Do you know what happens when there is a new version of DSM och Docker?

Thanks,
AseKarlsson

last thing I think you have to do is reboot the Synology host for the rules to apply, or try running udevadm control --reload-rules. Make sure permissions on the rules file are correct too. EDIT: the reload rules did not produce the virtual port, but it’s possibly because I did not shutdown my HA container which currently has a lock on the port/device. Just a guess as to why it didn’t work.

according to linuxconfig.org:

The files in which the rules are defined are conventionally named with a number as prefix (e.g 50-udev-default.rules ) and are processed in lexical order independently of the directory they are in. Files installed in /etc/udev/rules.d , however, override those with the same name installed in the system default path.

new version of DSM will potentially wipe out your udev rule in the rules.d folder as noted in the OH forum post.

Every Synology update you need to recreate the 99-openhab.rules file, so keep a copy somewhere!

an update to the Docker package or the HA container image will not affect your udev rules and should not affect any mapping with the --device flag

1 Like

Even without the symlink you have to get the device mapped to the container somehow. What were you doing before? The only other way I can think of is priviledged mode. I don’t like priviledged mode for docker containers but basically it takes whatever was on the host USB wise and puts it in the docker container as is. If you are using priviledged mode you would have to specify ttyACM10 on the Home Assistant side in the ZHA integration as well.

We had a discussion recently about priviledged mode here

You may want to post your entire docker run command to double check its setting up the container properly.

I recall having to reboot my machine. Just trying to reload the udev rules didn’t work for me, and I thought I did something wrong, but it worked on reboot.

If the symlink worked running ‘ls /dev/ttyACM10’ should work without an error.

1 Like

Hi,
Here is a follow-up question because I dont think I will get time to test this and discover all devices again during this weekend: The ConBee2 stick was found by HA GUI after a reboot earlier like below:
ConBee2
Where is this adress stored, because I did not enter it manually in any .yaml file?

My question summerized, can I find this adress somewhere and change it from /dev/ttyACM0 to /dev/ttyACM10 and keep all my devices and entities intact if our .rules file works as we think?

I run the container in Priviledged mode because my knowledge is limited and got it working like this

Thanks,
AseKarlsson

It’s in your config directory, “.storage/core.config_entries”

                "domain": "zha",
                "title": "BV 2010/10, s/n: xxx - Silicon Labs",
                "data": {
                    "radio_type": "ezsp",
                    "device": {
                        "path": "/dev/ttyUSB0",
                        "baudrate": 57600
                    }
                },

If “path” doesn’t exists, add it. “/dev/ttyACM0” is the default, I think.
Then restart HA.

Hi Chris B,

Great! I found the File and Entry!

Thanks,
AseKarlsson

Hi All,

ConBee2 now moved to /dev/ttyACM10 with all integrations intact, It worked!
Thanks All !!!

Now starts the work on Z-Wave… HA did not find it by itself and could not be find manually either using /dev/ACM11 or /dev/ACM1 when adding Z-Wave JS automation, Still the Synology and Docker seems to be able to map it.

Thanks,
AseKarlsson

Glad you got the zigbee stick working.

Although zwavejs as an integration is in home assistant, the underlying Zwavejs server is not built in to Home Assistant like ZHA or the old OpenZwave are. On a supervised/HassOS install, you have to install the zwavejs addon for it to work.

With a Home Assistant container install, you’ll have to install zwavejs2mqtt in its own docker container for zwave.

See this documentation:

https://zwave-js.github.io/zwavejs2mqtt/#/getting-started/quick-start

1 Like

Hi Tim,
Installed Z-Wave2mqtt in an own docker with High Priviledges.
Z-Wave2mqtt server up and running and can be found by HA.
The strange thing here is that Z-Wave2MQTT cannot find the entries we made earlier (/dev/ttyACM10 and /dev/ttyACM11), it only shows the original (/dev/ttyACM0 and /dev/ttyACM1).
Any ideas?

Thanks,
AseKarlsson

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”.