Script: using template to pick entity_id not working (Got None error)

I’ve been working on this script for a few hours now on what seems to be a simple ask in deciding which other script to run depending on a boolean value. I’ve been following this example and also other writing but it’s not working. Please help me with another set of eyes.

(the script is called by an automation and if I hard code in the entity_id it works just fine, but if I use the IF statement to determine the entity_id, the log keeps reporting “…got none…” (see below).

Script text:

text_notify_handler:
  sequence:
  - service: script.turn_on
    entity_id: >
      {% if is_state('input_boolean.send_everywhere', 'off') %}
        script.text_notify_to_chuck
      {% else %}
        script.text_notify_to_group
      {% endif %}
    data:
      variables:
        text_input: "{{ text_to_send }}"

Log output when trying to load it:

2021-05-29 12:21:36 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: not a valid value for dictionary value @ data['sequence'][0]['entity_id']. Got None. (See /config/configuration.yaml, line 13). 

When I test it in the Developer Tool template screen it seems to work just fine. I must be missing something in my understanding of the syntax of YAML phrasing.

Screenshot from template test tool

1 Like

Apparently this little word is important…

Through my many iterations of syntax arranging (again and again and again), I must have it at some point and forgot to replace it. Anyway that was the answer in case others run into a similar thing.

image

3 Likes