Skip to content

durinfab/Home-Assistant-Config

Repository files navigation

My Home Assistant Configuration ✨

⚠️ Update 05.2021: This smart home project is discontinued from now on. The reason is I'm switching my place to live and implicitly not able to continue this project. I don't know if I start another smart home like this anytime soon, but I learned a lot during the last four years of tinkering and I don't think I can fully discard this hobby.

Of course I'm keeping this repository online, because it still might help some of you designing a smart home.


Current Version: 2021.3.4

I'm Fabian, a computer science student from Germany. I live in a shared apartment with my partner and a friend of ours. I'm using Home Assistant for about four years right now and Home Automation has become one of my biggest hobbies. During my journey I learned a lot about keeping the network tidy, getting an own point of view of logical shortcuts between devices and a good effort-benefit- and price-performance- assessment.

Because I'm a student and home automation is a slightly expensive hobby. I started my journey in 2016 with almost only DIY sensors and actors, which are mainly driven by a ESP32/8266. Until now, much has changed. More WiFi-devices imply more complexity. More WiFi-devices need a stronger WiFi-Router or some devices need to switch to a alternative network technology. After a while, I switched almost every sensor to a Zigbee device. And so on...

This is my current, active configuration for everyday use. Feel free to inspire yourself and give feedback on my setup. I look forward to discussing with you :)

TL;DR: I received many inspirations and help from all those smart home developers and enthusiasts and I want to give something back. So here is my Home Assistant Configuration.

💭 Philosophy

In this chapter I want to give you a short briefing about what my smart home should do and where I set my preferences.

  1. The Home should work for you. It should look forward, know what you want to do and help you with that action without any further ado.

  2. I love building, solder and flashing devices on my own. But during the last years I learned how true the saying “time is money” is. For a wide range of devices DIY is not as reliable and require much more maintanance then official devices. That's why I have two reasons why I build something on my own, rather then buying an product.

    • It is much significantly cheaper than official hardware.
    • It offers many more functionalities than official hardware.

    To be fair: the reliability of devices increases significantly if I use popular community driven projects like ESPHome or WLED.

  3. The more the Smart Home grows, the more maintenance it needs. Thats why I try to minimize the range of different devices or networks.

  4. The wish to avoid cloud services. I know if you're afraid of your data being abused, don't collect them on your own. But at least I want to pay attention to the sharing of those data.

🖥 Hardware

My Home Assistant instance is running in a Docker environment on an Intel® NUC-Kit NUC8i3BEH with an Intel® Core™ i3-8109U and 16GB DDR4 RAM. All Smart Home related service are running in their own Docker container.

⛓ Network

As too many Wi-Fi devices are bad for the stability of the network and always need a power source, I needed to add another communication technology to my network. Because Zigbee devices are overall cheaper than Z-Wave, my decision was made quickly.

🐝 Zigbee

All my battery equipped devices use Zigbee for communication. With the help of Zigbee2MQTT all received information is converted into MQTT messages. For a long time I used the CC2531 as Coordinator. All related firmware files can be found here. But because of his weak transmission strength and the low amount of direct children at the same time, I recently decided to move on to the CC26X2R1.

So far I'm very happy with it. Today I'm using 25 Zigbee sensors, which are noted down below:

