Home automation from nothing to done: Part 1


Last year we moved to our new apartment, and right from the beginning I had in mind to setup an home automation system in order to be able to control appliances from my phone (or my voice - that would have been my final goal), either when home or not, and to let the home itself be somehow aware of the environment and react to specific events.

My initial ideas ranged from simply controlling lights and heatings, to simulating presence when on holiday; from having a synchronized audio playback in multiple rooms, to dimming the lights when playing a movie; from asking our flat what the weather would be during the day, to saying goodbye and letting it prepare some security mechanism while we’re away, like motion-sensitive IP cams I could control at any time.

And after 5 months of purchases, a couple of afternoons spent investigating which system would be the best for my needs and some (many!) more afternoons spent setting it up, I’m happy to say all of the above has been accomplished, and more has to come!

I’ve split this serie in 7 posts, so that each of them marks a milestone in the project and none of them is too long to comfortably read in the metro when commuting:

One of the requirements of the whole setup was to avoid things that required construction works in the flat, since we had to move in pretty quickly and didn’t have time to restructure the flat.

So without further ado, let’s get started!

Existing home automation software

The first thing I did even before I bought my first smart light was to check what software was available to seamlessly control multiple vendors appliances.

The main features I was looking for were:

  • It should be easy to setup and maintain
  • It should be user-friendly (so that my girlfriend could interact with it too)
  • It should be accessible from a laptop and a mobile phone
  • It should work with systems from multiple vendors
  • I should be able to take control of my flat even without it (in case of crashes or malfunctionings)
  • It should be possible to install and run the whole system on a Raspberry Pi (because I didn’t want to have an always-running machine that would consume more than 5W)

Just for the records, there are many more systems than the ones I will talk about in this post. I’m only going to mention the ones I actually considered or stumbled upon, but this doesn’t mean the others are not valid alternatives for your use case.

Hardware-based hubs:

The easiest type of home automation system is the one that comes with a hardware hub, so that it’s basically ready to be used immediately and to connect with your appliances without any additional effort.

I didn’t consider these for my setup for 2 reasons: the first is that most of them don’t offer a web interface but just mobile apps (I planned to have a touch display in the entrance where I could have access to all my devices); the second is that as proprietary systems, I was not sure how much support they would have received in the long run and how they would behave with less-known vendors and devices.

In this category we find Samsung’s SmartThings (probably the most common hardware hub), the Wink Hub 2 and the VeraLite, the only hardware hub I actually considered to buy before definitely deciding to go for a home-made one. The suggested retail price is around 99$ for all of the above, even though (at least on Amazon.de) they appear to be sold for double that.

Disclaimer: One more reason I didn’t opt for a hardware-based hub is that I wanted to run my home automation system together with other software that I will talk about in the next posts. If you’re a beginner and don’t feel comfortable buying and assembling a Raspberry Pi; if you want something that just works™ and don’t feel like spending time on improving and extending your home automation system beyond what these brands thought you should and could; if you read about the above mentioned systems and you like one of them in particular: just do it. This serie is for tinkerers and people who, like me, prefer having full control over what they use, or even contributing to the very same software.

Software-based hubs:

The other type of home automation system just comes as a software you can install on your laptop, desktop or ARM-based system (e.g. a RaspberryPi or equivalent, or a NAS).

The two alternatives (both open source) I considered for my home setup were OpenHAB and Home Assistant.

The first has been on the market for quite a long time and is very powerful. It’s vendor-neutral, runs on Raspberry Pi, has a very active and broad community, it’s easily extensible, provides API to integrate it in other systems and offers mobile apps as well as a web interface. It’s basically THE home automation software.

My only concern? It’s written in Java and thus could be a little too heavy for my Raspberry Pi setup, especially considered I wanted to run additional software alongside with it. Moreover, after searching a bit on the web, I had the impression that such power came with a lot of complexity too. The mobile apps were also a bit dated on the UI perspective, maybe for legacy reasons and for the age of the system in general.

This is why I eventually opted for Home Assistant. It’s written in Python, it’s quite young (not even at 1.0 yet!) but it already has a broad and active community, offers a JS web interface that adapts quite well to mobile devices too (but no native apps yet, other than an experimental and in closed-beta iOS client), is vendor-neutral and easily runs on Raspberry Pi (they even offer an all-in-one installer to go from zero to ready-to-play without any hassle, or a docker image if you’re that kind of person). The number of devices it can interact with is already impressive but increases with each and every update (the release cycle is currently of 2 weeks).

Installation

The first step is to order the Raspberry Pi 3 where we can install and run the home automation software.

I highly recommend buying from the RS online or Element14 shops. Both offer bundles for around 50-60€ including a Raspberry Pi 3 board, a case, a micro SD card, a power supply and an optional HDMI cable.

Once everything arrives and is assembled (it really takes 5 minutes), the easiest way to proceed is to start NOOBS and install RaspBian.

Optional: Since I prefer having a headless setup, the first thing I do at this point is:

After this is done, I find the fastest way to get home assistant up and running is to use their all-in-one installer. It will take about 1 hour to setup everything, so you can start reading about home assistant in the mean time.

Open the dashboard

If everything went as expected, when you open home.local:8123 in your browser (replace home with your RPi hostname) you should see the home assistant dashboard. Yours will be quite empty, while mine currently looks like this:

my_hass_dashboard

We’ll try to get there, step by step.

Configuring Home assistant

You can configure Home assistant through the configuration.yaml file in the main installation folder (if you installed it on a Raspberry Pi with the all-in-one installer, that would be /home/hass/.homeassistant/).

The best tutorial to get started is of course the one on the Home assistant website. I highly recommend reading it completely or at least until the basic chapter.

In the next post I’ll write about wiring our first appliances (smart light and plugs) to home assistant. Until then, you can start playing with components that don’t require any additional hardware, like weather or notifications.