ZWave usb stick and VM

Hello all I hope this is the best place to ask this. A couple of months ago I migrated over from a raspberry to a virtual machine via VirtualBox. Part of my setup includes a GoControl husbzb zwave/zigbee stick for control over various devices. After a bit of work I got everything migrated and working including the stick, however, I have noticed a problem. When my host machine shuts down and restarts my vm software can no longer find the usb stick. I have to physically un-plug and plug it back in to get it to show up. Whats more is the vm needs to be running before I do this to find the stick, then I have to re-start hassio for the software to access it. I installed devcon on my windows host machine which allows me to search for the device, stop, and start it to which I set up bat files to try this process but still no luck. After a bunch of testing I am pretty sure the problem lies in virtual box but I don’t fully know and I don’t know what to do. It kind of sucks having to be right by my box to get things back up and running. Any advice from anyone out there? I suspect trying a different usb stick would not matter considering I don’t think it’s the hardware. Any thoughts?

I have the same issue here - would appreciate any help/suggestions.

Additionally - any way to use VirtualHere to forward a usb microphone for snips?

For anyone that may be interested I just solved this issue. Its a bit hacky but it works and that’s all that really matters. So the problem was that I have batch files that run on my host machine to start my vm but the vm would not see the usb zwave stick so hassio would not see it or my zwave devices. Here was the solve. After some research I found out that virtualbox, the software vm I am using, will not take control of usb devices that are already plugged into your host machine when the vm starts up. Rather you have to plug the usb device in after that vm starts and loads. Once this happens the usb will be accessible to the vm whether you start or stop it. So in my windows host machine I wrote a batch for opening virtual box and starting my vm. I then have the machine wait a bit and then run another batch to unload all usb devices and reload them (I use devcon for this). At this point the vm sees the usb device as part of it, but, hassio is already started so it doesn’t pick up the device. I then run another batch to restart the vm and woohoo it finally works! All of these batch files are timed and part of the windows task system at startup and set to run as highest privileges. My only issue really is that it takes a bit to start up since I have to start up and then restart but I can deal with that.

See my post there for how I got it up and working. Its not the cleanest but it works and I may refine it a bit at a later date but its way better then it was. As for the microphone that I have not tried so can’t give any information there.

I was looking for a different solution than this… but I couldn’t find one. I do think I can improve on this though.

There’s no need to wait for Hassio to load, restart USB, and then restart Hassio. To expand on @josephkiser04 technique, you can run the “devcon.exe restart USB*” command immediately after you start your VM.

Sucks that it’s necessary, but alot less painful than I had though it was going to be.

  1. Why batch files? Just add everything you want to have start to your host machine’s startup folder in the startmenu. Its still exists.
    2, VBox will do just fine taking control of devices already plugged in. You have to add it to the filters list in VBox.

Solution to #1 go here… “%Appdata%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup” Paste that into a Windows Explorer address bar. Add shortcuts to anything you want to automatically start. I have the HassOS VM shortcut there, my Unifi Controller, Media and Book servers are there… add a number at the front of the shortcut name to control the order… 01 Home Assistant VM, 02 Unifi Controller, 03 Media Server… etc. Want to Automatically lock the terminal after login, startup of apps? create a shortcut with this command. “C:\Windows\System32\rundll32.exe user32.dll, LockWorkStation” Number that one 99, 999, so its the last item. Windows will execute items in the Startup Folder by Numerical then Alphabetic order. By numbering everything we force an order. This way when windows reboots from an update the autologin logs the system in, executes all the programs, then locks the terminal. Everything keeps starting up in the background behind the terminal lock.

Solution to #2.
Start the VM. Go to Devices, USB, Settings. Add a filter for each USB device you want automatically snagged, bagged, and tagged. That will cause Vbox to grab them when it fires up. Just selecting them from the Device menu causes what you are seeing. Have to add those filters to autosnag.

I run Hassos in Vbox on Win10.

3 Likes

I’m having the same issue as @josephkiser04 and I think I’ve tried your Solution #2. I have the USB filter added and checked.


After restarting the VM if you hover over the USB icon at the bottom it says “No USB Devices Attached”.

If I unplug the Zwave stick then plug it back in it says "Silicon Labs HubZ Smart Home Controller [0100]

You’ll notice from the screenshot it says “converter now attached to ttyUSB1” (and ttyUSB2)

Am I misunderstanding your solution?

1 Like