Model Image Quantity Notes
Aqara human body movement and illuminance sensor (RTCGQ11LM) Aqara Motion 2 Used to detect indoor motion on the stairway and the vestibule.
Aqara door & window contact sensor (MCCGQ11LM) Aqara Door/Window 6 Used to detect entering the apartment and tracking the opened windows.
MiJia temperature & humidity sensor (WSDCGQ01LM) Aqara Temperature 3 Used to track the temperature and humidity of the apartment.
Aqara double key wireless wall switch (WXKG02LM) Aqara Double 3 The perfect control center for every room. Can detect nine different “pressing”-events.
IKEA E1766 (Included in FYTUR and KADRILJ E1766) E1766 2 Used for different action. These switches are REALLY fast (i'll maybe replace all of my single switches with IKEA ones...)
Aqara wireless switch (WXKG11LM) Aqara Single Switch 1 Simple switch with two action. Sadly got a bad pressure point and has an unoptimal latency problem.
IKEA FYRTUR (E1757) Aqara Single Switch 2 Expensive but worth the money. Adjustable height, relatively quiet. In my area there is no alternative to this product, if you want an Zigbee Shutter.
BlitzWolf Energy Monitoring (BW-SHP13) BlitzWolf BW-SHP13 2 Cheap Zigbee energy monitor. It just works. Used to measure the consumption of the living room and the workspace. They are also acting as an repeater.

☁️ Wi-Fi

Today a Wi-Fi-network is inevitable. When one router is not able to reach every spot in the apartment, you need multiple routers to achieve a stable connection. Ealier I configured some old routers to a “Mesh”-like network with multiple DD-WRT custom flashed routers. But overall it was a real pain to maintain and administrate. First of all becuase I got routers from different brands and each one performs and works a little differently. Second is the configuration is not trivial for a "please just work"-setup. At the end of 2018 I decided to invest into two “Google Wi-Fi” Routers.

These are performing inconspicuous. Everything is stable, but from a networking perspective some more settings with the app are desirable.

But nonetheless these pucks are able to handle my roundabout 50 devices with no problems. In the following sections I will show you the different devices that are used.

💡 Lighting

I love colorful LEDs. They help to give every room some dynamic and variety. That's why I'm mainly using color-ranged bulbs and strips instead of white-ranged ones.

For ceiling lamps i'm using Yeelight Lamps. They are relatively cheap, have a LAN-only-functionality and a stable Home Assistant integration.

For casual bulbs I started to switch to Phillips Hue Devices, because in their White(Warm/Cold) variant are quite affordable. The Color varient of these bulbs are stupid overpriced an are only used in the Living Room to work with Philips Ambilight.

Model Image Quantity Notes
Xiaomi Yeelight Bulb V1 (YLDP02YL) 2 Used as bedside lamps. They are less bright than the V2 and my oldest smart bulbs.
Xiaomi Yeelight Bulb 1S (YLDP13YL) 1 Used inside the workspace.
Yeelight Meteorite 1 Used in the Workspace room for dinner and ambient lighting. Contains colored light on top and white light on the bottom (adjustable temperature).
Xiaomi Ceiling Lamp 1 Used in our kitchen. Very bright but not that cheap.

Hint: I recently used a Yeelight Bulb 1S outside (around -5 °C minimum). The Bulb survived the cold temperatures, but the network connection was very, very unstable. (the bulb is replaced with an Hue Zigbee Bulb nowadays)

Hint: I did block some of the Xiaomi Services via DNS Blocking. This did result in some weird behavior, like being unavailable or very unresponsive.

The lighting strips offered by Yeelight are very expensive and not worth the money when you can do it yourself :)

Im using four DIY LED Strips with the Software WLED. These are executed on an ESP-01 with RGB-Adapter. As power supply im using basic 5V ones and for the lighting WS2812B LED Strips. For an 3M Led Strip (60 LEDs per Meter) I'm paying around 30 Euro. On top we have all features of the WLED firmware.

🛋 Phillips Hue

As I noted in my previous chapters, I want to keep the amount of different networks as small as possible. But an exception confirms the rule. Phillips Bulbs are also based on the Zigbee connection technology. As a Wi-Fi to Zigbee converter, they are using the Hue Bridge and I still use it. But why do I use them, when I simply can add all Zigbee devices to my Zigbee2MQTT interface?

  • Take advantage of "Ambilight+Hue". Alternative solution like diyHue or ambilight-yeelight does not work reliable in my case.
  • Use an old Phillips LivingColors Bloom again, as I was not able to connect it to Zigbee2MQTT
  • Improve the performance of my "Hue motion outdoor sensor", which sometimes lose connection, which leads to a disassembly followed by a battery removal and insertion.

