Why automation Editor change the yaml code?

Hi
I create an automation. It wasn’t work how I would like to. I changed the yaml file in the editor, and unfortunately changed the code back.
For example: trigger to triggers and cleared the comments #

What can I do that not change the program code?

Thx
Péter

If you are using the automation editor, it will strip comments and re-arrange stuff.

The Automation Editor uses the latest YAML scripting syntax. triggers indicates the section containing all Triggers. In the past, the section’s name was trigger.

The Automation Editor doesn’t support the use of YAML comments.

You can use a text editor, instead of the Automation Editor, to create automations. However, you have to instruct Home Assistant to keep your “manually created” automations separate from the ones you create with the Automation Editor.

For more information, refer to this example in the documentation for “Splitting up the configuration”.

1 Like

As @123 said, don’t mix manually-edited automations with GUI-edited automations.

In my configuration.yaml:

automation: !include gui/automations.yaml # this is only for GUI-Automations, do not touch this file!
automation manual: !include_dir_merge_list manual_automations/

You can put the automations.yaml file anywhere you want, just make sure the !include points to it.

All of my automations wind up in my manual_automations folder specifically to keep comments and to make human-readable -id: keys. It’s also easy to make separate yaml files for each automation.

You can also deploy yaml automations as packages:

Depending on how much and what kind of comments you need you can also use the description field as a placeholdes for comments.

Plus - alias: lines to simulate comments.