I read a lot about Hyper-V not supporting Z-Wave passthru but isn’t this as easy as installing Z-Wave JS Server in my case on some Windows box, potentially even the Hyper-V server itself and plugging the stick into there. Then setting up Z-Wave JS on HA and pointing it to the URL of the server install?
Yes, you could run Z-Wave JS UI natively on a Windows host and connect from HA to the host. The challenge would be keeping it running, as it does not support running as a Windows service. If you can get past that, it’s a valid solution.
Or use something like virtualhere usb to ip Home | VirtualHere
I don’t use it in “production” to do use it if I want to expose something to my main “desktop” machine whic is a VM I RDP to. So I use this from a laptop to connect a phone or camera or something.
My advice would be to do what most people do, as when you run into a problem, it’ll easier to get help. Based on your experience using ESX, the docker route will give you a lot of flexibility. The other common deployment is on a dedicated HASS device.
Your challenge is that Hyper-V doesn’t support USB passthrough, so your guest VM won’t be able to see the z-wave hardware no matter what OS you choose. The only option would be standalone hardware that serves the USB serial over TCP/IP. That’s a lot of effort to avoid other hypervisors that do support USB passthrough.
Guess we all have different thoughts on a lot of effort. Finding a way to get the Z-Wave stick to talk to a Hyper-V VM of HA or redo my entire main server with a different hypervisor and redo 15 virtuals running on it. I think going with another hypervisor is more effort but maybe I’m missing something.
You could try if this works for you:
Might only work with HA supervised and a lot of work, unsure to be honest
Or this:
Thanks for the info. I have a question. Been talking with this vendor:
https://www.usb-over-network.com/
About USB Over Network (USB over Network - Share and access your USB devices over local network or Internet.)
They are saying that for Linux I don’t need a client installed. They do have one so asked for clarity. Not 100% sure if there is a slight language barrier. They seem to feel if the USB stick is setup on the host the Linux client should just be able to use it. Does this make sense? So say it’s setup and broadcasting on the Hyper-V IP on port 33000. Does Z-WaveJS UI have the ability to connect to IP based Z-Wave devices? If not I’m thinking I’ll still need the client on the Linux side to expose it.
Z-Wave JS can talk directly to TCP serial ports, such as those provided by ser2net or socat (use tcp://host:port
as the USB device path). If that software does the same thing, then you don’t need the client.
Did you give up on the idea to run ZUI directly in Windows?
Kind of. Some issues I’m thinking with it, the first one already mentioned that I haven’t had time to look at:
- Z-WaveJS UI can’t keep running as a service but would need looking into.
- Most backup software doesn’t backup the Hyper-V host as they assume backing up the virtuals is adequate and you don’t need to backup Hyper-V. Assumption is you should reinstall Hyper-V if something goes wrong. The logic being you shouldn’t be installing anything on there. So if that main server fails that component would have to be redone again.
- When I restore my HA backup to the new system Z-WaveJS will be restored as part of it and assume will conflict.
- If I install Z-WaveJS UI on the Hyper-V thinking I may have to link all the z-wave entities back again as it will see them all as new perhaps vs the restore process.
I run ZWave JS UI as the HACS addon in a HASS OS deployment in a Hyper-V VM on Server 2019. Got a few layers of virtualization. It works beautifully.
I just got a cheap USB3 PCIE card and DDA’ed the controller to my VM and plugged the stick into that card. The renesas USB controller card was like $10. Ah, it is $13 now, but this is the exact card running in my R720. https://www.amazon.com/gp/product/B071P5C6CS
Considering you mentioned 15 VMs I’m guessing you have room for a PCIEx1 but I am pretty sure USB controllers are offered in M.2 form factors as well.
Can I ask why you bought a USB3 PCIE card vs just plugging it into one of the existing USB 2 or 3 ports? Are you physically passing thru the card to the virtual? If so I can’t do that. The only free slot which happens to be 1x on my board is on the chipset not the CPU. So that slot can not be passed thru. At least not with Hyper-V.
ah. Hyper-V can only pass through controllers which meet the requirements for DDA and you can only pass through a controller (to meet addressable memory requirements). In my case, none of the onboard USB controllers met that requirement. It seems to be USB3 that most commonly can be passed through.
I had previously tried with some usp/ip by running the stick on a pi, and I had some success, but keeping track of it became a real burden.
Depending on how janky is acceptable, you might be able to get a thunderbolt → USB controller and pass through the 2nd level USB controller but that seems sketchy as well.
The r720 has 0 1x dedicated slots. All are electrical x16 and a mix of physical x8 and x16. But any 1x card works perfectly fine in an x4, x8, x16.
More info here. There’s also a script floating about (might be linked in the article) which will tell you what controllers on your system might be able ot be passed through. You may get lucky and have a block of USB on the motherboard that can be DDA’ed.
Thanks for the info. May be an opportunity here. I have one set of USB 2.0 ports on the Motherboard that I have extended to the front of the case with the case provided USB 2.0 expansion hardware. Lot of stuff that can’t be DDA’ed but this shows up:
AMD USB 2.0 eXtensible Host Controller - 1.20 (Microsoft)
Express Endpoint -- more secure.
And its interrupts are message-based, assignment can work.
PCIROOT(0)#PCI(0803)#PCI(0000)
I have to review the manual but think I only have one USB 2.0 connection on the MB and only one USB 2.0 result was returned with that PowerShell script and know there are none on the back of the case.
Unless it’s Linux may not be working.
(Get-PnpDevice -PresentOnly).Where{ $_.FriendlyName -like '*2.0*' }
Showed the controller
OK USB AMD USB 2.0 eXtensible Host Controller - 1.20 (Microsoft) PCI\VEN_1022...
$MyUSBTWOdotO = Get-PnpDevice -PresentOnly| Where-Object {$_.FriendlyName -like ‘USB2.0*’}
$MyUSBTWOdotO | ft -AutoSize
to add the results to an array so get:
OK USB AMD USB 2.0 eXtensible Host Controller - 1.20 (Microsoft) PCI\VEN_1022&DEV_15B8&SUBSYS_88771043&REV_00\4&89701DF&0&0043
Disable the device in Windows:
Disable-PnpDevice -InstanceId $MyUSBTWOdotO[0].InstanceId -Confirm:$false
Running the below now returns an error which is expected:
$MyUSBTWOdotO = Get-PnpDevice -PresentOnly| Where-Object {$_.FriendlyName -like ‘USB2.0*’}
$MyUSBTWOdotO | ft -AutoSize
Error USB AMD USB 2.0 eXtensible Host Controller - 1.20 (Microsoft) PCI\VEN_1022&DEV_15B8&SUBSYS_88771043&REV_00\4&89701DF&0&0043
Dismount the USB controller from Windows. Run this and get:
$DataOfUSBToDDismount = Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths -InstanceId $MyUSBTWOdotO[0].InstanceId
$DataOfUSBToDDismount | ft -AutoSize
PCI\VEN_1022&DEV_15B8&SUBSYS_88771043&REV_00\4&89701DF&0&0043 DEVPKEY_Device_LocationPaths StringList {PCIROOT(0)#PCI(0803)#PCI(0000), ACPI(_SB_)#ACPI(PCI0)#ACPI(GP19)#ACPI(XHC2)}
See above which is the part that I think is an issue. Comma separated list.
Grab the location info returns the first half of that list:
$locationpath = ($DataOfUSBToDDismount).data[0]
$locationpath | ft -AutoSize
PCIROOT(0)#PCI(0803)#PCI(0000)
Then dismount the device:
Dismount-VmHostAssignableDevice -locationpath $locationpath -force
For good measure running this shows it’s dismounted and it’s also gone from Device Manager:
$DismountedDevice = Get-PnpDevice -PresentOnly | Where-Object {$.Class -eq “System” -AND $.FriendlyName -like “Dismounted” } | ft FriendlyName, instanceID -autosize
$DismountedDevice
PCI Express Device of unknown type - Dismounted PCIP\VEN_1022&DEV_15B8&SUBSYS_88771043&REV_00\4&89701DF&0&0043
Running this returns it’s now available for DDA Assignment:
Get-VMHostAssignableDevice
InstanceID : PCIP\VEN_1022&DEV_15B8&SUBSYS_88771043&REV_00\4&89701DF&0&0043
LocationPath : PCIROOT(0)#PCI(0803)#PCI(0000)
CimSession : CimSession: .
ComputerName : HYPERV
IsDeleted : False
Add it to HA:
Add-VMAssignableDevice -LocationPath $locationpath -VMName “Home Assistant”
lsusb now returns two hubs which is odd. A USB 3 and USB 2. Before this lsusb returns nothing.
However there are errors in the logs that no usb ports found. The stick also does not show up on the device. Going back to that second item in the comma separated list:
ACPI(_SB_)#ACPI(PCI0)#ACPI(GP19)#ACPI(XHC2)
That if you remove the last ACPI value is a PCI Express Root Port under System Devices in Device Manager. It’s an item that is listed as not able to be used for DDA. Guessing maybe? it needs that passed thru as well to work? Or am I missing something. Apparently it can’t be passed thru as listed when I ran the MS PowerShell script:
PCI Express Root Port
Old-style PCI device, switch port, etc. Not assignable.
Thoughts?
OK knew that novel would cause silence. I built HA in Hyper-V with Debian Supervisor and restored. I tried using USB Redirector and it shows up and connects and think one of my prior tests actually worked well. This time though it’s coming up as timing out even though the ttyACM0 device attached. Lights would turn on but take like a minute and the sensors in the GUI wouldn’t reflect this so to turn them off you would have to turn the switch on and off in HA and then in another minute would turn off. Logs were full of the controller not responding timely.
IF I installed Z-WaveJS in Hyper-V and then exposed it to my HA virtual how would I do that? I’ll worry about the restartability later if I can get this working. May try a couple other similar client/server options but game to try with some guidance. If anyone watching anymore.
Just download the Windows zip file, extract and run the .exe. Another user had success with nssm, even though it seems to be unmaintained.
Okedokie doing that now. What do I do then on the HA side?
Brutal. There goes my documentation. Not sure what all I’m supposed to set in this instance but selected
COM3 (it defaulted to /dev/zwave)
Entered my existing S0 Legacy Key
Disabled MQTT Gateway
Enabled WS Server
Clicked Save
Entire server crashed or rebooted or both.
Note not sure that documentation tells you how to setup a remote Windows instance and connect it to a separate HA instance but maybe missing that. I did the above and not sure if that was the right setup and it’s now identified all my devices except one that is battery only and sleeping. Not sure if I need MQTT Gateway enabled and what to install in HA.