Hass.io On Hyper-V - Step By Step

So, I briefly described how I got this working in another post and some people indicated that it was helpful. As I’m still a bit new to all of this I’ve found these forums helpful, and so I thought I’d do a more detailed step-by step as it’s something that I can actually contribute back to the community. I’ve seen another guide around, but It went down a slightly different path.
The below is using Hyper-V on a Server 2019 host, but it’s the same for Server 2012R2 and I can only assume 2016 as well.

  1. Download the Hass.io VHDX file. It’s a pre-built appliance - no skill needed! I love it.

  2. Your setup may differ - but I created these directories and placed a copy of the downloaded file here. A copy, because I have re-used the base file on more than one VM and have retained it for future use.

  1. Keep it tidy - rename the file in keeping with the name you’ll give the VM.

image

  1. Run the VM Creation Wizard. It’s all quite straightforward. Name it and specify the location as the folder you created in step 1.

  1. The VM must be Generation 2.

  1. Give it some memory. 512 did for me for a while but I had to turn it up to 1024 when I got a bunch more automation going on.

  1. Connect it to the network you want to use it on.

  1. Choose to use the disk you renamed in step 2.

  2. Finish the wizard at the summary page.

  1. Before powering the VM on, go into its Settings, and under the Security tab, un-check “Secure Boot”.

  1. Power it on. Magic happens as it sets itself up. It’s a 6GB dynamically expanding disk and will grow as it evolves.

  1. Browse to its IP on port 8123. You’ll have to get that from your DHCP server or router. If you’re creating Hyper-V VMs I’m picking you know how to do that. At some point fairly early in the automatic setup, it will start hosting this web page:

  1. Once setup is complete, you’ll get the welcome page in your browser:

  1. The Hass.io instance is a containerized build with its own internal NAT. For most intents and purposes you can just control and reboot the whole thing through the Home Assistant web interface. One very handy thing I’ve found is the use of Hyper-V checkpoints, especially when upgrading or making big changes. I take these with the VM off.

  2. There is still setup within Home Assistant that should be done - most notably the Hostname under the “Hass.io” panel > “System” tab.

11 Likes

Thanks for doing this. I wish it existed back when I started my Hyper-V journey. One thing to note for any users planning to do an HA installation with Hyper-V is that most Z-Wave controllers are USB and Hyper-V cannot map through a USB port. I found excellent software call USB Redirector that allows you to bring your USB ports over to the VM. If anyone needs help with that, send me a message.

2 Likes

Yes that’s one limitation with Hyper-V. Good call on the USB Redirector.
USB PassThrough is usually possible on VMWare - I might do another of these with ESXi and see how it gets on.

Dear Jason,

Can you help me with setting up USB Redirector in Hyper-V?
I’ve a USB P1 for smart meter and a ZWave dongel.

Thanks in advance!
Regards,

Hi dennie,

First, make sure you are not running Ubuntu 18.04 as there is a bug that prevents registration of USB Redirector devices. If you are already on 18.04, you will need to upgrade to 19.10.

There are two parts to the application - the server and the client. You install the server application on the host and the client on your Ubuntu VM. You can find both here:

https://www.incentivespro.com/downloads.html

There is a free trial period to make sure everything works before you pay. Both of your devices should work and will be identified as a modem. The documentation is pretty solid, so give it a try and let me know if you run into problems. I’m happy to help!

If you have windows server I could also suggest installing docker. Windows server has native support for docker containers. Though you will need a docket enterprise license for that to work. Good news, because Windows Server Standard and Datacenter editions have a free docker enterprise license included (no need to add this anywhere).

I believe with docker it is possible to give the containers usb support (not entirely sure). Had been using hyper-v for 10 years now and I recently switched to esxi as I needed real usb passthrough which as most of you know is not possible with Hyper-V.

This guide now available in VMWare flavor.

Great write up however I can’t do a secure boot on my server based on other virtual machines running. Any way to get this setup without secure boot?

Hi,
I did follow the steps but when the machine is started it writes a lot of errors. I wasn’t able to capture them as text so I attach a gif …

Any idea what might be wrong?

Hi Jason,

Ive managed to deploy Hass.IO into hyper-v and restore my backup. How do i use this USB Re-director to plumb into my Hyper-V hass.io and what needs to be configured on Hass.IO to pick up the USB device >?

Hi Chris,

First install the USB Redirector Server on your host and share the USB port with the Z-Wave stick installed.

Next, in Ubuntu install the USB Redirector Client. Instructions can be found here. Set it to use the server: usbclnt -a . Detailed instructions here.

Now you should be able to see the devices. You can query using usbclnt -list to see attached devices. If everything worked, you should find a new device in /dev. Mine is called TTYACM0. From here configure OZW using the new device.

HTH!

1 Like

I’m on VMWare and would love to get back to Microsoft (more familiar to me) but there usb issue is the only thing stopping me… Anyone got any tips for usb redirector on HassOS (vhdx download)?

Thanks!

You don’t want Secure Boot - and it’s only available on Gen 2 Hyper-V guests. What type are you running?

The times I have had issues getting it to start up have usually been network related. Make sure it has clear access out to the internet so that it can download the dependencies and modules it needs.
If you use a proxy / firewall it might be blocking this.
I also had a problem with an abortive setup that must have corrupted my vhdx. I re-copied it from a fresh source and it came right. Hope it’s a simple one…

is the USB Redirector working with Hass.io without ubuntu? Chris_Quach ask what need to be installed on Hass.io as there is no ubuntu in the hass.io installation on hyper-v

Can’t answer that for certain as I’ve never tried. I have Hass.io running in a docker on Ubuntu. I assume the USB port could be shared with the Hass.io installation as well, but no direct experience.

Hi, I have this exact question… running hass.io on hyperv and wondering if I can import a zwave usb stick there…

I am also wondering if this will ever be a possibility? I have just installed hass.io on hyper-v and don’t want to get to into it if I wont ever be able to add zwave and zigbee devices

Jason,

Thanks for putting this guide together. It’s helped me understand it much better. I’m following the steps using the VDHX image. My Hyper V gets it up and running, but when I get to step 12 for the GUI, the browser (using Firefox on the non-VM side) says it can’t find the page. In the VM for HassOS, it isn’t coming up with anything beyond the command line.

Not entirely sure what I’m doing wrong or what to do next.

UPDATE: I forgot to set up an External LAN switch to be able to access it. That was a simple fix in Hyper-V.

1 Like

Thank you for your briliant manual. I had only one issue during instalation. Active internet connection is required, as usually no virtual pc has access to internet, booting of HomeAsisstant was stuck before any application start and waiting for internet connection without any warning.