Home Assistant: turning your home into a smart home
Recently I wrote about driving a lot of LEDs, ESPHome, and how our home network works. In each of those posts, there was a mention of Home Assistant. But what exactly is Home Assistant?
Open-source home automation software
Once you have intelligent devices in your home, you can’t get around: it’s a mess of different standards and platforms. Apple is committed to HomeKit, Google has “works with Google”, home appliances from Siemens and Bosch use the HomeConnect platform, and things like Philips Hue also have their own system.
Home Assistant brings all these things together in a uniform way and provides the necessary abstraction. For example, when you write an automation for Home Assistant, it doesn’t matter whether the lamp you connect is connected via Philips Hue, HomeKit, or WLED.
Also, it offers the possibility to create beautiful dashboards, so you can see the status of all your home appliances right away.
Home Assistant is software that ensures that everything in your home can talk to everything else in your home, regardless of the manufacturer, and turns your home into a smart home.
Installation
There are several ways to install Home Assistant, but the two most recommended are:
- Install Home Assistant OS (Hassio) on a Raspberry Pi 3 or 4 (or something similar).
- Run it inside a Docker container.
I started with a Docker container but soon realized that you miss out on some features (such as running add-ons), and since I always have a spare Raspberry Pi, I switched quickly.
SD cards
As Herman notes on DailyBits: Raspberry Pi’s and SD cards don’t like to play ball. The many small writes that the operating system makes significantly shorten the life of SD cards. Therefore, it is advisable to purchase memory cards with an A-class optimized for applications (hence the A). Also, always make sure your config has a backup.
Lingo
Once installed, it’s time to make yourself related to some of the concepts that you will often encounter:
- Integrations: the link between Home Assistant (HA) and a particular platform. There are currently around 1700 included, and you can install many more. This goes from apparent things like Philips Hue or Sonos to Domino’s Pizza (to order automatically).
- Devices: all your devices belong to an integration.
- Entities: Each appliance then has one or more entities. For example, we have a few Philips motion detectors with three entities: movement, temperature, and brightness.
- Areas: spaces in your home.
- Scenes: you can save the state of individual devices in a scene. This is especially useful for lamps.
- Automations: An automation is an action that is performed when something happens.
- Lovelace: the user interface in which you create dashboards.
Configuration
The installation of Home Assistant is straightforward. On a Raspberry Pi, you just download the image and burn it to an SD card. After about 20 minutes, you can surf to http://homeassistant.local and start configuring your Home Assistant.
An easy wizard will help you on your way to configuring all integrations.
Here are the integrations I have running:
- Denon: our amplifier.
- ESPHome: for all sensors in the house.
- Google Cast: to speak to Chromecasts.
- Home Connect: for our washing machine.
- Internet Printing Protocol (IPP): to see how much ink our printer has left.
- Logitech Harmony Hub: our universal remote.
- Meteorologisk Institutt: a reliable weather provider.
- Philips Hue: allows me to control our lights and all sensors/switches connected via the Hue bridge.
- Sonos: for our old Sonos downstairs.
- Synology DSM: stats from my Synology NAS.
- Ubiquiti Unifi: some data about our network.
- WLED: to operate my ESPs with WLED.
Home Assistant Community Store (HACS)
A vanilla Home Assistant installation is already top-notch. In the first hours, you’ll be adding all your devices and configuring your dashboard. But after a while the moment you’ll ask yourself: “hmmm, could I not add my bicycle/ca
r/coffee machine?”. Or you’ll consider that standard theme is kinda ugly.
Luckily there is something called the Home Assistant Community Store. This is an alternative app store for integrations and Lovelace components that don’t come bundled with HA.
I use the following things from HACS:
- Volkswagen We Connect: this way, I can see where my car is located in HA and if the doors are locked.
- Eufy Security: an integration for our doorbell (currently broken)
- SpaceX: a few entities track where the SpaceX caravan is located and when the next launch is.
- Light entity card: a Lovelace component to control the lamps that supports the effects of WLED.
- Kibibit theme: after trying a lot of themes, this is my favorite.
- Mini graph card: beautiful charts for Lovelace.
- Layout card: a container map that enables more complex layouts.
Dashboards
These are my Lovelace dashboards at the moment (a perpetual work-in-progress):
Getting those dashboards right is a lot of work. Mine still are not 100% the way I want them to be, and the YAML files you have to write to create something more advanced quickly become quite big.
Automation
Those dashboards are great, but it’s even more fun not to have to look at them. That’s why I am also running this automation:
- When the laundry is ready, it will be announced by every speaker in the house with text-to-speech.
- If my bike is charged or almost empty, I get a push notification.
- When my car is at home, but the door is unlocked, I get a push message on my phone.
- If the car arrives somewhere at a new location, I get a push message.
- There’s an ESPHome in the attic so that the LEDs automatically turn on when it detects someone coming up the stairs.
InfluxDB
One of the advantages of running HA via Hassio (the Home Assistant Operating System) is the ability to install add-ons. Add-ons run in separate containers and have little impact on the rest of your system.
My most used add-on is InfluxDB. This is a database optimized for time-based measurements. By default, HA already makes graphs of your sensors’ values over time, but with InfluxDB, you can go a lot further. And that’s really something for data nerds like me.
For example, this is the evolution of my Touran’s fuel tank over the past six months:
Or the light in the house the past few months:
Or the temperature measured by different sensors:
< figure class=”kg-card kg-image-card”>
If you want to go further, there is also the Grafana add-on. You can visualize the data from Influx even more. It also provides sharable images, which you can then use in your Lovelace dashboards.
Mobile
Home Assistant also has apps for iOS and Android. They give access to all aspects of the system and add several sensors, which you can use in HA, such as your pedometer, battery level, and location (if desired). And from HA, you can send push notifications to your mobile phone without any hassle.
Because Home Assistant runs on your own network, you will need to make an extra effort to be able to handle it from the outside:
- Either set up port forwarding on your router.
- Either you run a VPN with DDNS.
- Or subscribe to Home Assistant Cloud.
With that last one, you support the makers of HA, and it only costs 5 euros a month. A subscription gives some extra benefits, such as easier Google Home and Alexa integration. They will also send you an email if a security breach is found in your installation.
Going deeper
Home Assistant is incredibly extensive, and you can do really crazy stuff with it. Frenck, who also has many add-ons to his name, keeps a curated list of crazy Home Assistant things at Awesome Home Assistant.
Member discussion