Template not supported Yaml editor in automation

Hi, I’m only 2 weeks into HA, so please be patient with me.
The Problem:

Have i done something wrong here? when I tested in developer tools I get the correct outputs.
I have read somewhere that its a support feature in the automation editor.
My question is how can i fix this, is there a workaround and what is it the editor does not like here.

I have the latest update dec 2021 HA on a Pi4 b.

Any input will be helpful in trouble shooting this, thank you.

The yellow box is just an warning that the GUI editor does not support templating, so it reverts to YAML mode. This is how it is suppose to work.

The automation looks fine, it should work i believe.

Thanks for your reply,
Unfortunately, the automation doesn’t work for me, hence why I believed I was doing something wrong here.
I’ll keep reading and trying to figure it out. please see the code below.

  action:
    service: frontend.set_theme
    data:
      name: >
        {% set name = states("input_select.theme") -%}
        {% set suffix = "-alternative" if is_state("input_boolean.theme_alternative", "on") else "" -%}
        ios-{{ name }}{{ suffix }}
      mode: >
        {{ "dark" if is_state("input_boolean.dark_mode", "on") else "light" }}

Should be able to to see the errors in the home assistant logs.

On mobile so its hard to write code, but se below, i believe this should fix it, you left some - in there at the wrong place.

action:
  - service: frontend.set_theme
    data:
      name: >-
        {% set name = states("input_select.theme") -%}
        {% set suffix = "-alternative" if is_state("input_boolean.theme_alternative", "on") else "" %}
        ios-{{ name }}{{ suffix }}
      mode: >-
        {{ "dark" if is_state("input_boolean.dark_mode", "on") else "light" }}

Ah you’re right didn’t occur to me I should check there, so it seems like HA cant find the files, not sure what I did wrong, will look into it tomorrow now.

I appreciate your help. Thank you.

Will keep you and everyone else that reads this updated.

1 Like