Install Home Assistant on Raspberry PI

Follow the instructions on this page

Encountering problems with Home Assistant on Raspberry PI

When running hass from the command line after other steps were complete, I had some problems and was getting errors like the following.
2018-10-14 13:12:20 INFO (Thread-14) [homeassistant.util.package] Attempting install of pychromecast==2.1.0
2018-10-14 13:12:28 INFO (MainThread) [homeassistant.components.http.view] Serving / to 192.168.2.150 (auth: False)
2018-10-14 13:12:28 INFO (MainThread) [homeassistant.components.http.view] Serving /api/onboarding to 192.168.2.150 (auth: False)
2018-10-14 13:12:37 ERROR (Thread-14) [homeassistant.util.package] Unable to install package pychromecast==2.1.0: Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 138, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/srv/homeassistant/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/connection.py", line 75, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3]Temporary failure in name resolution
The important message there is “Temporary failure in name resolution” This indicates that there is some issue with DNS, I suspect that for me one of the mirror servers was offline.
To resolve this issue, I looked for all the instances of the phrase “Attempting install of”, then run a pip3 three install of each of this from the server shell.  To be in the server shell, the commands are:
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate
The extra packages I installed manually were:
pip3 install PyQRCode
pip3 install aiohttp_cors
pip3 install netdisco
pip3 install pyotp
pip3 install sqlalchemy
pip3 install distro
pip3 install xmltodict
pip3 install gTTS-token
pip3 install warrant
pip3 install mutagen
pip3 install home-assistant-frontend
pip3 install pywemo
pip3 install pysonos
pip3 install pyecho
pip3 install aiohue
pip3 install pychromecast

Access Home Assistant and Create an account

Once completed you can access Home Assistant through the Web GUI using the address http://192.168.2.33:8123/ where 192.168.2.33 is the IP address of your raspberry pi.
You will be asked to create an account, I just created an account named admin and set a password.

Auto Start Home Assistant on Reboot

I prefer init.d so I used this page to set it up.  I used the Daemon Script creating /etc/init.d/hass-daemon and followed the instructions.
The top of the script needs a few things setup, I used the following
PRE_EXEC="cd /srv/homeassistant; python3 -m venv .; source bin/activate;"
# Typically /usr/bin/hass
HASS_BIN="/srv/homeassistant/bin/hass"
RUN_AS="homeassistant"
PID_DIR="/var/run/hass"
PID_FILE="$PID_DIR/hass.pid"
CONFIG_DIR="/home/$RUN_AS/.homeassistant"
LOG_DIR="/var/log/homeassistant"
LOG_FILE="$LOG_DIR/home-assistant.log"
FLAGS="-v --config $CONFIG_DIR --pid-file $PID_FILE --log-file $LOG_FILE --daemon"
Then you need to create a few folders and change the ownership, the commands for this are:
sudo mkdir /var/run/hass
sudo mkdir /var/log/homeassistant
sudo chown -R homeassistant /var/run/hass
sudo chown -R homeassistant /var/log/homeassistant

Basic Home Assistant Configuration Changes

I have found the following settings are helpful and should be made and Home Assistant restarted
If you have followed the Home Assistant Installation instructions, you will find the configuration file in the following location, /home/homeassistant/.homeassistant/configuration.yaml
TODO