Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wait_for_trigger does not catch event trigger in trigger-based template action block #138892

Open
dbsdbs93 opened this issue Feb 20, 2025 · 0 comments

Comments

@dbsdbs93
Copy link

The problem

The title pretty much sums it up, as does the YAML test case I'm attaching.

I am able to use wait_for_trigger in scripts and in automations to wait for an event using the "event" platform. But the same exact code fails when it's in the action block of a trigger-based template sensor; given a timeout, it simply times out despite the event occurring.

What version of Home Assistant Core has the issue?

core-2025.1.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

I am actually not sure what integration is responsible for the action blocks; there is no "this" object and no entity that I can find that corresponds to the action block, as opposed to individual sensors.

Link to integration documentation on our website

https://www.home-assistant.io/docs/scripts/#wait-for-a-trigger

Diagnostics information

No response

Example YAML snippet

- trigger:
    - platform:     event
      event_type:   bugtest_event
  action:

    - action:         system_log.write
      data:
        logger:       "bugtest_logger"
        message:      "Template action block triggered on first bugtest_event.  Now waiting for second."

    - wait_for_trigger:
      - platform:     event
        event_type:   bugtest_event
      timeout:            
        seconds:                15

    - if:             " {{ not wait.completed }} "
      then:
      - action:         system_log.write
        data:
          logger:       "bugtest_logger"
          message:      "wait_for_trigger timed out."
              
      else:
        - action:     script.dt_info
          data:
            memo:     "Second bugtest_event received. wait.completed = '{{wait.completed}}'"

Anything in the logs that might be useful for us?

Additional information

I am happy to provide further information. What I've put here is my best attempt to tersely and precisely describe the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant