Zwave and Zigbee via USB in a Hypver-V virtual machine

Ready to take the leap and cutover from SmartThings (been using for many, many years).
Just getting started with HA and hitting a snag.
Windows 11 NUC running hyper-v
Have HomeAssistant successfully running as a hyper-v VM.
I have a Zooz S2 700 series USB Zwave dongle and a SONOFF Zigbee 3.0 USB Dongle
I’m following the installation instructions here:

HA is not identifying the stick, and its not creating the keys. I’m not even sure its showing up as a device. Although I’ve struggled to get ha hardware info in a readable terminal to find usb info.

What is the easiest way to get up and running? Do I need to spin up another VM to run the zwave and zigbee ha services? Or run them in the host OS, I’d rather not, I’d prefer to keep the host OS clean.
I tried running HA in VirtualBox and it ran slow as heck. I tried VMWare player as well and it wasn’t great. Hyper-V performed much better, but it looks like I’m having some kind of USB issue.
What are your recommendations?

1 Like

It looks like USB passthrough to the Hyper-V guest is not possible except for USB storage devices by default but it may be possible by changing the group policy. The comments in the Microsoft thread below discusses it. You can try updating the group policy as suggested and see how it goes.
I personally use Proxmox on a linux machine and it allows USB passthrough to my HA VM machine and the Sonoff Zigbee 3.0 USB Dongle Plus works fine for me in HA.

Hello,
Thank you for your reply. I made the change to the policy of the host, but the doc is clearly for a Windows client. The USB passthrough would only be available as a mapping during an RDP session to the client. That doesn’t happen when gaining Console access to a linux guest VM.
I may have to do more testing with hypervisors. But so far, the ones I tried performed much more slowly than HyperV. I don’t want to go bare metal hypervisor, I just want a hyper visor sitting on top of Windows OS.

1 Like

I think you are out of luck trying to passthrough USB to a Hyper-V guest unless you are willing to try software tools to pass USB over the IP network.
I did a search and found this open source tool which may work. Only issue I can see is that if you are using HAOS on your VM, I don’t think you have full access to the linux base layer to install usbip.

Another option you could do for Zigbee is install MQTT on your HA VM and Zigbee2MQTT on your Windows Host rather than using ZHA. Going this way will mean that your zigbee devices will be paired and managed on your Windows OS but unless you move to a different Hypervisor that supports native USB passthrough, then your options are limited.

https://www.zigbee2mqtt.io/

This is why I moved my install from Hyper-V to VMware Workstation. I just took a full back up of HA, setup the new VM, and did a restore. Then continued setting everything up.

I dropped a post at the end about setting up persistent USB passthrough.

1 Like

Thanks for the link, that’s a bit more updated and thorough than the VMWare Player thread I had been using. I still have VMware Player installed on this NUC, I just wish the guest VMs performed better in it.
Maybe I’ll have better luck if I completely remove hyper-v and VMWare, reboot, and install just VMware. There may have been some compat issues with both hypervisors installed.

1 Like

I’m running both in tandem. I’m actually dependent on the Hyper-V virtual network adapters because I have my guests and host in separate VLANs, so I needed tagging. That said, I’m also hosting off a rather beefy desktop, so I have little concern around resource constraints that you might be running into.

The best option for Z-Wave is to run the Z-WaveJS UI software as a windows service. To set this up you simply download the standalone version of Z-WaveJS UI.

Download the standalone version of Z-WaveJSUI here. Releases · zwave-js/zwave-js-ui · GitHub

Here’s a 3 minute video explaining how to set it up. How to Run Z Wave JS UI as a Windows Service - YouTube

2 Likes

FriedCheese, yes, I’m running a little i5 NUC for this, so performance degredation happens pretty quickly.
Here’s a doc that explains what VMWare must do if hyper-v service is activated on the host computer.
VMware Workstation 15.5 Now Supports Host Hyper-V Mode - VMware Workstation Zealot

I’ve just removed both Hyper-V and VMWare player, rebooted, installed VMWare Player, got an HA VM running and it boots significantly more quickly now. It was taking 3.5 minutes just to boot into HA and get an HA shell console from within VMWare. Now that I’ve cleaned things up, its booting comparably to Hyper-V, about 30-40 seconds for HA to fully boot.

Cornell Williams, thanks for that, I could potentially just run zwaveJS UI directly on the host Windows OS.
Unfortunately it doesn’t look like there is a way to get zigbee support in a similar fashion. I have more zigbee than I do zwave.

2 Likes

Zigbee2MQTT can run on Windows, so you could set that up on your Windows OS to manage your Zigbee devices and have HA running on the VM with the MQTT addon installed on HA.

2 Likes

I have a windows host running other services, so when i started my HA journey, Hyper-V seemed like the obvious choice. I quickly realised USB passthrough was going to be an issue.

In the end, i went with VirtualBox, monitored by a third party application I have called AlwaysUp. Its been rock solid. I’m running a dell mini pc with an i5 7th gen processor, and from a cold start, HA takes about a minute to come up.

an HA restart takes about 15-30 seconds, and a reboot, where the state of the VM has been saved before the PC shutdowns is about the same.

One thing I never thought of (until now), was going to Z2M route (rather than ZHA), and running the MQTT broker on the windows host and have HA access it over the network. That way, Hyper V avoids the USB passthrough issue, but I’m happy with my current setup.

EDIT: although even ZHA seems possible:-

@SackOHammers @FriedCheese ,
I tried VMWare Workstation Player 17.02 today. The USB passthrough for my Zooz ZST39 800LR stick works. Except for one thing : if the VM is powered down for any reason (such as the host reboots), when the VM comes back up, the Zooz stick is no longer passed through to the VM. One needs to manually click and enable it again. This is a complete show stopper for me. I want the host to be able to come back up unattended. I have Windows set to auto-logon on reboot, and my startup folder has a shortcut that restarts my HAOS VM. But the HAOS is no good if my Z-Wave devices are not available.

So, my question is, Is there a way to make the USB passthrough for the USB Zooz stick stick ? Or does this require some commercial edition of VMWare (if the feature is indeed available) ?

You just need to edit your vm config file and add the autoconnect entry for your device. Here is an article on vwmare’s website that explains how to do this. VMware Knowledge Base

2 Likes

Thank you ! I’m going to get on it now. Seems like a lot of work to do manually - really should be in the GUI - half the functionality is there (manual connect, just not auto). Glad it can be done - my Google searches didn’t find that article.

1 Like

Thank you ! I was just able to get going with the VMWare instructions. I don’t know how I missed the HA instructions for USB Zigbee/ZWave . I just didn’t read far enough down on that HA/VMWare setup page. D’oh

1 Like

There is a modern solution to using USB in Hyper-V. I am currently using an external ASMedia PCIe add-on card that is passed through via Microsoft’s “DDA” method. This is the same method I use to pass through a Tesla GPU for direct encode/decode on my security cameras.

This is supported in any Hyper-V 2016 and above. Works on Windows and Linux guest VM’s. Note that you CAN pass through your on-board USB ports if you can find the PCI ID it is internally attached to, but this will dedicate all ports on that USB controller to the VM, it cannot be shared with the host. For me, an add-on card was easier, but some motherboards have multiple USB controllers.

I’ll summarize, but there’s a source link at the bottom if you want to learn more.

Open device manager and find the USB controller (not the port, the whole controller, switch to “view devices by connection” to see this)
In the device properties, go to the Details tab and Gather “Device instance path” and “Location paths”
For example:
PCI\VEN_1B21&DEV_2142&SUBSYS_21421B21&REV_00\4&D76E1A6&0&0009
PCIROOT(80)#PCI(0101)#PCI(0000)

Open Powershell.
Prep your VM for DDA (snapshots must be disabled):
Set-VM -VMName “HomeAssistantVM” -LowMemoryMappedIoSpace 3Gb -HighMemoryMappedIoSpace 33280Mb -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown

Unmount the USB controller from the host:
Disable-PnpDevice “PCI\VEN_1B21&DEV_2142&SUBSYS_21421B21&REV_00\4&D76E1A6&0&0009”
Dismount-VMHostAssignableDevice -LocationPath “PCIROOT(80)#PCI(0101)#PCI(0000)” -Force

Mount the USB controller to the VM:
Add-VMAssignableDevice -LocationPath “PCIROOT(80)#PCI(0101)#PCI(0000)” -VmName “HomeAssistantVM”

That’s it, 3 whole commands.

Source: Deploy graphics devices by using Discrete Device Assignment | Microsoft Learn

2 Likes