How to set up and use Home Assistant: For Dummies edition

Google and Amazon don't have to rule the roost

How to get started with Home Assistant

Alexa and Google Assistant are moving further and further into automating your smart home gadgets. That means Google and Amazon will know just when you dim your lights, when you leave the house and what kind of coffee you like from your Nespresso 2049 PodMax machine.

Scary stuff, right?

Enter Home Assistant: an open source, free-to-use alternative that can be used within the walls of your home internet. It’s flexible, supports most popular smart home gear and doesn’t mine your data. And despite the name, it has no affiliation with Google.

Read this: How to build your own smart home hub with a Raspberry Pi

But there’s one problem: it’s not easy to use. You have to programme in automations manually. The last time we tried computer programming was back in the 90s, making a game on Q Basic. It didn’t end well. However, we have managed to get Home Assistant up and running – so hopefully that offers some encouragement.

There’s a lot of Home Assistant documentation available online, but most of it assumes you know terminology that most of us simply don’t. Lucky for you, we've put together this dummies guide to help you get started.

We are using Home Assistant running off a Raspberry Pi 3. You’ll need one too, along with an Ethernet cable, microSD card and an adapter to let you write to it using your laptop or desktop, such as a microSD-to-SD adapter or a microUSB dongle.

Installation

How to Use Home Assistant: For Dummies Edition

First of all we need to download the Home Assistant image file. This contains all the data we need to write to the SD card, which acts like the Raspberry Pi’s hard drive.

You can download it directly from the Home Assistant website. We can’t just drag and drop this file onto the microSD card, though. Plug your card into your laptop, then download and install an app called Etcher. It’s what team Home Assistant recommends.

This is an image writer application that arranges the data correctly on the card. Run it, click Select Image and find the image file you just downloaded. Press Select Drive and then choose the microSD card in the pop-up.

Press Flash and Etcher will do the rest. If your card is quick this should only take a moment.

Getting started

Etcher automatically un-mounts the card. You can simply remove it from your laptop and plug the microSD into your Raspberry Pi.

Plug your Pi into your router using an Ethernet cable, then into a power supply.

It doesn’t need to be attached to a monitor. But if you do, you’ll just see the Home Assistant logo. On first boot-up you’ll need to leave it running for up to 20 minutes as it downloads updates and extra required resources.

How it works

Here’s the first bit to get your head around. While Home Assistant runs on your Raspberry Pi, you configure and control it from your laptop, desktop or phone.

We’re going to use a laptop, as things get slightly more complicated from here.

Open up a browser and type “http://hassio.local:8123/“ into the address bar, making sure you’re connected to the same Wi-Fi networks your Pi. We recommend using Chrome as we had issues with both Safari and Firefox.

You should now see the Home Assistant interface, a disarmingly simple blue and white number. Right now it should look pretty empty apart from some links to starter guides. Click the button in the top-left corner of the screen to bring up the menu.

Configuring Home Assistant

We now need to get Home Assistant populated with our smart home devices. For the purposes of this guide we will deal with smart lights from Philips Hue and Lifx, as they show off two ways the platform discovers our gear.

First, select the hass.io entry in the side menu. If this brings up an empty screen, try another browser. We couldn’t get it to work with Firefox or Safari.

How to Use Home Assistant: For Dummies Edition

You should, however, see another menu that includes an item called Add-on Store. This offers a bunch of modules that let enthusiasts do more advanced things with Home Assistant, but we’re after one that makes the system easier to use. It’s called Configurator.

How to set up and use Home Assistant: For Dummies edition

Configurator lets us create automations without doing so in a text editor, which feels even more fiddly. Once installed you should see a Configurator page, but to get it to run we need to add the access password to the “Config” text section below. By default is should read “null”, but the password we need is “secret”. Make sure you include the quotation marks in there too, or it won’t work.

Adding Philips Hue

How to Use Home Assistant: For Dummies Edition

Now let’s add our Philips Hue bulbs. Select Configuration from the side menu, then Integrations in the main panel.

You should see a Philips Hue Bridge option. Click this and you should be prompted to press the button on your Hue bridge. Do so and Home Assistant will automatically discover and add your lights to the interface.

How to Use Home Assistant: For Dummies Edition

Select Overview in the side menu and you should see flick switches for your various Hue lights. Well done – we’ve now set up Home Assistant, in the most basic sense.

If you don’t see them, try restarting Home Assistant by going to Configuration > General and then selecting Restart, under the Server Management header.

Adding Lifx

Not all devices can be added like this, though. We have to dig a little deeper to add Lifx bulbs.

Select hass.io in the side menu, click on Configurator and then Open Web UI. This is where we encounter the text editing side of Home Assistant, which is currently unavoidable. Sorry.

