Update Packages folder - simplify (#27176)

* Update Packages folder - simplify

Replacement/simplification of point I was trying to make in #26320. Not sure what happend to that one, I might have cocked up something so it got stuck;)

have tried to simplify;
- removed the option for !include_dir_merge_named from origninal doc, so now this is all about !include_dir_named
- added info on this way of including keep indentation "as if written in configuration.yaml"

The purpose of this PR is to be able to refer to documentation when urging people to use "packages-folders with the indentation of configuration.yaml" 

Currently I've seen several examples where they have read the documentation and set up with !include_dir_merge_named and having to keep up with different indentation than most examples that can be found in communities etc.

* Update source/_docs/configuration/packages.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update source/_docs/configuration/packages.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update source/_docs/configuration/packages.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update source/_docs/configuration/packages.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update packages.markdown

added just a '  :)

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Arve 2023-06-19 08:21:02 +02:00 committed by GitHub
parent cd254959d3
commit b2e7272db9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,34 +74,17 @@ Integrations inside packages can only specify platform entries using configurati
## Create a packages folder
One way to organize packages is to create a folder named "packages" in your Home Assistant configuration directory. In the packages directory you can store any number of packages in a YAML file. This entry in your `configuration.yaml` will load all packages:
One way to organize packages is to create a folder named "packages" in your Home Assistant configuration directory. In the packages directory, you can store any number of packages in a YAML file. This entry in your `configuration.yaml` will load all YAML-files in this _packages_ folder and its subfolders:
```yaml
homeassistant:
packages: !include_dir_named packages
```
This uses the concept splitting the configuration and will include all files in a directory with the keys representing the filenames.
See the documentation about [splitting the configuration](/docs/configuration/splitting_configuration/) for more information about `!include_dir_named` and other include statements that might be helpful. The benefit of this approach is to pull all configurations required to integrate a system, into one file, rather than across several.
The following example allows to have subfolders in the `packages` folder, which could make managing multiple packages easier by grouping:
```yaml
homeassistant:
packages: !include_dir_merge_named packages/
```
and in `packages/subsystem1/functionality1.yaml`:
```yaml
subsystem1_functionality1:
input_boolean:
...
binary_sensor:
...
automation:
```
The benefit of this approach is to pull all configurations required to integrate a system into one file&mdash;rather than keeping them spread across several files.
You can use other `!include` methods for packages; for example `!include_dir_merge_named`. However, unlike `!include_dir_merge_named`, the `!include_dir_named` method uses the same indentation as the 'configuration.yaml'. This means that you can copy and paste elements from the config file. With `!include_dir_named`, the file name is used as the package name. File names must be unique.
With the `!include_dir_merge_named` method, the package name has to be included in the file. The configuration below then needs to be indented accordingly. This means you cannot directly copy and paste from the configuration file.
## Customizing entities with packages
It is possible to [customize entities](/docs/configuration/customizing-devices/) within packages. Just create your customization entries under: