Wait_for_trigger automation never continues despite being true

Any ideas what I’m doing wrong? Tried without continue on timeout, without for: 00:00:01 as well

continue_on_timeout: true is worthless if you haven’t specified a timeout. If you didn’t provide a value for timeout then it uses the trigger(s) exclusively.

You’re using a Numeric State Trigger which will trigger only when the battery_level increases and crosses the threshold value of 25. According to the trace, it’s currently 63 so it won’t trigger (because it already exceeds the threshold value).

The only way that will trigger is when the battery_level is below 25 and increases above 25.

If that doesn’t answer your question, post the entire automation so we can understand what you are trying to accomplish.

I encountered a similar issue with an automation to turn off lights when there is no more motion, where I was also struggling to use wait_for_trigger because motion was already off. I solved this by adding an if statement to first verify the condition/state and move the wait to the else clause. Probably not the cleanest solution but it works.

principle:

if 
  value = off
then 
  do action 
else 
  wait_for_trigger 
    to: off
  do action

actual config:

action:
  - if:
      - condition: state
        entity_id: group.motion_sensors
        state: "off"
        for:
          seconds: 0
    then:
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.mylight_on_off
    else:
      - wait_for_trigger:
          - platform: state
            entity_id:
              - group.motion_sensors
            to: "off"
            for:
              seconds: 1
        continue_on_timeout: false
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.my_light_on_off
mode: single

If group.motion_sensors is off, turn off the light. Otherwise wait for the group to turn off then turn off the light. If it doesn’t turn off within a minute, the automation ends.

action:
  - wait_template: "{{ is_state('group.motion_sensors', 'off') }}"
    timeout: '00:01:00'
    continue_on_timeout: false
  - service: light.turn_off
    target:
      entity_id: light.mylight_on_off
2 Likes