Automation file split with gui edit

Hey guys,
I finally decided to make the jump and start splitting my config files.
First thing I wanted to do is to split the automation file into multiple yaml files.
I used the !include_dir_merge_list instruction to provide a folder where all automation files will reside, but I noticed it doesn’t give me the ability to edit in the gui when I do that. I saw in some post that home assistant gui doesn’t work when you have your yaml files inside folders. So I decided I would just specify 2 automation locations like this:

automation: !include_dir_merge_list misc/automation/
automation: !include automations.yaml

I figured I will use the automations.yaml for the automation that will be editable in the gui, and the folder for the yaml automation files that is not editable in the gui. But when I did that it looks like it disabled all automations I have. It’s llisted in the gui but looks disabled.

Any idea how to achieve this?
Thanks for any helps with this.

Here is a bit of my config files which details what you are looking to do:

# ******************************************************************************
#    Included Files
# ******************************************************************************
#
alarm_control_panel: !include includes/alarm_cp.yaml
# next line is old way. turned off 11-06-2021
# automation: !include_dir_merge_list automations
automation manual: !include_dir_merge_list automations
automation ui: !include automations.yaml
# ^^ uses both the UI editor and YAML mode
binary_sensor: !include_dir_merge_list binary_sensors
camera: !include_dir_merge_list cameras
fan: !include includes/fans.yaml
group: !include_dir_merge_named groups

Hope this helps.

4 Likes

Give your own automations a name, like this:

automation myfiles: !include_dir_merge_list misc/automation/
automation: !include automations.yaml
1 Like

Thank you guys, that helps a lot.
So If I understand, there is no way to put multiple automation files inside a folder and still use the UI. Right?

No, the UI only uses automations.yaml

I saw some talk about grouping automations recently but don’t know if anything has been done to implement it.

Thank you, I appreciate the response. Definetely it will be a great thing to add any automation file to the gui.

@Pedro1x
Pedro, my config file from yesterdays post shows how to use both the automations.yaml file for UI automations AND an automations folder in which you can have multiple files for clarity. All files become merged internally but this solution gives you the best of both options. See attached screenshot of my automations folder and files.

1 Like

Just to be clear: you can edit all your automations from the UI with that method?

I have exactly the same configuration as you:

automation manual: !include_dir_merge_list automations
automation ui: !include automations.yaml

What I see in the UI (I meant .yaml when I wrote .yml)

When trying to edit (with the pen idon at the very right of the line) the entry switch bureau single press (which corresponds to an entry in the file automations/lights.yaml), I get

image

This means:

Only automations in automations.yaml are modifiable

If I manually move the code from automations/lights.yaml to automations.yaml the entry becomes editable from the UI.

@WoJWoJ ,

No. My original response detailed HOW to split the automations between YAML and the UI editor. Only automations created in the UI can be modified there. Automations created in YAML are still edited in YAML. Yes, there are ways to move all your YAML automations to the UI, but personally I prefer to work in YAML. The UI editor is great if you don’t have a lot of automations/devices or don’t require advanced options. YAML offers much greater control of file structure, search ability including find & replace using Atom Editor and the use of includes. With 600+ sensors and a combined total over 700 scripts and automation, the UI editor just doesn’t have to tools or convenience necessary for my situation.

This is impressive :no_mouth:

I do not have nearly that number of automation and devices but I also prefer to work in YAML (as a developer, I am used to code) but was curious nevertheless.

Thanks for the follow-up after your last post 10 months ago :slightly_smiling_face:

@WoJWoJ

You’re welcome. Always trying to give back. I’ve learned a ton from this community.
Just for fun, paste the following code into a Markup Card or the template editor.

**Counters** 
{% set unique_domains = states | map(attribute='domain') |list | unique | list -%} 
{%- for domain in unique_domains -%} {{"\n"}}- {{domain}}
  {%- for item in states[domain]%}
  {%- if loop.first -%}
  : ({{loop.length}})
  {%- endif %}
  {%- endfor %}
{%- endfor -%} {{"\n"}}
2 Likes

:open_mouth:
I did not know I had so many sensors/switches/lights!!
Thanks for the Fun Fact!