Good morning,
I am working in YAML mode and I have a problem with the automation file configuration. Inside the configuration.yaml file I have inserted the line
automation:! Include automations.yaml
in order to insert the automations in a single file. The problem is that for my clarity I had inserted particular formatting and comments in the automation file, but every time I go to reopen it all my comments and formatting has disappeared. It is likely that HA prioritizes automations entered via UI and overwrites existing ones in my file, but setting the YAML mode shouldn’t it do the opposite and leave me my formatting? Is there any way to solve the problem?
Thanks in advance.
The first is used by the UI and any mods you make will be lost because it is intended to be for the ui only. The second line is a directory with all my (yaml) automations with each automation being a single file. Easiest way to keep thinhgs separate and manageable.
Well, but if I want to modify an automation is it sufficient to modify the single file or I have to make the modification anyway on the main file automations.yaml? How to split automations? File names?
Thank you.
@raoul
Dont touch the file of the first include. Modify individual yaml files in the automation directory. In my case I have a couple of sub-directories, with further sub directories like automations/areas/living/ and there are individual yaml files for the various automation I have in the living room. PS filename becomes rule name in the ui and you will not be able to edit them in the UI.
@mtrista Of course you can, instead of using include_dir_list you can use a simple include as long as the file name is not the same as the first include. Refer to include logic of the documentation on how to use it: [Advanced configuration - splitting up the configuration (https://www.home-assistant.io/docs/configuration/splitting_configuration/)
where manual after automation is any alias you want. Now I can add new automations from the UI without Home Assistant “fixing” the formatting of my existing manual automations that I moved into automations_manual.yaml.