ZWave stick USB port now configurable via GUI?

So I was listening to the (awesome!) Home Assistant podcast this morning and there was a casual mention that since ZWave was added as an integration, the port for the ZWave USB sticks is configurable via GUI. So my question is, where?

For me the latest changes have made things slightly more complex on the USB side. Before, if I took a VM snapshot (and thus unfortunately also triggered a USB device shift, like from ACM1 to ACM2), it was enough to just change the device in configuration.yaml.

Now, however, I also have to enter HASS.IO via SSH and change the ID in core_config_entries, which as you can imagine is more than a bit annoying and also leads to more Z-Wave downtime than Iā€™d like every time I make a snapshot.

Am I doing something wrong? In the Integrations menu Z-Wave is seen as being ā€œimported from configuration.yamlā€ and my UZB device is not among the Z-Wave devices being shown there, but in any case clicking on the other devices doesnā€™t seem to give me more options than the regular UI for Z-Wave entities.

So, was it an error on the podcast, is it something coming soon but not yet releasedā€¦?

AFAIK, once Z-Wave is configured you canā€™t change the usb path in the UI. The UI configuration option is available during the first time setup, but thereā€™s no option to change it later. I think youā€™re stuck editing the config.

A better choice would be to use persistent device names. There are two choices, 1) use a udev rule to map the device to a name of your choice, or 2) if HASS.IO supports it, use the default persistent paths generated by Linux. Most distributions do support this out of the box.

The udev rule method is described here: https://www.home-assistant.io/docs/z-wave/installation/#device-path-changes (link to a guide). This may not be an option for HASS.IO because you need to copy a file to the system paths.

In my config I use /dev/serial/by-id/usb-0658_0200-if00. This never changes because Linux creates the name based on some ID information provided by the device, which is fixed, and points that name to the actual device file. Almost all Linux distributions do this by default, but youā€™ll have to check if itā€™s true for HASS.IO. There is also a by-path device name which is based on the ā€œlocationā€ of the device, e.g. the USB port, but that isnā€™t as reliable because it will change if you move the device to another port.

You can check if you have a persistent ID name like this:

$ ls -l /dev/serial/by-id/*
lrwxrwxrwx 1 root root 13 Nov 11 00:22 /dev/serial/by-id/usb-0658_0200-if00 -> ../../ttyACM0

If I unplug and re-insert the USB stick, the by-id name will stay the same, it might point to ttyACM1 instead. HASS doesnā€™t care what it points to.

I used to use a UDEV rule to map the device to /dev/zwave, but that was one extra file to re-install, whereas the by-id path is always there if I re-install the OS.

5 Likes

One more thing, the /dev/serial/by-id name only works if you have just one kind of USB stick plugged in. For example, if you had two Aeotec Z-Sticks plugged into the same system, the names would collide, as the name is based on the USB vendor and product ids which are not unique per-device. If that were true, you would need to use a udev rule that would use something unique per-device, like the actual serial number. The guide linked by the HASS docs explains this in more detail.

http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

2 Likes

Thanks a lot for the info, will give this another shot todayā€¦I actually did try to use such a path before, but I didnā€™t have all the information you just gave, so probably missed something. Will post the results, might be useful for others as well :slight_smile:

I really appreciate your info, the issue has been resolved!

Iā€™ve replaced the ACM1 path with /dev/serial/by-id/usb-0658_0200-if00 (my ID turned out to be the same) in both configuration.yaml and core_config_entries (SSH into HASS.IO and edit config/.storage/core.config_entries if anyone else is interested) and the entry now survives VM snapshots!

2 Likes

Hi, can you help a noob please. I have just tried to use a zwave usb stick with the integration. The default USB path is not correct. How do I find the correct USB path? Right now the default is /zwaveusbstick returns message Z-Wave validation failed. Is the path to the USB stick correct?

Have you tried typing ā€œls -l /dev/serial/by-id/*ā€?

1 Like

thanks, I didnā€™t try yours, found this and it worked:

/dev/ttyACM0

It does work, but Iā€™ve found that if anything happens to your USB ports (like putting a USB stick while HA is running and then removing it), ttyACM0 becomes ttyACM1, then after some other change goes back to ttyACM0, or goes to ttyACM2, etc. The full device ID is better, since it never changes.

Just wanted to mention I did the by-id thing and for hours I was frustrated it didnā€™t work. Then I discovered the ā€˜bugā€™ with core_config_entriesā€¦ edited those usb_paths and now all is good with hassio on my pi.

FWIW, I was running bothering zigbee and zwave radios on a nortek husbzb-1 stick with no problems over countless reboots, no special config needed. The problems started after I added a serial sensor (arduino nano w/ ch340). Some reboots left hassio with no devices at all (no zwave, zigbee, or nano), other reboots had no zigbeeā€¦ etc.

The by-id trick along with fixing core_config_entries was the magic bullet.

That ā€œbugā€ has been fixed since 0.91. A usb_path in configuration.yaml overrides the config entry.

All I know is I have only been using hassio for about month, and this just happened. I was on the current release yesterday when this happened. However Iā€™m not sure if it was introduced by something I did in my frenzied pace of learning/configuring hass. :wink:

configuring Z wave from the GUI works now, even if itā€™s after initial installation