The Home Assistant project came a long way
and currently is the de facto standard for serious home automation. Time to show you my setup. Because, of course, it has some specialties. We will go through nine hurdles and find a
solution for each of them. Watching this video might save you valuable
time. Grüezi YouTubers. Here is the guy with the Swiss accent. With a new episode and fresh ideas around
sensors and microcontrollers. Remember: If you subscribe, you will always
sit in the first row. This video is not another “how to install
Home Assistant.” It covers the following topics:
- My setup and the considerations that lead to this decision
- Tricks to get this setup working. I will concentrate on the order of tasks and
will provide links to videos on how to do each task
- Other decisions most Home Assistant users have to make
- My verdict on Home Assistant - And a list of open tasks for the future
Let’s start with the setup. Other than most standard installations, I
used two Raspberry Pis instead of one for my home automation. One runs Home Assistant in its native version
with its native operating system, and the other runs the dockized IOTstack. Both are integrated and managed by a common
interface. Please watch video #295 if you do not know
the IOTstack project. It can save you a lot of time, too. Home Assistant currently runs on this Tofu
board and IOTstack on a standard 2Gbyte Raspberry Pi4 and an SSD drive. This is mainly because of the availability
problems of Raspberry HW. A very long time ago, I backed the Home Assistant
Yellow project, and maybe I will get it in the near or far future. Then I will replace the Tofu board. But why did I decide to add a second box to
my setup? To understand this decision, we have to look
at the main options for Home Assistant: 1. Home Assistant Operating System: It contains
a minimal Operating System optimized to power Home Assistant. It comes with Supervisor to manage Home Assistant
Core and Add-ons and is the recommended installation method
2. Home Assistant Container: This is a standalone
container-based installation of Home Assistant Core (e.g., Docker)
Option one is recommended, and I fear that the support for version 2 will vanish over
time. In addition, you cannot use add-ons in version
2. Add-ons are very valuable in the Home Automation
Ecosystem. Unfortunately, Nabu Casa, the developer of
Home Assistant, decided not to use Raspberry OS for their project. And I also want to use projects like Pi-Hole,
which are not part of Home Assistant. At least not at the time of the making of
this video. This is why I decided to keep my current Raspberry
with all my data and integrate it into a new Home Assistant Machine. The current Pi uses an SSD for performance,
mainly because my influxDB gets bigger and bigger. With two systems, I can also share the load. The Raspberries are famous for low power consumption,
not for high speed. So my setup looks like that: The Tofu board
runs native Home Assistant, which uses its internal MMC drive and has no additional storage. And the Raspberry with the SSD, which also
has the Zigbee dongle attached. The next decision is also essential: Which
tool do I use for automation? The internal Home Assistant automation or
Node-Red? Looking at my current automation flows, it
was clear to me. Most of my “automation” is not simple
“if this then that.” They are much more complex, and Node-Red is
the right tool for me. Fortunately, there is a good integration of
Home Assistant and Node-Red. So the two most important decisions are made. Now comes the work. You will find a link to a video on how to
install Home Assistant. It is straightforward and only takes a few
minutes. Suppose you do not decide to use a CM4 Module. Then, it takes a long time. As soon as Home Assistant works, we can start
with the setup. The first component I installed is a Terminal. You find it in the “Add-on” in settings. I use the “Community Edition. As always, you have to configure the add-on. First, you must create an RSA key on your
computer and insert it here. And on the info tab, we find another essential
slider we will use later again and again: The “Show in Sidebar.” This adds the terminal to the menu. I also leave a link to a video where you find
all the needed steps in detail. The trick with the RSA key can be used outside
Home Assistant and with other editors like Visual Studio Code, BTW
Next, we have to install “HACS,” the Home Assistant Community Store, using the newly
installed terminal. Next, we have to restart Home Assistant. This is done in Developer Tools→Restart. Always check the configuration before you
hit “restart.” After that, we can add HACS in Settings→Devices
& Services→Integrations. You need a (free) GitHub account for this
task, BTW. After configuration, you can use HACS from
the menu. Also here, you find a link to a video. The third important helper is the file editor. We go again to settings→add-ons and add-on
store search for “file editor.” Then hit “Install” and restart Home Assistant. The reason we installed HACS is to install
the Node-Red Companion. In HACS, we go to integrations →> Explore
& download Repositories and search for “Node-Red Companion” and download it. After a restart, we can search for the Node-Red
Companion in Settings→Devices & Services and add it. It does not require configuration. I hope you remember where Node-Red runs. Yes, on my second Raspberry. So we need to ensure Home Assistant can connect
Node-Red on my IOTstack server. For that, we add a long-term token to Home
Assistant. Go to your user, then to the bottom of the
menu, and add a “Long-Lived Access Token.” Name it “Node-Red” and copy the token
to a save place. We will need it later. Then we go to our standard Node-Red and install
“node-red-contrib-home-assistant-websocket” from the palette. We now find many new nodes particularly made
to work with Home Assistant. Go to any flow and add one of the Home Assistant
nodes. Add a server and fill in the IP address of
your Home Assistant server. Do not forget the 8123 port and the token
from before. Save these changes and deploy the node. Now you can delete it. The connection is saved, and you can use all
sensors and switches from Home Assistant. Here you see an example of my lights in my
lab. These are Aqara PIRs, and here you see my
Sonoff switches. The integration is very comfortable. You get a drop-down with all available sensors
to choose from. You can save a lot of hassle by creating a
naming scheme for your devices before you start with Home Assistant. If I type “PIR,” I get all PIRs listed,
for example. You see, Node-Red behaves precisely as if
it were installed on the Home Assistant server. With one exception: It runs in a different
window. This is our next task. We go back to Home Assistant and open the
configuration.yaml file in the file editor. There, we add a chapter called panel_iframe
and these lines for Node-Red. The URL, this time, is pointing to the IOTstack
machine. The icon comes from simple icons, an add-on
in HACS. It is “nice to have,” and with your current
knowledge, you should be able to install it yourself. For high productivity, we can add a few other
links like zigbee2MQTT or Portainer. Because they run on the IOTstack server, they
have the same server address, just different ports. If we restart, we see all our beloved tools
in Home Assistant. Cool. There is still something important missing:
ESPHome for our gadgets. If you use Home Assistant, ESPhome is a natural
choice. But if you have Tasmota devices, they nicely
integrate via MQTT. Because ESPhome is an official add-on, you
can easily install it via Settings→Add-ons. It does not require any configuration. ESPhome has come a long way and is now super
simple. Plug your ESP32 or ESP8266 board into the
USB connector of the computer you are working with. Then you hit “add new device” and open
ESPhome Web. Next, connect the device by selecting the
correct COM port, hit “Prepare for adoption,” and “make adoptable.” A base version of ESPhome is now installed,
and if you add your Wi-Fi credentials, your ESP is automatically added to Home Assistant. ESPhome automatically discovers if you connect
an ESP32 or an ESP8266. Wonderful! If we go back to the ESPHome dashboard, we
see our newly created member. It shows “discovered,” and we need to
adopt it again. The first time we are asked for the Wi-Fi
credentials, which are then stored in the secrets file. And now a significant disadvantage starts. Because the compilation runs on the Home Assistant
machine, in our case, a Raspberry Pi4, the compilation is deadly slow. You can grab a cup of coffee if you run it
on a Raspberry Model 3. Or better, a beer for seduction. It reminds me of when we used punch cards
to program computers. We had to hand in the cards and got the results
back half an hour later. Back then, you learned to check your programs
before you gave them for processing. Frankly, I never missed these times. But now I am back unless you know a trick
to speed this process up. If we hit “edit,” we see the current definitions
of the board. For demonstration, I add the “binary sensor”
example and select GPIO0, the standard button on my board. Hit save and install and upload it wirelessly
because it is the fastest method. Now starts the waiting again, and eventually,
I get the sensor integrated into Home Assistant. As the last thing I want to flash my newly
arrived smart S26 Sonoff plug. Fortunately, they manufacture a version with
Swiss plugs. Very rare. This picture shows the value of non-standardization:
The simple problem of connecting three wires can be solved in many ways and creates lots
of hassle for all of us. I had to solder the usual four wires to RX,
TX, 3.3V, and ground for flashing. After connecting the wires to a USB to serial
converter, I could flash the S26 the same way as the sensor before. I even found a template that I added to the
YAML file of the device. Ready is the plug. Simple! There is one last item on my list: Home Assistant
writes all changes in a database which, of course, resides on the Home Assistant machine. As said before, I want all data on my second
Raspberry. This is easy. Just add these lines to the configuration.yaml
file and create a database with this name on your influxBD. After a restart, you get all Home Assistant
logs ready for use by Grafana. I am still struggling with my decision in
one area: Whether I will use Zigbee2MQTT or the native Home Assistant integration. It seems that the native integration supports
more and more devices, and zigbee2MQTT might no more be needed soon. My verdict: I like Home Assistant for dashboards
and integration and will roll it out over time to my smartphone and a tablet in the
kitchen to support daily decision-making. It is one of the best projects for the Raspberry
Pi, and they still develop features at high speed. And this is my biggest critics: Every time
you log into Home Assistant, you should update one or more components. The reasons often are minor, but the dependencies
are long. For me, this is not professional, mainly because
each update could have breaking changes. This adds a lot of overhead and removes time
I could use for other projects. I hope they will go a more professional route
and distinguish more between stable and beta releases. Most of us do not need more than two stable
releases per year. Then, the add-on and integration developers
could also stick to this schedule, and all components could be tested before release. Only critical bug fixes could be released
once every month. Like that, I would only get the absolutely
needed updates in the list. What is still open? I want to use the Energy function of Home
Assistant. Unfortunately, my Huawei inverter is not yet
integrated, and I am not sure I understand or agree with how Home Assistant works with
power and energy. Look at this essential diagram. It shows the power flow and should be in kW
like in the one from Huawei. But they decided to use kWh, which is wrong
because it depicts a momentary situation. Because of these strange decisions, so far,
I could not get good power and energy values into Home Assistant. That is the next frontier because it will
be the basis for future energy optimization. I also have a complex method implemented in
Node-Red to read the Modbus data from my inverter. There are several projects which should provide
a proper integration into Home Assistant. So far, this is also a work in progress for
me. And, of course, making functional and good-looking
dashboards is a never-ending story. Here, I have a lot of improvement. Currently, I only use a rudimentary version
of Dwain's Dashboard. That was all for today. As always, you find all the relevant links
in the description. I hope this video was useful or at least interesting
for you. If true, please consider supporting the channel
to secure its future existence. Thank you! Bye