Hyper-V, USBIP & Home Assistant

Hyper-V, USBIP & Home Assistant

I recently purchased a number of Zigbee 3 bulbs to install around my house, but unfortunately the Philips Hue hub seems to be locked down to only support lights from their preferred manufacturers.

So, I’ve started setting up Home Assistant, installed within a Hyper-V virtual machine. The idea is to eventually replace the Hue hub with a more flexible and less expensive system.

Home Assistant supports loads of Zigbee gateways, so I grabbed a Sonoff Dongle P from Amazon. This is when I found out that Hyper-V doesn’t support pass-through of USB devices from the host to a VM 😢

After a lot of head scratching & failed attempts I finally found a working solution:

  1. On the Windows Hyper-V host we need a USBIP server to share the USB dongle.
  2. In the Home Assistant VM, we need a USBIP client docker add-on

Installing USBIP in Windows

Plug the Zigbee dongle into your Hyper-V host

Grab and install the latest release of usbip-win from https://github.com/dorssel/usbipd-win

At a administrator command prompt, type:
usbpid list

Look for the BUSID for the device you want to share, and note it down. In my case I’ll be using “3-9”. Type:
usbipd bind –busid 3-9

If you see no errors, type:
usbipd list
This should confirm the selected device is being shared

Installing Home Assistant USBIP Addon

Fire up your HA control panel and navigate to: Settings -> Addons -> Add-on Store

Next, click the 3 Dots menu in the top right corner and choose Repositories. The “Manage addon repositories” box should appear.

In the “Add” box input:
then click the “Add” button.

Should now have a new section on the addon page titled “Ilya Rakhlin’s Home Assistant Add-on Repository”, under which you’ll find the “USBIP Mounter”. Click on it to bring up the details, then click “Install”.

You now need to configure the addon to connect to the USB device you’ve shared from the host. The documentation for the addon has a couple of errors in it, but I’ve found the following configuration block works for me:

Replace the IP address with the IP of your Hyper-V host and the bus_id with the bus id you shared earlier and you should be good to go!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.