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.
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.
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.
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.
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.
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
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.
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.
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.
Find the line that reads âdiscovery:â, and add the following below it:
- 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.
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.
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:
â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.
Then, add the following to the Service Data box:
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.
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.