(the way to) adding automation, templates, sensors, etc

I have been using Home Assistant for several years now. Until recently I only used some simple Automations, which I created via the Visual Editor. Now that I want to take care of some more advanced matters, I regularly see an error message that the Visual Editor does not support the syntax. Also, the error message of an error in the code (during a Save) sometimes persists, even though the (typing) error has already been resolved. Looks like the Editor gets stuck in auto formatting and guessing what I probably wanted to type…

I’m now leaning towards inserting/editing directly into the designated .YAML documents. However, I now wonder how others approach this. If I add an Automation directly in the Automations.yaml, it does not appear to be visible in the Automations overview under the Device.
Do you create basic automation using: the Visual Editor and then adjust it via, for example, the File Editor (in order to maintain a relationship with the device and have the Entity automatically filled)?
Or do you not value this?
the downside to the File Editor in my opinion is that there doesn’t seem to be any autocomplete.

I don’t really value it but…

All my automations are written in yaml and they show up on the devices they use.

Are you giving your automations a unique_id?

1 Like

Don’t add it to automations.yaml. I believe if you do that then the system reformats the code in that file to be consistent with the UI editor entries.

you should create another automations folder (call it ‘automations_manual’ or something). then reference that folder in your configuration.yaml file.

here’s mine as an example:

## only used for the testing of the GUI editors
automation: !include automations.yaml

## All of my regular automations go here
automation manual: !include_dir_merge_list automations_manual/

then you can create yaml files for different automations under that folder and they get read in just like the ones created via the UI…

but as also noted above you should give all of your manually created automations an ‘id:’ so they show in the automations list for traces etc). You don’t have to (and I don’t always myself) but it does help if you are trying to debug them.

1 Like

Do the automations you do not give an id to show up in the automations list on the device page that the automation uses?

Yes, and if you click on it you get:

EDIT: Misunderstood the question, they show up and are clickable in the list for the Automation editor.


Hmm. Ok then ignore my first post above. That’s not the reason then. Thanks.

Edit: and @Rene2322 for autocomplete use the VSCode addon. It’s a much better editor and comes with a helper extension specifically for home assistant. It will allow you to select mdi icons visually too.

yeah they show up on the device page listing but they are greyed out and can’t be accessed from there.

1 Like

I think I misinterpreted some things. When I changed a device name of an active automation, I probably broke some links, causing things to temporarily stop functioning.
I can confirm that when I now (as a test) create an automation in automation.yaml, it also becomes visible in the overview of the device in question.

Thanks for the tip about the VSCode addon. I will try this weekend.

Lastly, i’ve read that you can divide the automations, sensors and the like into a virtually endless amount of separate yaml files (refer to it in configurations.yaml).
As long as my home automation is still so limited, it seemed pointless to me to set up an advanced structure for this now.
From @finity response I think I understand that it is unwise to just use the predefined yamls.