Skip to content

Instantly share code, notes, and snippets.

@sytone
Last active November 6, 2016 02:24
Show Gist options
  • Save sytone/ab7c435022a7fb7f3f082163b7c5b64f to your computer and use it in GitHub Desktop.
Save sytone/ab7c435022a7fb7f3f082163b7c5b64f to your computer and use it in GitHub Desktop.
Developing Home Asisstant in Windows on the Windows Subsystem for Linux

Setup

Enable the Windows feature for the subsystem. Either do this via Add Remove Programs or open a PowerShell instance as a Administrator.

Run the following command to see if it is already enabled:

Get-WindowsOptionalFeature -online -FeatureName Microsoft-Windows-Subsystem-Linux

If it is not enabled then run the following to enable and reboot your computer.

Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Windows-Subsystem-Linux

Once you back, search the start menu using the work 'developer'. Click on the For developer settings, you need to enable Developer mode before you can use the sub system.

Open a instance of PowerShell and run the following.

bash

This will prompt you a few times, once to download the ubuntu bits and later for a username and password. That is is you now have the subsystem up.

Setting up the development environment.

I will assume you have your own fork of Home Assistant, if not I would recommend it.

First we need to ensure the subsystem is up to date.

sudo apt update
sudo apt upgrade

Next we install all the bits needed for development, yep it is a long command :)

aptitude install -y python3 python3-pip git libssl-dev cmake libc-ares-dev uuid-dev daemon curl libgnutls28-dev libgnutlsxx28 libgnutls-dev nmap net-tools sudo libglib2.0-dev cython3 libudev-dev python3-sphinx python3-setuptools

Now we need to get the bits down, as I work using Visual Studio Code as my IDE I have my files in a windows path. For this example I will use /mnt/c/Users/sytone/dev/home-assistant as a location. You can make this anything you want, just remeber all windows drives are /mnt/

cd /mnt/c/Users/sytone/dev
git clone https://github.com/YOUR_GIT_USERNAME/home-assistant.git
cd home-assistant
git remote add upstream https://github.com/home-assistant/home-assistant.git

At this point you may want to enable a virtual environment, to make sure everything is ready in the python world do the following

sudo pip3 install --upgrade setuptools virtualenv tox

To setup the virtual environment run the following in the home-assistant directory you cloned into.

virtualenv -p python3 .
source bin/activate

Now you can setup wether you are in the virtual environment or not.

script/setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment