Home Assistant

Posted

My brother and I decided to set up a home automation system for our lighting, heating/cooling and multimedia systems (amongst other purposes).

The Software

The main two competitors that we looked at were Home Assistant and OpenHAB.
Whilst OpenHAB was more stable and feature-rich, we opted for Home Assistant because it looked nicer.

Although there was no official Android client EDIT: There is now an official client, there are (I haven’t tested) third party apps, like HomeAssist, Ariela, HA Client, Homy, Home Habit, WallPanel and Project Rotini.
In addition, the new Lovelace Web UI looks fantastic - so perhaps we won’t even need a native app.

Also, Home Assistant is written in Python, whilst OpenHAB is written in Java. With the interpretive nature of code execution in Python, I decided that Home Assistant would be better suited to quickly developing and deploying custom functionality

Home Assistant also supports ESPHome-compatible devices, like my NodeMCU ESP8266 boards, so I’ll be able to use them as wireless I/O devices!

Installation

EDIT: So Home Assistant and Hass.io are different things.
Home Assistant is the software, whilst Hass.io is the ochestrator (makes things work together).

Installing Home Assistant manually stops you from (easily) installing community addons.

apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat
curl -fsSL get.docker.com | sh
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s
Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        2d0083d
 Built:             Thu Jun 27 17:56:17 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       2d0083d
  Built:            Thu Jun 27 17:23:02 2019
  OS/Arch:          linux/amd64
  Experimental:     false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

$> docker ps

CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS              PORTS               NAMES
2bec2ff521ce        homeassistant/qemux86-64-homeassistant   "/usr/bin/entry.sh"      10 seconds ago      Up 9 seconds                            homeassistant
21c9de4deeb0        homeassistant/amd64-hassio-supervisor    "/bin/entry.sh python"   28 seconds ago      Up 27 seconds                           hassio_supervisor

OLD INSTRUCTIONS

Btw sudo everything - you know the drill.

Most guides recommend to install Home Assistant onto a Raspberry Pi, or a NUC via Hass.io - But as I already have a Debian virtual machine running in a Hyper-V server, I’ll use that instead

In ignoring all advice to use Docker and/or Python virtual environments:

python3 -m pip install homeassistant

Note: As of installing (30/06/2019), Home Assistant requires Python >= 3.5.3

We’ll also create a new restricted user account homeassistant to run the software.

useradd --shell /bin/false --system --no-user-group --no-create-home homeassistant

Configuring Home Assistant to run as a service

They recommend to use systemd, but I’m more familiar with the init.d approach.

This involves setting up the /etc/init.d/hass-daemon service file

Note: The original script had bugs, so I submitted a pull request #9741 to fix it

Then run the service installer with service hass-daemon install.

Finally, start the service with service hass-daemon start, and head to http://<SERVER_IP>:8123

Let it run for a bit while it sets everything up. It took about a minute before I could access the webpage.

Setup & Configuration

When you first visit the control panel, you should be greeted with the Administrator account creation page

Fill in those details, and hit Create Account. Then follow the rest of the instructions - should be straightforward!


Some useful things to do

  1. Set up HACS - the community addon manager

  2. Install the SonoffLAN integration to control Sonoff devices

  3. Install Node-RED for graphically setting up automations

More posts

Production on a Budget

Posted

Parsec

Low-latency desktop streaming? With keyboard and mouse emulation!?

Posted