Wait_for_trigger continues even when configured not to

Hello everyone,
I'm experiencing issues with my automation:

alias: Disabilita rilevamento scala quando famiglia è in casa
description: ""
triggers:
  - trigger: state
    entity_id:
      - group.famiglia
    from:
      - not_home
    to:
      - home
conditions: []
actions:
  - if:
      - condition: state
        entity_id: switch.scala_detect
        state:
          - "on"
    then:
      - wait_for_trigger:
          - trigger: state
            entity_id:
              - binary_sensor.videocitofono_portoncino_serratura_aperta
            from: null
            to:
              - "on"
        timeout:
          hours: 0
          minutes: 1
          seconds: 30
          milliseconds: 0
        continue_on_timeout: false
      - action: switch.turn_off
        metadata: {}
        target:
          entity_id: switch.scala_detect
        data: {}
      - action: script.telegram_notifica_su_chat_lorenzo
        metadata: {}
        data:
          titolo_field: Telecamera Scala
          messaggio_field: Rilevamento disabilitato! (Rientro a casa + sblocco serratura)
mode: parallel
max: 10

Even if continue_on_timeout is setted to false, the script continue after the timeout.

In the last trace I can see that wait_for_trigger triggers the timeout:

But by the way the script has continued the execution after the timeout (09:11:06 + 1min 30sec = 09:12:36):

And also, the lock was not opened in the meantime, but afterward:

Why this?

Thanks!

I created an automation similar to yours, and the wait_for_trigger action worked as intended, so I'm not sure what's happening with your automation. The only differences between your automation and the one I created are that I used mode: single instead of parallel, and because I don't have the same entities, I had to substitute mine for yours.

Why are you using mode: parallel for this automation? I would suggest changing it to mode: single to see if that makes a difference. Doing so would eliminate the possibility of multiple instances of the automation running simultaneously, which can sometimes cause unexpected behavior.

If that doesn't resolve the issue, I would leave it set to mode: single and continue troubleshooting by simplifying the automation to isolate the problem. I would start by removing both if-then actions and replacing them with something unrelated, such as toggling a light on and off.

The reason I suggest this is that I noticed you're using the state of switch.scala_detect as a condition of the if-then action and then changing its state as an action within it. I wonder if that's contributing to the issue, especially with the automation configured to run in parallel mode.

Download and post the json of a Trace when the automation continued when it should not have.