I believe that you have successfully installed Home Assistant (HASS) and Homebridge from the previous installation. In this article, I will take you through your smart Home devices.

Most people are often confused when they first come into contact with HASS. The reason is that the configuration system of HASS is very chaotic, and a perfect access to a device requires multiple configuration files. In fact, the lack of clarity in the system architecture is one of HASS’s biggest drawbacks, so before I start the configuration tutorial, I’ll help you outline the configuration framework for HASS.

HASS configuration framework

The core configuration of HASS is built around configuration.yaml, where you can do basic configuration for time zones, units of measure, developer mode, theme selection, and more. Of course, most importantly, you will complete all device access in this file. That’s the focus of this tutorial.

The operation of HASS relies on relatively independent functional Components, such as Mijia platform, which can be regarded as a component. In some cases, some devices or features are not officially supported by HASS. You must create a custom component custom_Components folder in your home directory and add the relevant device support files.

With the above file modifications and HB configuration, you can control all your smart home devices.

However, after using it for a while, you might find the device too cluttered and want to change the style of the interface, or the configuration.yaml file might look like it’s about to explode. At this point, you might consider spinning off some of your configuration into a separate file to satisfy your obsessive-compulsive needs. For example, if you have Device Tracker enabled, HASS will automatically generate the “known_devices.yaml” file in the main file, where you will configure the devices to be tracked. This tutorial will cover that as well. As for theme Settings, group Settings and other non-functional Settings, I will cover them in more detail in “Personalization” later.

Main file Settings