Long story short: I wanted to minimize afford. So currently there are two different Zigbee Networks active.

Hint: When you want to use different Zigbee networks, keep track on their current transmission channels. Prevent overlapping.

Here are my current Phillips Hue devices:

Model Image Quantity Notes
Phillips E27 white & color (LCA001) 3 Used in the living room (Ambilight) and the vestibule (Zigbee Router for outdoor sensor).
Hue motion outdoor sensor (9290019758) Hue Outdoor 1 Used for capturing the outdoor temperature and entrance lighting.
Phillips LivingColors Bloom 3. Gen. (LLC005) 1 Used to light up the whiteboard in the storage room.
Phillips E27 white (A60) 2 Used in Storage Room and Outside
Random problems and their solution

    If you turn on one Phillips Bulb via Home Assistant, other Phillips Bulbs will turn on, on their own, too

    • Be sure that every bulb that should operate on its own, got its own room in the Hue App.
    • Remove/Verify all used Apps by the Hue App, to do this you need an third-party App like Hue-Essentials.

🏃🏻‍♂️ Presence Detection

Detecting residents in a specific area is not easy to establish, but it's paying off. You can turn the lights off or disable the heater when nobody is at home. You can automatically start the alarm-management or trigger the vacuum robot... Personally I'm dividing the variants of presence detection into different levels. There are two level of region precision (room based vs. home based) and two level of human/identity precision (there is a living thing vs. there is resident with a known name).

  • For the room based region precision I'm using simple motion sensors, which only detects that there is a resident present.

  • For the room based resident detection um using “room-assistant”, a simple script which runs on four Raspberry Pi's. They are able to detect “known” BLE (Bluetooth Low Energy) devices inside their mesh network and as long as every resident has a smartphone which does he takes with him around. You can easily detect if a resident is at home or even if he is in a specific room, as long as he does not forget his phone 🤷🏼‍♂️ “room-assistant” works via distance approximation. Using the signal strength of the supervised BLE devices to each Raspberry Pi (running room-assistant), you can approximate the area/room.

    I also use WiFi for presence detection with a simple network scan, for a specific device.

And how does room-assisistant perform?

It works. Well at least you can get a good approximation about the local presence of a resident. Currently I have no real usecase for an automation because of the short, but noticeable, delay of the presence change. Also, based on the different strengths of the walls some false presence switches. So at the end of the day I'm using room-assistant as an more complex replacement of monitor. Maybe I find some handy automations in the future...

Problems with Presence Detection

There is a resident There is resident with the name
room based Easy Motion Sensors, Switches, Buttons (Basically every sensor that detects an interaction with the room). Hard Requires the resident to ALWAYS take their personal device (e. g. smart phone) with it them. In my opinion only realizable with Smart Watches. (ex. room-assistant)
home based Easy Motion Sensors, Switches, Buttons (Basically every sensor that needs an interaction). Medium Requires BLE monitoring and well-defined scanning algorithms. Not easy to establish but very reliable. (ex. monitor)
Important corresponding automations

Random problems and their solution

    Your iPhones Wifi is not detected by nmap(network scanner)

    • In iOS 14 Apple introduced "Private WiFi Adresses". To avoid tracking, they publishing fake MAC-Adresses, which are changing from time to time. You can turn this feature off network wise in settings.

🧹 Vacuum Robot

The newest member in our small Smart Home is a used Roborock S50 (or S51/S55 - different color).

Why especially this device? Because it uses a smart Laser-based navigation(no random algorithms), is rootable and is supported by Valetudo. It is important to me to interrupt the cloud connection to Xiaomi. His little brother the Xiaomi Mi Robot has a fewer features. The Roborock S50 supports virtual No-Go Borders and saves the created map over multiple cleaning runs. For an advanced comparison click here.

Using in automations

Note: If you want to buy this device, be sure to get one with old production date (before 2019-11) as the factory firmware (to which the robot can be reset) does allow the installation of a custom ROM.

📱 Wall mounted tablet