That should work, thats the normal method to bring usb devices into the virtualized OS automatically. However I have had to terminate the virtualization software and restart it on on occasion when dealing with adding in a new USB device.

I found a solution to this issue and it doesn’t require any scripting. You must have the VirtualBox Extension Pack installed.

  1. Power down the VM.
  2. Unplug and re-plug the Nortek HSUBZB-1 stick.
  3. In VirtualBox > VM > Settings > USB, the green plus sign brings up a list of the devices Windows can see. Select the Silicon Lans HubZ device.
  4. Edit the new Silicon Labs device to look like this (delete all of the field contents that were auto-populated except the ones in the following screenshot. I would leave your ProductID and other values if they’re different from mine.):

  1. Power on the VM.

Here’s how the devices look to Home Assistant in my setup.

Cheers

4 Likes

This worked for me with a CC2531 Dongle.

Treb

Hey all thank you for all the suggestions and replies. To all the different solutions here I am glad everyone got something going that has worked. I have tried each and everyone of these suggestions and sadly virtual box will not see the usb device unless I simulate an unplug and plugin event and restart the vm. Don’t know exactly why… it seems as though some people can get it to work without that but my machine will not do it for anything. So I am still running the batch scripts to control the order and timing of each event and re-starting of the full machine takes a couple of minutes but overall not bad and I have to say its actually rock solid and has worked every time without fail so I consider it a win even if a bit hacky.

Well, it wasn’t working how I thought and I had to start unplugging/plugging in to get things to work…

So I looked into @josephkiser04’s script method and have modified it to not require a hass restart and a whole USB Root Hub restart.

  1. Download and install the Windows Driver Kit (no need to install Visual Studio).
  2. In Device Manager, when the USB stick isn’t recognized by Windows, look at the properties of one of the down USB devices > Details tab > Device instance path > and use it with the * wildcards as shown in the next step.
  3. Create a .bat file containing something like this, pointing to your hass VM and the USB device to restart.
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "Home Assistant" --type headless
sleep 5
"C:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe" restart *VID_10C4*
  1. Open Task Scheduler and create a task (not a basic task).
  • General: Run with highest privileges
  • Triggers: At system startup, and this is very important > Delay task for X minutes. I chose 3 and that has worked so far. Without this delay, there will be blue screens.
  • Actions: Start a program, set this path to be your .bat file.
1 Like

Hi
I am exactly in the conditions indicated.
HassOS running in a VM on Proxmox
Rapberry PI with zigbee and zwave dongles
zigbee works fine with zigbee2mqtt
I am trying since a couple of days but cannot get the zwave part to work.
Following the instructions to run the ozwdaemon docker above but no success.
When I try to login through the webvnc I acess the qt app then as soon as I hit start button the connection is broken.

The only thing modified in the docker-compose file is my network key (stick was used through remserial on a debian before) and the usb path (via /dev/serial/by-id…)

what could be wrong / what info do you need to help troubleshoot?

Also is the setup described in this post related to a supervised install or to core on vm?

I had the same issue as well. What I did was I installed the Windows 10 drivers. And then I went to the power management Tab and unchecked the box that allowed the machine to put the device into sleep mode. My blue light has been on ever since.

Hi,

I struggled with setting up access to a USB device from hassio running in a vbox virtual machine. I posted my solution in How do I view the USB devices with HASS.io?

As long as the vbox usb filter is correctly setup I had no need for any of the more exotic solutions mentioned in this thread. Hope my solution helps someone in the future.

1 Like

cheers fella after 7 hrs head in hands banging the desk ,this pointed me in the right direction ,added by the vendor id just wish they kept the same view on hardware rather the 2/300 line list it is now

1 Like

and changed the remote to any as well

I think I finally found the fix after reading a customer comment on Amazon link for Nortek hub. Basically the device was going to sleep. Doing this helped:

1 Like

Just wanted to add for anyone who is in similar situation as me:

Running on VM, Nortek USB stick.

  1. update the drivers for the Nortek stick
  2. Uncheck the box in the image above by @lipstick
  3. Add the USB filter to your VM settings (image above by @gohassgo)
  4. Install the Windows Driver Kit
  5. Run your VM
  6. Have your device manager open on Win, and watch as you unplug and replugin your stick and you will see the com ports disappear and a new VM USB will appear.
  7. In HA my Nortek was not being recognized. Once it was in there, everything worked perfectly.

Will try the startup scripts as well. Thanks for this thread!