Although version by version of Home Assistant there is a growing tendency for everything to be integrated in a visual way and therefore any user without programming knowledge can use and configure Home Assistant, the reality is that even today it is necessary to touch certain files to configure some of the most used parameters and to have advanced control of the system.
My recommendation is to try to move everything to manual YAML configuration files when possible. We ensure more centralized management, being able to back up simply by copying the file or its content, and being able to share settings with other users easily and securely.
As a counterpoint, in many cases the option to perform visual configuration of the parts that are passed to YAML is lost.
The language used to perform most configurations is YAML. The first step is to learn how to use the language, and there is nothing better than the official specification sheet for this.
On the other hand, we need a method to edit the YAML files that are on our server. In the article “configure Home Assistant editing its files” you can see how to install the Add-on Configurator and how to start editing files.
Configurations to YAML
Entering a slightly more swampy terrain, we find different types of parameters, different places where these parameters are saved and various methods of passing all Home Assistant settings to YAML files. In parts, we will see how the different options that we have already been able to edit visually behave:
Automations. The automations are saved directly to the root folder in the
automations.yamlfile. It can be edited to create our automations or use the visual editor. The difference is that by editing the file you can create much more powerful automations, however, they cannot be edited later in the visual mode. You need to include the following line in
automation: !include automations.yaml
Scripts. Similarly, the scripts are already saved by default in the file
scripts.yamlin the root configuration folder, and can be edited. You need to include the following line in
script: !include scripts.yaml
Customizations. More of the same.
customize.yamlfile. You need to include the following lines in
homeassistant: customize: !include customize.yaml
Areas. It is NOT possible to declare them (and almost use them) in any YAML file..
Integrations. It depends. Some integrations are ready to be included in
configuration.yaml, others need to make use of the Configuration -> Integrations section, and there is no way to move them to a YAML file. Check the documentation for each integration to see when it can be moved to YAML and when it cannot. For example, OpenWeatherMap is an integration that can be easily moved to YAML; ESPHome, cannot be moved at this time. My recommendation is to try to configure all integrations via YAML that allow this.
- Persons and Users.
- Users can NOT be moved to YAML, they are system users and can be created from the* Configuration -> Users* section. They are used to identify each individual who can use the system.
Person are entities that associate each user with different device trackers to indicate their position. These entities can be declared in Configuration -> Persons or in the
configuration.yamlfile just like any other entity.
person: - name: Dani id: dani user_id: 68fa5522b25e4f719fdfe20a398f508e device_trackers: 
General Setup. Home Assistant has general information such as the name of the house or its GPS position. It can be configured visually from Configuration -> General. But also via YAML with the following lines within the
homeassistant: name: My Home latitude: 40.4167511 longitude: -3.7036432 elevation: 500 unit_system: metric time_zone: Europe/Madrid
It is highly recommended to move the latitude, longitude and elevation data to the
You can check GPS positions and elevations on websites like CalcMaps.
- Lovelace. Moving all dashboard configuration to YAML is not complicated, but once moved, all interface modifications will always have to be done in YAML. Therefore, we are going to leave the whole Lovelace part for another article, so that we can extensively develop the different interface editing modes and their advantages and disadvantages.
By moving all the options to YAML you get a better organization of all the configurations of our system, as well as an ease of backup, and speaking of security. Now you can use the
secrets.yaml file and have your sensitive data located in one file, allowing you to share your settings without worrying.
We only need to move the Lovelace part, which will be seen in another article.
This and other articles complement the documentation of the GitHub repository where all the configuration of my house is available.