If you want an dynamic control panel for your Home Assistant, beside your phone, an wall-mounted tablet is a easy alternative. For this purpose I've bought a Amazon Fire HD8" 2018 ("karnak"). All Fire Tablets devices are relatively cheap but are having a big downside: Fire OS. This stripped down version of Android is just a pain. After a bit of investigation I found a custom ROM that fitted my device. I've installed Lineage OS on it successfully and it just works.

To integrate my tablet I'm using Fully Kiosk Browser with the browser_mod. This allows me to get access to literally all of it's sensors including brightness control, camera and microphones.

Using in automations

Hint: The tablet lose it's connection to Home Assistant if I lock the device. Thats why I'm just setting the brightness to the lowest setting.

📺 Television

As TV we are using a Phillips 55PUS7503. For the main facts, it features a 55 inch display and was build in 2018. Why Phillips? For a neat little thing called "Ambilight". Basically the TV has build-in LEDs around the edge, facing the wall behind it. The purpose of them is to emulate an enlargement of the picture by displaying the same colors as the display show on the same position. From a Smart-Home perspective this TV features an API with allows remote control over the network.

To integrate the TV I use this component.

Today Phillips Hue is a big player in the lighting Smart-Home industry. To upgrade the cross-over usability of their device, they introduced a feature called "Ambilight+Hue". As you might expect: With this feature you are able to connect your Hue Bulbs to the LEDs from Ambilight. This way you can extend the Ambilight effect even more...

