06 Oct 2021
In this article I cover how to create a Virtual Machine (VM) on top of Proxmox VE 7 and get up and running with Home Assistant.
Home Assistant is an “open source home automation system that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.” - Home Assistant
Home Assistant has 1000’s of Integrations and we can add the HACS repository for even more community integrations. We can even use Home Assistant to monitor our Proxmox VMs.
All this sounds great but why virtualise Home Assistant using Proxmox, why not just use a Raspberry Pi? This is a good question and for me the answer is simple, I already have Proxmox so it makes sense to converge this service. There is also the added benefit of snapshotting, backing up and duplicating the VM, which makes experimenting much quicker, also the added redundancy of my Proxmox server hardware and control over the VM resources.
Home Assistant recommended a minimum virtual machine resources of:
When creating the VM I will be sticking to these requirements and if required at a later date we can increase.
Creating the VM I will be using the following settings, if they are not listed I did not change from the default value. You’ll also need the advanced options enabled.
Once the VM has been created go to the Hardware tab, detach and remove the Hard Disk. In the next step we will be importing the Home Assistant hard disk.
Now open a SSH connection or Shell session to our Proxmox server and download the KVM/Proxmox (.qcow2) file from the Alternative downloads section using wget.
https://github.com/home-assistant/operating-system/releases/download/9.5/haos_ova-9.5.qcow2.xz
then extract the contents of the file.
xz -d haos_ova-9.5.qcow2.xz
Import the disk to a VM, which has an ID of 101 (You may have a different ID) and my local storage is called local-btrfs (You may have different local storage, depending on your installation).
qm importdisk 101 haos_ova-9.5.qcow2 local-btrfs
Don’t forget to clear up the old files
rm haos_ova-9.5.qcow2
Now go back to the Proxmox webGUI for the VM and assign the newly imported disk, enable SSD emulation, discard and the boot options to use this disk.
There are a few extra settings we can change before starting our VM, these are:
Note: I had to disable Secure Boot in UEFI, to do this go to the Console, start the VM and Press ‘ESC’ to access “OVMF menu”. Navigate to Device Manager > Secure Boot Configuration and uncheck “Attempt Secure Boot”, save and exit the OVMF menu and the VM will now boot.
Now start the VM and once its booted you’ll be able to visit http://homeassistant.local:8123/ or use the IP address of the virtual machine such as http://192.168.1.101:8123/.
Home Assistant is now running in a Promxox virtual machine ready for the inital configuration or restore your existing installation.
Note: I noticed that the VM started to consume high amount of CPU (50-70%), the cause for me was the fallback DNS feature in Home Assistant. To turn off this feature, open your Home Assistant console, and type ha dns resolution --fallback=false
. After applying this change my CPU usage returned to a steady 5%.