Click the folder icon in the top-left of the screen and select the “configuration.yaml” file in the drop-down. You’ll see a page full of code-like text, which will look very unfriendly. We only need to add a couple of lines, though.

How to set up and use Home Assistant: For Dummies edition

Find the line that reads “discovery:”, and add the following below it:

light:
- platform: lifx

This tells Home Assistant to look for Lifx lights. If you need to add different devices, you can find the necessary code in the Components part of the Home Assistant website.

Controlling lights with your phone

If you have an iPhone, there’s an app called Home Assistant Companion that has an interface just like the one you see on your laptop. However, when you boot it up you need to add the same “http://hassio.local:8123” URL we used in the internet browser for it to work.

In theory you should be able to do the same with an Android phone, loading that URL in Chrome and selecting “add to Home Screen” in the Chrome menu. However, we could not get this to work with an Honor 10 or Nokia 7 Plus.

Getting started with Automations

Now it’s time to get serious. You can do an awful lot with Home Assistant, but we are going to detail a couple of micro-projects to give you an idea of how making automations works.

First we’ll turn a bedroom Philips Hue into a light that changes colour temperature from a stark “daylight” white to a sunset-like orangey white in the evening. We'll also make our office Lifx light into a visual alarm that reminds us at 6pm it is time to stop working.

To make an automation, select Configuration in the side menu, then select Automation and click the “+” button at the bottom right of the screen.

How to Use Home Assistant: For Dummies Edition

This brings up the form that makes creating macros a little simpler. Let’s give it the title “Morning”. Below this you’ll see the Trigger section. In this case our trigger is “Time”, which you can select from the trigger drop-down. Set it to 7:00, or whatever time you want the light to turn on.

Below the Trigger part is a Condition section, but we don’t need that right now. We want the Actions section below. Leave the Action Type as-is, showing “Call Service”, and select the “light.turn_on” option in the service drop-down.

How to Use Home Assistant: For Dummies Edition

As-is, this Home Assistant automation would turn all our lights on at 7am, but we want a specific light and specific colour temperature. To do this, some extra commands need to be added to the Service Data section below. Add this code:

"entity_id": "light.bedroom",

"kelvin": "6000"

“light.bedroom” is the name of the light in our demo, but yours will depend on the name you gave the bulb when setting it up originally. 6000 Kelvin offers an energising light that’s good for the morning.

Press the save button at the bottom-right of the screen and this automation will be logged.

Now, add another automation. This time change the time to 12:00 and the Kelvin rating to 4500, for a slightly more relaxed light tone at midday. And another at 19:00, dropping the Kelvin to a relaxed 3000. This is a warm white tone.

Want to make the light turn off at 11pm? That’s easy. Make another automation, set the time to 23:00, choose the “light.turn_off” service in the Action drop-down and add “"entity_id": “light.bedroom”” (again, use the name of your own Hue bulb) to the Service Data box.

Lifx End of Work Reminder

Next up, it’s the Lifx work alarm. Lifx bulbs are actually capable of neater automated feats than Philips Hue ones in Home Assistant, including a pulse function that blinks the light or makes it change colour briefly on command.

Open up a new Automation, and set the time to 18:00. Leave the Action Type as Call Service, and select “light.lifx_effect_pulse” in the Action drop-down.

How to set up and use Home Assistant: For Dummies edition

Then, add the following to the Service Data box:

"entity_id": "light.lifx_h079t52544bb",

"mode": "breathe",

"period": "3",

"color_name": "green",

"cycles": "4"

This makes the bulb gradually turn green then revert over a 3-second period, repeating the pattern four times (cycles). However, you’ll need to replace the code above with that of your own Lifx bulb.

A 12-second green light pulse may not stop us working late, but it’ll remind us we’re doing so.

How on Earth do I make my own automations?

But where do you find more about possible commands, and or the ID codes of your Hue and LIFX bulbs?

The Services demo area is the key here, and the best way to get your head around Home Assistant in general. Its shortcut is the little remote control-like icon found under the Developer Tools part of the side menu.

Here you can look at the exact names of your smart home devices, all the available actions, and the parameters you can use in them. It’s the best way to build up your code, and you can try out any instantly by pressing the Call Service button.

How to set up and use Home Assistant: For Dummies edition

The key to getting this part right is to pay attention to how the language is structured. Each part of the action gets its own line, is enclosed in quotation marks, and commands are separated by a comma. Stick to the rules and you’ll get used to Home Assistant automations in no time.

Our advice is to play around and see what you can come up with. Home Assistant may not be simple and fluffy, but its hand-on approach lets you do just about anything you like. And if this code seems like too much, the Home Assistant team plans to introduce a friendlier visual interface by the end of 2018.


What do you think?

Reply to
Your comment