Two aeotec z-wave stick on one computer

I have two aeotec z-wave sticks on the same Intel NUC with Debian 9 and HA 0.95.4 using one and the ZWave2mqtt add-on using the other.
This works very well most of the time, but:
After a reboot the usb port names sometimes change! This is a strange Linux/Debian thing (why can’t linux assign the port names when the port is detected instead of when something is plugged into it?).
Before I had two sticks, I used the /dev/serial/by-id/xxxx device name. That worked well, but after adding stick number two, I found that they share the same ID! So this method cannot be used anymore.
I changed it to use /dev/serial/by-path/xxxx for both of them.
For the HA stick it works fine. But the zwave2mqtt one doesn’t accept by-path port names.
For now, after a reboot, I have to check which ttyACMx port zwave2mqtt gets.
Both zwave instances use the same ozw library, so why the difference?
Any experts out there with hints?

Because there is not a serial port there until you plug the device in!

If you don’t change the ports that they’re plugged into, you should be able to use /dev/serial/by-path instead.

EDIT: missed the part where you said you’re using by-path now.

Is there an error, or what happens? Submit a bug to the zwave2mqtt project?

You might add an udev rule to assign a symlink to that device which will reflect always the same name :wink:

1 Like

Looks like a problem with the javascript serial port library that zwave2mqtt uses. https://github.com/serialport/node-serialport/issues/1476

Any USB device if is unplugged for less than a minute it will be enumerated differently. So the udev rule will cover this case elegantly even there’s a bug from javascript.

So the most flaw is the way developer expect to see that device always on the same position as windows kernel assigning.

zwave2mqtt populates a drop down box with the list of serial port paths. It does not include symlinks, which is what I was referring to. But you can just manually enter the path name, so it’s not much of a hindrance.

The problem might be that this is a hassio addon, which I believe is just another docker container. It’s possible the symlinks are not being passed through docker into the container, I’m not sure hassio provides access to devices to addon containers. If it’s using --privileged, only the actual devices are passed through to docker, not the symlinks.

Another docker problem is that you cannot pass in device paths with colons, e.g. the by-path. It considers them an invalid name. https://github.com/moby/moby/issues/39293. A workaround for this is to execute docker with --privileged -v /dev:/dev, which allows access to the entire /dev tree. If hassio already does something like that, then you can just manually enter the path name into the zwave2mqtt serial port text box, instead of relying on the auto names.

I second the udev rule method. be sure to include the serial number to differentiate the 2

Aeotec sticks don’t have serial numbers.

@helgemor You’ll need to clarify how you have installed and are running zwave2mqtt. As a hassio addon? A docker container? Manually from a package or github?

my bad i just looked quickly
ID_SERIAL=0658_0200
i see that is a combo of vendor and model number.

Yep, that is the problem. Some sticks, like my UZB3, actually do have a serial number (I am assuming!), /dev/serial/by-id/usb-0658_0200_E2061B02-4A02-0114-3A06-FD1871291660-if00.

So, one solution to this problem is to buy a different usb stick. :slight_smile:

Just try to use

lsusb

That might give further info,