My first blueprint gives "not a valid value" data['sequence'][0]['entity_id']

I’ve tried the usual iterations, but keep hitting that same wall.

blueprint:
  domain: script
  name: Toggle switch_entity, with support for spinner
  author: cvonk
  homeassistant:
    min_version: 2023.8.0
  # source_url:
  description: >
    Toggles a switch.  While waiting for the state change, it sets
    the `pending_entity` to true. The latter can use to e.g. 
    control the visibility of a spinner element. 

    E.g. 
    switch_entity: switch.opnpool_aux2_circuit
    pending_entity: input_boolean.opnpool_aux2_circuit_pending

  input:
    switch_entity:
      name: Switch entity
      description: >
        The switch that you want to toggle
      selector:
        entity:
          domain: switch
    pending_entity:
      name: Helper input_boolean
      description: >
        True when a state change is requested, but didn't happen yet.
        You need to create this helper.
      selector:
        entity:
          domain: input_boolean

variables:
  switch_entity_var: !input switch_entity
  pending_entity_var: !input pending_entity

sequence:
  - action: input_boolean.turn_on
    entity_id: !input pending_entity
  - variables:
      current_state: "{{ states(switch_entity_var) }}"
  - action: switch.toggle
    entity_id: !input switch_entity
  - wait_template: "{{ states(switch_entity_var) != current_state }}"
    timeout: 20 # Optional timeout in seconds
  - action: input_boolean.turn_off
    entity_id: !input pending_entity

icon: mdi:script
mode: queued
max: 10

Thanks for your time,
/c

You’re missing the target key in the first action as well as the third and fifth actions.

https://www.home-assistant.io/integrations/input_boolean/#automation-examples

As the error states, entity_id is not valid at that level, it needs to be under target.

Thank you @Didgeridrew

I missed this, because the sequence section is a verbatim copy of my script. Somehow, the script was more forgiving.

Time to read up on those error messages.
/c