Skip to content

Dev environment setup

Pawel edited this page Nov 8, 2021 · 6 revisions

Instructions to setup dev environment

Windows setup using Windows Subsystem Linux

Follow the insutrctions here: https://docs.microsoft.com/en-us/windows/wsl/install-win10 and setup WSL on your machine. For this documentation, we will use Ubuntu LTS 18.04 as the distribution.

First, start the Ubuntu termainal by going to Windows key and searching for Ubuntu 18.04 LTS.

Ubuntu

Then, install Python 3.8 and virtualenv.

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.8 python3.8-venv

Arch Linux only example

pacman -S python

Configure VENV

Clone and install the different components

cd ~
git clone https://github.com/bosch-thermostat/home-assistant-bosch-custom-component.git
git clone -b dev https://github.com/bosch-thermostat/bosch-thermostat-client-python
mkdir homeassistant .homeassistant .homeassistant/custom_components
cd homeassistant
python3.8 -m venv venv
source venv/bin/activate
pip3.8 install homeassistant bosch-thermostat-client

Next we remove the installed bosch-thermostat-client and link it to the git repository. This way, you can easily test new versions by either checking out specific branches in ~/bosch-thermostat-client-python/bosch_thermostat_http or ~/home-assistant-bosch-custom-component/

rm -rf venv/lib/python3.8/site-packages/bosch-thermostat-client
ln -s ~/bosch-thermostat-http-client-python/bosch-thermostat-client venv/lib/python3.8/site-packages/bosch-thermostat-client
ln -s ~/home-assistant-bosch-custom-component/custom_components/bosch  ~/.homeassistant/custom_components/bosch

Next, we can create a default configuration.yaml file and enable debug logs for the component. We use Visual Studio Code. This is a great editor and also has a WSL extension you should install. Then you can simply do code <myfile> and it will open an editor window where you can nicely edit files from WSL Ubuntu.

code ~/.homeassistant/configuration.yaml

Put the following content into the file and save it.

Note: We removed here default_config and discovery so that we do not accidentally add all devices we don't need.

frontend:
config:
api:
history:

logger:
  default: warning
  logs:
    frontend: debug
    homeassistant.components.frontend: debug
    custom_components.bosch: debug
    bosch_thermostat_http: debug

homeassistant:
  name: MyTestHA
  unit_system: metric
  time_zone: Europe/Luxembourg

Once this is done, start hass by simply doing

cd ~
hass

Be patient. The first time this could take a while. After 1-2 minute, it should be ok.

Now go to http://127.0.0.1:8123/ and finish the onboarding. Enjoy !

Note: If hass does not start, or you have not enabled your venv (you should see a (venv) in front of the terminal line then execute the following command to load the virtualenv.

cd ~
source homeassistant/venv/bin/activate