Microsoft Hyper-V Server Z-Wave Controller passthrough

Hey guys,

Due to some issues I had with Proxmox, I am moving to Hyper-V 2019 as my new Hypervisor. As part of that, I need to figure out how to allow the OpenHAB VM to access my Aeotech Z-stick. I have seen people like @Bruce_Osborne say that they were able to pass the COM port through to the VM. Does anyone have experience with Hyper-V in getting the Z-wave Controller to work? BTW I plan to make my OpenHab VM an Ubuntu VM.

I an running that with a Debian VM. The host Windows OS has my USB stick drivers and the resulting serial port is mapped to the VM.

It is actually on my son’s server, so he did the work. If these hints do not help, I can get more help.

1 Like

Thanks for the reply. So just to confirm, the Z-Stick is plugged into the server where the VM exists and you are able to pass it from the hypervisor to the VM without doing any kind of USB or Serial over IP?

The USB driver on the server presents the stick to the hypervisor as a serial port that can then be mapped to the VM. I understand you need to unmap it before shutting down the VM

1 Like

That makes sense. So you have to un-map and re-map it everytime the VM restarts?

I have only done that a couple of times. I just ask my son to handle it since I do not have the access needed.

1 Like

Well I appreciate your responses. I’m going to mess around with it and Ill let you know if I get stuck anywhere.

Does anyone have experience with the reliability of the few USB over IP solutions? I have seen people connect the Z-stick to a RPI and allow the VM to access it like this. Just not sure how reliable it is and if there is any lag.

I believe @chris has had some experience trying to help user do this. The Hyper-V solution should be superior.

I’ve been using this ever since i wrote the tutorial. The solution has never failed, worked flawlessly. Except for the reboot’s of Openhab or the machine it’s running on. Then you sometimes need to take some additional care of this setup. But once it’s running it’s running like a charm.

Since connected over the local netwerk this solution add’s maybe 1 or 2 ms additional latency to the z-wave traffic
 you probably wont notice it at all.

1 Like

Thanks for the reply. What do you have to do when the VM restarts to reattach the controller?

Check if Socat and Ser2net were able to establish a connection before Openhab started to initialize Z-wave. if not:

  • restart socat on openhab machine
  • restart z-wave bundle through karaf
  • Wham Boem Bam! all fine

Hey guys sorry for the delay in my response. I have been very busy getting my Hyper-V server up and running. So far its working well with OpenHAB. I will describe below how I was able to pass the Z-wave Controller through to the VM. I am using the Aeotec Z-stick Gen 5

Basically I created the named pipe and used a program called COMPipe to allow the VM to access it.

  1. On Hyper-V, Download COMPipe from GitHub and save it to any directory on Hyper-V but remember where you save it cause you’ll have to access it later.
  2. I used this guide to make a named pipe on Hyper-V. Again, remember what you name your pipe. Also, if you changed the name of your VM, you might have to rename your pipe. The name of the pipe in the above guide is ‘dv0-com1’
  3. On Hyper-V, enter powershell and enter this command: “Get-WMIObject WIN32_SerialPort”. This will list all COM ports Hyper-v has and you’ll need to identify which one the Z-wave Controller is using. You’ll want to look for something like ‘usb device’ and the manufacturer name. It shouldn’t be hard to identify this. If you are unsure which device is your controller, then unplug all other USB devices other than the controller and re-run the command. Mine used COM3.
  4. on Hyper-v navigate to where you saved the COMPipe utility in step 1. Exit powershell if you’re still in it by using ‘exit’ then you can use ‘cd 
’ to go up a folder level, ‘cd [folder]’ to go down a level, and ‘dir’ to list the subfolders in the parent folder you’re in. Once you find the COMPipe folder go inside it to bin/released/ and you should see COMPipe.exe in there.
  5. Once you are in the ‘released’ folder, run .\COMPipe and it will give you a couple examples on how to run a COMPipe command. mine looks like this: “.\COMpipe.exe -c \.\COM3 -p \.\pipe\OpenHAB-com1”. When you run it, it should give you a message that says something like ‘pipe opened successfully, press q to quit’. Leave the command prompt window open on this page. if you press control-c it will exit the command and the Z-wave controller will no longer be accessible to the VM.
  6. You’ll have to run that every time the VM reboots and I find it works best to run it very close to the time it reboots so the controller is present when OpenHAB comes up. If you boot the VM, run that command on Hyper-v and your controller still isn’t showing in OpenHAB then try re-running the command in Hyper-v and if that fails, try rebooting the VM again and re-running the command during reboot.

Im sure there is a nice way to trigger running a Hyper-v command when a specific VM reboots but I haven’t gotten that advanced yet. I hope this helps someone in the future!!

Hi,
I’m trying to do similar however, I don’t believe the device is starting. I used /dev/ttyS0 as the device path, could you tell me if yours was the same? Thanks

Hey Rocky. What step are you stuck on? Have you been able to identify which COM port the z-stick is using?

Please note that after creating the named pipe, you must Stop/Start your VM in order for the named pipe to take effect. This wasted a couple hours of my life :smiley:

Per Setting Up Kernel-Mode Debugging of a Virtual Machine Manually using a Virtual COM Port - Windows drivers | Microsoft Docs “Once the debugger is attached and running, stop and cold start the VM to activate the COM ports in the VM”