Having opened the RASPberry PI SMB service in the previous tutorial, let’s now open the HASS home directory through SMB. (For macOS, enter “Shared” in the left pane of the FInder, and for Windows, enter “// Raspberry PI” in the Computer-Address bar.) Open configuration.yaml.

Homeassistant: # longitude latitude: 32.87336 longitude: 117.22743 # elevation elevation: 430 # Metric # Time_zone :Asia/Shanghai # System nickname, displayed at the top of the main screen Name: HomeCopy the code

Normally, the rest of it doesn’t need to be changed. Add the Yahoo Weather service now to try it out:

weather:
  - platform: yweather
    woeid:2151849
Copy the code

Woeid is the city code, which is the last few digits of the URL when you go to Yahoo Weather and type in the city

woeid

Save the Settings and restart HASS.

Congratulations, you have connected your first HASS component. Now you have a general idea of how HASS works. HASS supports thousands of smart home devices.

If you’re a Gohome user and need Homekit, we also need to go to Homebridge and set it up.


Homebridge set

Before executing the command, run Homebridge once. Note: If a startup task is added, do not run Homebridge repeatedly. Otherwise, a port occupation error will occur. If the version of homebridge-Homeassistant plugin is later than 2.3.0, pay special attention to add the last line of configuration, otherwise the device in the home APP will be empty.

cd /home/pi/.homebridge sudo nano config.json { "bridge": { "name": "Homebridge", "username": CC: say "D: E3: CE: 30", / / raspberry pie MAC address "port" : 51826, / / run port "pin" : "123-45-678" / / connection password, set}, "platforms" : [{" platform ": "HomeAssistant", "name": "HomeAssistant", "host": "http://127.0.0.1:8123", //HA run url, can be IP or domain "password": "Raspberry ", //HA api_password and password, if set, add "supported_types": ["automation", "binary_sensor", "climate", "cover", "device_tracker", "fan", "group", "input_boolean", "light", "lock", "Media_player ", "remote", "scene", "sensor", "switch"], "default_visibility": "visible"}]}Copy the code

CTRL +x, y, enter. Then clear Homebridge’s cache:

sudo rm -rf /home/pi/.homebridge/persist/
Copy the code

Please remember this instruction. In the future, if the iOS device cannot recognize the new device or raspberry PI due to the reconfiguration of HA and HB, most cases can be solved by this instruction.

Now that we’re done setting up Homebridge, restart Homebridge:

sudo systemctl restart homebridge
Copy the code

With the above Settings, I’m confident that your smart home device is stable in HA and HB, so now you can try using Siri to control your device.


Two dogs fight?

In previous installments, we learned that Homebridge itself can plug smart devices into the Apple Home platform by installing plug-ins. Sometimes devices support both HA and Apple Homekit, and we are faced with a platform choice.

First of all, this is only a problem for iOS and future macOS users, because you can only be happy if you can use Siri. For users of other terminal systems, either with the device manufacturer’s APP battle wits, or enjoy the pleasure of HA web control, as for voice control, it will have to wait.

Second, take Mi Jia device as an example, as a gateway, HA can control the night light function, obtain light sensing data, Homekit can not; For the sweeping robot, the access method of HASS is very complex, and at the present stage, it can only realize the switch function, while the installation and configuration of HB plug-in is easier, and can control the suction force…… It can be said that there is no absolute winner between the two platforms, both need to be analyzed on a case-by-case basis. In my opinion, HA supports devices better in most cases and is faster to follow based on community support.

Here again remind beginners: you must choose one of the two, please access the same device through a platform, otherwise there will be conflicts without “custom Settings”.


For pai friends who have already connected the device through HB but want to transfer to HA platform, the following compatibility schemes are provided:

  1. Access related devices in HA, see above.
  2. On the sidebar of the HA home page, click <> to obtain the Entity ID of the device:


    The States panel
  3. In the HAconfiguration.yamlAdd the following Settings to the configuration file:


    Device personalization


    The device will be hidden in Homebridge and will not be repeatedly identified and added by the home App after the restart.

    At this point, you can control the device through both The Apple Homekit and Hass platforms.


Device tracking Settings

HA can track the networking status of Intranet devices in the same router. If we change our thinking, we can use this system to judge whether family members are at home, which is very convenient.

Family tracking

My router is ASUS AC66U-B1. HASS supports most brands of routers, including Xiaomi Router and TP-Link. Different routers have different configuration methods. For details, please visit the official website. You need to enable the SSH mode of the router before setting it. Please set your password to protect data security. It is recommended that only LAN users have SSH permission.

Open the configuration.yaml file and add:

Device_tracker: -platform: asuswrt (On-demand, Xiaomi is xiaomi, Netgear is Netgear, tP-link is tplink) host: 192.168.xx.1 # router Ip username: ***** # administrator account password: ****** # administrator password track_new_devices: no # Whether to automatically add new devicesCopy the code

Not surprisingly, when you restart HASS, the known_devices.yaml file is automatically generated in the main folder, and when you open it, you will see that the system has automatically added default configuration for the devices that are sniffed connected to the router:

MAC: EA:AA:55:E7:C6:94 # MAC address picture: https://home-assistant.io/images/favicon-192x192.png # image icon: mdi: human - getting # icon, and take a picture set track: Yes # whether to track hide_IF_AWAY: no # Whether to automatically hide after leavingCopy the code

In the next tutorial, I will show you how to automate configuration, truly implement ARTIFICIAL intelligence, get rid of remote control, change themes, show personality, set up simple and elegant control panel and much more

HADashboard



Read on for the rest of the series:

Xiaomi Devices Special:

Personalized Configuration:


Update log

  • 09.28 Modifying HB Configurations;
  • 08.27 Release “Q&A”, open Q&A, HA latest version 0.52.0;
  • 08.22 Modified the Configuration with Homebridge-Homeassistant V2.3.0.
  • 08.08 Close the comment section;
  • 08.05 Changing config. Json Setting path Added deleting HB Cache method.

The author’s words

It’s been almost six months since I published the first article in this series, and there are now 10 tutorials in the series. Not coincidentally, JailbreakHum’s “tweaking of content” approach in his Minority Quarter Author Awards opening remarks is exactly what I wanted to do. From the very beginning, I tried to keep the content of the whole series as introductory as possible, and also helped many pai friends successfully build systems in reality.

During the interaction with pai Friends, I realized that due to the limitation of English proficiency, many people cannot further enjoy the convenience brought by Home Assistant. In view of this, I have independently produced a more down-to-earth Chinese document, which is still in the embryonic stage and is still working fast. I hope it can help more people. Welcome to read and collect it.

A good experience requires good interaction. In order to keep the page clean, please do not post a whole section of error code in the comments section below all articles in this series. If you have any questions, please go to the “maintenance q&A” section for centralized comments.