Home Assistant Configuration

Pre-requisite: Please go through demo setup page

Home Assistant

Introduction


  • One of the most popular home automation software platforms
  • Written in Python, it is vendor and technology agnostic
  • Through bindings which can be installed as add-ons, it is possible to control almost any smart device connected on WiFI, BT, GPIO, Zigbee and Zawe.
  • Bindings exist for most commercial smart switches, lights and other sensors available. This results in a lot of  saved effort for users.
  • Rich and easy to understand documentation available at https://home-assistant.io.

Requirements


The following devices were used to test the demonstration images.

  • Vision Z-Wave USB Adapter
  • Aeotec Multi-sensor (Z-Wave compatible)

It’s not mandatory to use the same hardware listed above, however we do make the following recommendations.

  • Try to stick to one standard when choosing devices from different vendors (e.g. Zigbee / Zway). The main reason is that on Raspberry Pi3, a different USB adapter is required for each and making both adapters run in parallel could be a challenge.
  • Ensure the protocol used by the device has bindings available from Home Assistant (https://home-assistant.io/components/)
  • If you are an advanced user and have the ability to implement custom Python bindings, that’s fine too.

Resources


This brief tutorial is not supposed to replace the Home assistant official documentation. Users are advised to go through the official documentation first (https://home-assistant.io)

Configuration


The demonstration is based on the Hassbian root file system which comes pre-installed with home-assistant,

Three main steps are required to configure Hassbian.

 

Expected installation and Configuration time : 2-3 hrs

Step 1: Initial Configuration

The shipped D4 home assistant image has already pre-installed Hassbian V1.23 Jessie, if you are

advanced user and wanted to install Hassbian yourself, you can refer to hassbian document below:

https://home-assistant.io/docs/installation/hassbian/

Now, if you downloaded D4 home assistant image, you should followed https://community.cog.systems/index.php/demo-installation/ and check you are able to ssh to driver cell:

ssh pi@<rpi board address>
Password: raspberry

 

If successful, you should be able to verify connection from host machine or mobile phone via WIFI, open a web browser with URL:

http://@<rpi board address>:8123

 

You should expect to see a page like the following :-

If not, check if the home assistant service is up and running, in ssh terminal:

>systemctl status home-assistant@homeassistant.service

Check that the status shows it’s Active, if not, run

>sudo systemctl start home-assistant@homeassistant.service

and retry.

The next step is for customization and add-ons. You can find all the details in https://home-assistant.io/docs/installation/hassbian/customization/

For Z-Wave you can skip and directly check Step 2

Step 2: Z-Wave Configuration

If you are going to use Z-Wave devices, it’s important to configure the Z-Wave adapter path and install Open Z-Wave first.

If you are not planning to use any Z-wave device, this section can be skipped.

For detail steps, please check official page : https://home-assistant.io/docs/z-wave/

Please plug in your Z-Wave USB Adapter to one of the USB port on your RPI3 board, and find out what device path is

the adapter with:

>dmesg | tail

most likely it would be /dev/ttyACM0, let’s assume that is the ZWave device path and use it throughout this document, but please replace the path with your own result:

>cd /home/homeassistant/.homeassistant
>nano configuration.yaml

 

#Example configuration.yaml entry
zwave:
usb_path: /dev/ttyACM0

 

save file and exit using Ctrl X

Please go through the following steps to install Open Z-Wave (or skip if you do not plan to use Z-Wave):

First, need to stop home assistant service, and switch to user “homeassistant”:

>sudo systemctl stop home-assistant@homeassistant.service
>sudo su -s /bin/bash homeassistant
>cd ~

Then can start installation tasks needed for use Z-Wave.
Note that the installation of Open Z-Wave can be pretty long as it will download and build code (Expected time is between 30m – 1.5 hr)
Don’t worry if you are getting some compilation warnings during installation of openzwave, but please be patient.

>sudo hassbian-config install openzwave-pip
>sudo hassbina-config install openzwave

 

Now, exit homeassistent account and back to user pi:

>exit

 

>cd /srv/homeassistant/src/open-zwave-control-panel >sudo ./ozwcp -p 8888

 

From host machine, open browser with URL:

http://<rpi board address>:8888

You should expect to see a window like the following

At this stage, you should type “/dev/ttyACM0” in Device Name

and press the initialize button. Power on your z-wave devices,

Make sure you see all your z-wave devices on the Devices list, and configure them as you wish.

Choose the device you want to add to home assistant net work, then in “controller” section, click “Select an operation”,  and then choose “Add Device”.

Now you can save the changes by clicking “save…” in “Backup Controller” section.

In ssh terminal, close the open z-wave control panel (ctrl + c).

Now you need to reboot the RPI3 board, in ssh terminal:

>sudo shutdown -h now

Wait until you see:

reboot: Power down

Ignore the kernel panic after that, and power off RPI3 board and then Power on RPI3.

After reconnect your host machine or your mobile phone with WIFI, and open the brower with URL:

http://<rpi board address>:8123

This time you should see all the z-wave devices and their status refreshing like below:

 

Step 3: Home Assistant Configuration

You should be able to Configure Home Assistant now for your own project.

The important part is hass –script check_config part as we need to ensure the configuration.yml file is correct.

If there are any errors, these will be captured by check_config, you can also upgrade homeassistant with following command:


>sudo systemctl stop home-assistant@homeassistant.service
>sudo su -s /bin/bash homeassistant
>source /srv/homeassistant/bin/activate
>pip3 install –upgrade homeassistant
>hass –script check_config
>exit
>sudo systemctl start home-assistant@homeassistant.service

Note that the first time it can take more than 30 minutes before you are able to access the Home assistant web page.
This is normal because Home Assistant generally updates components (e.g. python_openzwave)

Once everything is good, access Home assistant from your host machine again:

http://@<rpi board address>:8123