Problem: As I've not connected an ethernet cable on the installation I'm only able to connect to the TV via Wi-Fi (I'm not able to remove the TV from the wall mount again). The TV also uses a feature called WoWLAN, which works just like Wake-on-LAN, but Wi-Fi gets disabled on standby periodically. This leads to non-deterministic switch-on behavior. As a walkaround I use the guide posted here. With the help of the APP "Wakelock Revamped", you are able to disable the automatic Wi-Fi disconnect on standby.

ESP32/ESP8266

This ESP Family is a famous name in the DIY Smart Home and IoT world. The ESP32 is the successor of the ESP8266. Both have a lot of GPIO Pins, 5V Micro-USB power supply and Bluetooth+Wi-Fi connectivity. They also have a very large community with projects like ESPHome and the mentioned WLED.

ESPHome allows to build a firmware based on the connected sensors and devices. All of the following devices are base on ESPHome. Everyone who works with a lot of self programmed ESP Devices should try this service! It saves a lot of time of programming...

MAX7219 - Led Matrix

I like the idea of sharing the collected information of the apartment with the residents. At the same time there should be the possibility to notify the residents, beside sending them a phone notification. At this point I was searching for an alternative and found the MAX7219 LED Matrix.

On the left side you can see the current time and on the right a random information. There is also a mode for blocking information(that need an interaction to disappear) or an notification, that shows one time for about ten seconds. More information can be found here.

Using in automations

🌡 DHT22 - Temperature/Humidity Sensor

In the bedroom there is still a DHT22 Sensor in use. It should be replaced with an Aqara sensor in the future to keep consistency. I'm still playing with the thought to add some other sensors to this ESP to get a overview over the air quality...

🧍🏼‍♂️ HC-SR501 - PIR Sensor

HC-SR501 boards are relatively cheap but I have always bad luck with them. By now there are two of them in use and both are working on 5V (You can also power them with 3.3V). An advantage over the Zigbee counterpart is that you can adjust the delay between scans.

🏋🏼‍♂️ HX711 - Weight Sensor

Some of you might ask what you can do with a weight sensor in a Smart Home. A whole lot of! I use them placed under my bed to detect the presence there. Because my partner weighs less than me, we can differentiate who and how much people are there. This enables a lot of handy automations.

Using in automations

The idea for this use case of the HX711 is from here

Software Components

I'm using different Software Components and custom Home Assistant integrations to round off my setup. Two big reliefs ist Home Assistant Supervised and HACS. Home Assistant Supervised is a Docker based version of Home Assistant, which supports the installation of external Integrations (Add-Ons). These are executed in their own Docker container (basically their own execution environment).

You can install different custom integration into your Home Assistant config folder. Normally these are managed manually by the user, but HACS gives the opportunity to list, install/update and maintain all of your integrations. Beside them, HACS allows you to install custom Themes and Lovelace-Cards.

HACS - Current used Integrations

HACS - Currently used Lovelace Cards

HA Supervised Add-Ons

  • Adguard - Ad-Blocking for the entire network (PiHole replacement). 🛡
  • ESPHome - Manage all my ESPHome enabled IoT devices. 🏠
  • Mosquitto - MQTT Server for my network. ☀️
  • ps4Waker - Helps to automatically start-up my PS4.
  • RPC-Shutdown - Shutdown Windows Machines.
  • valetudo-mapper - Converts Valetudo Map to a PNG and adds camera entity for viewing.
  • VSCode - Visual Studio Code through browser. Used for whole automation implementation.
  • Zigbee2MQTT - Bridge to pipe Zigbee Device Information to MQTT. 🐝
  • Home Assistant Philips TV - Integrate Phillips Android TVs as media_player.

Miscellaneous

More complex automations

In this section I want to describe some of my more complex automation-systems. Maybe someone is interested in this and/or has some ideas to improve the systems.

The LED Sign - Notifications and random facts for everyone 🌈

You all know the idea. A continuous information source to show some of the collected information and notify the residents in special cases.

To distinguish between the states of this I created an input_select to represent those.

  • Default - Every two minutes an event is fired to update the current text with a random text from templates/led/status.yaml.
  • Notification - Notifications are a bit senseless regarding their reliability, because you need to see them. Example: If someone arrives at home a welcome message is printed there. These kinds of notifications disappear after 10 seconds and are restoring the previous text to the sign. If the current State is "Hard", no notification will be shown.
  • Hard - Example: If the vacuum robot's bin should get cleared a "Hard"-Notification is printed. This kind of notification will not get overwritten by anything. Only after an acceptance/specific action of the user, the message will get removed.
  • Disabled - If no one is at home the state switches to "Disabled". This state behaves similar to "Hard", because it can only be interrupted by a specific action(arrival of a resident).

Here is a short illustration:

Bedroom and corresponding lights 🛏

Another quiet complex structure has my bedroom-weight-light automation system. If someone asks me what the most abstract sensor in my setup, I usually tell them about the weight sensors under my bed. At the beginning it sounds a bit unnecessary, but the potential is huge. Here is what I'm doing: At first I need to mention that my partner and me are having their fixed side of the bed for sleeping. At this point it is easy to say, that we both got our own bedside lamp. Another point that is playing in my hands is that we've got a moderate weight difference between us.

Long story short: When someone leaves the bed I can easily tell, who it was. I have placed two buttons in our bedroom, one between us, over the bed and the another at the entrance. The buttons are obviously used to control the lights. But there are some different interactions based one time and if someone is sleeping already.

  • Entrance Button (single)

    • Single: If no one is in bed: Toggle both lights with full brightness
    • Single: If someone is in bed: Toggle the lamp of the resident that is not in bed at low brightness
  • Bedside Button (double)

    • Single Left/Right: Toggle the corresponding side with medium brightness
    • Both: Turn on both lights with full brightness
  • Weight Control

    • Enabled: When one of us lays in bed for more than 15 minutes.
      • When the resident leaves the bed, the light on his side goes on with very low brightness.
      • When the resident lays down again, the light turns off again.
    • Disabled: When the sun rises.
Corresponding automations

Acoustic Feedback

Virtual assistants are getting more and more popular and I'm also using some Google Home Minis around the apartment. There are many downsides of using those assistants. The first point here is the security perspective. With the installation of such a device you are placing an always online and microphone-equipped spy inside your home. Personally I grew slightly more tolerant towards the topic and see the usage as a trade-off between really useful features and the collection of data. These devices could possibly scan everything in your environment and help the manufacturer create a detailed personal description. Making sure they don't is impossible as long as the code is closed source.

On the other side these devices can assist you during your everyday life. Ask for the weather, create timers, play songs, everything controlled by your voice. Furthermore you have the entire knowledge database of the internet on your side. Simple and some complex questions get answered and after a while you really get used to it.

But why Google Home?

First of all, I've made this decision about three years ago, so some things might have changed (feature and restriction wise). Beside some community driven projects there are three choices when choosing a virtual assistant.

Amazon Alexa

Alexa was the first assistant which was presented to the world and I used her for around two months. From a usability perspective I had some problems with the system. The first thing was the "application"-model. If you want to use third-party apps, you need to call Alexa to execute this app and then every vocal input will be piped through her. Another thing is that Amazon is, in my opinion, not really able to create handy User Interfaces. Except that, Alexa was not that bad. However Google Home had attractive features like accessible API for Bluetooth LE (not supported anymore 🙁), Spotify Multiroom(speaker-group) support and person specific profiles.

Things might have changed since then!

Apple Siri

In the past Siri was always known to be less reliable than her competitor. On a daily base she performs okay in executing basic commands, but has some problems. Because Siri is developed by Apple, she only works with Apple devices. Even using a different streaming service, aside from "Apple Music", is not possible at the moment. Another point is the high price tag on the speaker devices. Recently they released the HomePod Mini for 99 Euro (320 Euro for the original HomePod) which is still really expensive per device. They might sound a lot better then the Google Home Minis, but you can buy five of them for the price of one HomePod Mini...

However it is ridiculously easy to connect Siri to Home Assistant: with HomeKit. HomeKit is an interface to connect IoT Devices to your Apple Account. Home Assistant has an HomeKit Integration which allows to simply forward all supported and desired device entities to HomeKit. Doing so will add the entities in the stock HomeKit App - this means full Siri support! Additionally you can share your Home to other users if you want them to take control of the home. From a daily usage perspective this replaces the official Home Assistant App ...

Google Home

With the other two assistants aside: Why did I choose Google Home? At the time I bought these devices, Google beat Amazon feature wise and Apple was not even an option. But how do they perform today?

I've got four original Google Home Mini's (No Google Nest devices) around the apartment. They are very cheap, do their job, but are... interchangeable. Today all virtual assistants perform similar and only got minor differences. The top uses of our Google Home Minis:

  • Ask for the weather 🌨
  • Play Music (Single- and Multiroom) on Spotify 🎶
  • Set Timers ⏰
  • Find my Phone (Android only) 🤷🏼‍♂️

You might notice that these are very basic actions and you are right. But one thing is missing completely on this list...

Integration of Google Home into Home Assistant

Google Home devices can be integrated as media_players to Home Assistant. This integration also supports TTS (Text-to-Speech) which can be very handy if you want acoustical feedback from Home Assistant. Every notification, every event, every custom text can be played around the apartment, which offers many possibilities. As TTS Service I use Amazon Polly. She just sounds better than the classic Google TTS. The basic setup of the speech engine I'm using is from this configuration (Thanks CCOSTAN 😊).

So Google Home can easily be used as an output. On the other side it is very difficult to reliably integrate Home Assistant entities to Google Home and trigger them with your voice as input. I tried many times and never got it to work stably. Many tricky workarounds, extravagant additional configs and non-deterministic results are just not worth the effort in my opinion... Again, things might have changed but at the moment I'm just using Siri on my Phone if I really want to give voice commands.

So what is my recommendation? For my environment it would make sense to use the Apple HomePod nowadays. But they are still very expensive and do not even support Spotify, so I'll stick to my Google Home Mini's. In the end every assistant is similar to each other: You don't pay with money, you pay with personal data. On the other side they can offer small additions to your daily life and are just fun to use.

Future Plans 👨🏻‍🔧

Archived Versions 📚

Support my coffee consumption ☕️

I'm powered by coffee. If you like my work, you can buy me a coffee. ❤️

About

My personal Home Assistant configuration 💡

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published