Vagrantfile is available into
virtualization/vagrant folder for quickly spinning up a Linux virtual machine running Home Assistant. This can be beneficial for those who want to experiment with Home Assistant and/or developers willing to easily test local changes and run test suite against them. In the same
virtualization/vagrant folder there’s also a
provision.sh shell script which provides an easy way to interact with the Home Assistant instance running within the Vagrant VM.
Vagrant is intended for testing/development only. It is NOT recommended for permanent installations.
$ git clone https://github.com/home-assistant/home-assistant.git $ cd home-assistant/virtualization/vagrant
The following instructions will assume you changed your working directory to be
home-assistant/virtualization/vagrant. This is mandatory because Vagrant will look for information about the running VM inside that folder and won’t work otherwise
When using Vagrant on Windows, change git’s
auto.crlf to input before cloning the Home Assistant repository. With input setting git won’t automatically change line endings from Unix LF to Windows CRLF. Shell scripts executed during provision won’t work with Windows line endings.
$ git config --global core.autocrlf input
$ ./provision.sh setup
This will download and start a virtual machine using Virtualbox, which will internally setup the development environment necessary to start Home Assistant. The whole process might take up to 30 minutes to complete, depending on Internet connection speed and workstation resources. After the VM has started successfully, the Home Assistant frontend will be accessible locally from your browser at http://localhost:8123
To shutdown the Vagrant host:
$ ./provision.sh stop
To start it again:
$ ./provision.sh start
home-assistant directory on your workstation will be mirrored with
/home-assistant inside the VM. In
virtualization/vagrant there’s also a
config folder that you can use to drop configuration files (Check the Configuration section in the docmentation for more information about how to configure Home Assistant).
Any changes made to the local directory on your workstation will be available from the Vagrant host, so to apply your changes to the Home Assistant process, just restart it using the provided
provision.sh wrapper script:
$ ./provision.sh restart
This command will only restart the Home Assistant process inside the Vagrant VM, it will not reboot the virtual machine. If that’s what you want, the right command is
To run tests against the local version of Home Assistant code:
$ ./provision.sh tests
To completely remove the VM
$ ./provision.sh destroy
To completely remove the VM and setup a fresh new environment:
$ ./provision.sh recreate