[wait_for_trigger] is an invalid option for [script]

I tried to put the example that appears in “Script Syntax” docs, and .log returns me this error in Scripts.yaml : “[wait_for_trigger] is an invalid option for [script].”

new:
  alias: "Wait for MY_EVENT or light on"
  wait_for_trigger:
    - platform: event
      event_type: MY_EVENT
    - platform: state
      entity_id: light.LIGHT
      to: "on"
      for: 10

where i am wrong?

my HA: 0.98.5

you’re missing a part of the script syntax.

from an example in the docs:

# Example script integration containing script syntax
script:
  example_script:
    sequence:
      # This is written using the Script Syntax
      - alias: "Turn on ceiling light"
        service: light.turn_on
        target:
          entity_id: light.ceiling
.
.

you need “sequence:”

now says: [target] is an invalid option for [script]

new:
  alias: "newscript"
  sequence:
    service: light.turn_on
    target:
      entity_id: light.ceiling
    wait_for_trigger:
      - platform: event
        event_type: MY_EVENT
      - platform: state
        entity_id: light.LIGHT
        to: "on"
        for: 10

if i delete “target”:
"[wait_for_trigger] is an invalid…

your service calls need to be separated into lists:

new:
  alias: "newscript"
  sequence:
    - service: light.turn_on
      target:
        entity_id: light.ceiling
    - wait_for_trigger:
        - platform: event
          event_type: MY_EVENT
        - platform: state
          entity_id: light.LIGHT
          to: "on"
          for: 10

Invalid config for [script]: [target] is an invalid option for [script]. Check: script->script->new->sequence->0->target

the same problem persist, i dont know why indicates 2 times “script”

We need to see more of where this script is located. Post the script as it appears with the other things before and after it.

it is located at the top at scripts.yaml file, with other scripts which was working.

new:
  alias: "newscript"
  sequence:
    - service: light.turn_on
      target:
        entity_id: light.ceiling
    - wait_for_trigger:
        - platform: event
          event_type: MY_EVENT
        - platform: state
          entity_id: light.LIGHT
          to: "on"
          for: 10

reiniciar:
  alias: "Reiniciar HA"
  sequence:
  - service: homeassistant.restart

############# script bombas
bombacaseto:
  alias: "Bomba Caseto"
  sequence:
  - service: switch.turn_on
    entity_id: switch.bomba_caseto
  - delay: '00:01:00'
  - service: script.bombacasetoposponer

and more much more… :face_with_raised_eyebrow:

i already tried to put lines after “sequence” in the same column like scripts above

You’re using an ancient version of Home Assistant. It doesn’t support target or wait_for_trigger.

The documentation always represents what can be done with the latest version of Home Assistant. Unless you upgrade, you will continually encounter the problem of your system failing to support functionality described in the documentation.


EDIT

wait_for_trigger was introduced in version 0.115 in September 2020.

2 Likes

yeah, thank you, now is working well :wink:

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.