Service_template and Automation Editor

Tags: #<Tag:0x00007f7c5a5cf750>

I think I understand the reason to use data_templates and service_templates and I know what I want to achieve, but I simply can’t understand how to put that into the automation editor, either using the UI or YAML modes.
I am trying to do the simplest of things, run one of two scripts depending on the state of a switch. I’ve been Googling and YouTubing for hours but simply can’t get it to work.
This was my last pathetic attempt:

I have had success with service/data_template combination. From the actions section in the automation editor choose the dots menu and Edit as YAML. Save your edits. This should work.

To test it, you can also first try to edit the automations.yaml file and than access that through the UI.

1 Like

you can’t have service_template and service. It’s one or the other.

1 Like

Hey, thanks guys, it’s now working, I’m so happy!
In case it helps anyone else here is what I ended up with.
It was an embarrassingly simple task, but I just couldn’t get the syntax right or find any working examples on the web.
In the UI it says “Unsupported action” and I guess that’s why you can’t switch between UI & YAML.
The other issue that didn’t help me was when I tried to write directly into my automations.yaml file and add comments and blank lines to help me understand what was supposed to be happening, every time I opened the automation’s editor in the UI, it stripped out all my comments.