I’m trying to have well organized automation files. For example in the /config directory I would like to have config/automations/light_automations.yaml and include that in /config/automations.yaml.
Here is an example of the automations.yaml I want but does not work:
# Main automations file
# Include other automation files from a subdirectory
!include_dir_list automations/
# Include light automations
!include automations/light_automations.yaml
# Other categories can be included similarly
# !include notify.yaml
# !include climate.yaml
The following links to an example that shows how to set up configuration.yaml to properly merge both automations.yaml and a directory you can manually manage: Splitting up the configuration - Home Assistant
The first one allows the automation editor to work. I’ll sometimes use that to start building an automation.
Once I have that, I’ll move it to my_automations.yaml. Now I can format it the way I want, make changes and add comments without having the editor change it all back.
Presumably, you could add other lines and organize your automations into multiple files:
Or if you want different yaml files for different automations all included from an automations directory you do this:
# only used for GUI automations
automation: !include automations.yaml
# All of my yaml automations go here in this directory
automation yaml: !include_dir_merge_list automations/