Please format code properly: either surround with three backticks or use the </> button. See here: How to help us help you - or How to ask a good question
Personally, I have nearly all of my automations in manually-edited YAML files. Top of my configuration.yaml looks like this:
default_config:
automation: !include automations.yaml
automation manual: !include_dir_merge_list automations
…and my automations are then in YAML files under the automations folder. For example, automations/lights/hall-on.yaml starts:
- alias: Lights - hall lamp on
description: >-
Turns the hall light on if the house is occupied and it gets dark enough,
or if the house is unoccupied and the sun goes below the horizon.
I can also use the UI for quick and simple automations, which the system stores in automations.yaml.
I’m an experienced Linux user with HA running in a Docker container on my NAS, so I use ssh and vim to create and edit my files.