Cancel delay in Automation Action

Hi,
is there a way to stop the delay and drop action after?

example:

  - alias: Kueche Fenster offen iOS
    trigger:
      - platform: state
        entity_id: group.Fensterkontakt_Kueche
        to: 'on'
    action:
      - delay: "00:{{ states.sensor.window_timer.state | int }}:00"
      - service: notify.ios_iphonesk
        data:
          title: "Küche Fenster {{relative_time(states.group.Fensterkontakt_Kueche.last_changed).replace('hours','h').replace('minutes','min').replace('seconds','sek')}} geöffnet!"
          message: "Die Temperatur im Küche beträgt: {{states.climate.kuche.attributes.current_temperature}}° 
          \r\nund die Luftfeuchtigkeit: {{states.sensor.kuche_humidity.state}}%"
          data:
            push:
              badge: 0
              category: "reminder_kueche"

normal: you open the window and you get a push notification after a time
but if you close the window it should stop and no message should appear.
So Action musst be aborded.

thanks for help

Steve

Add a condition after the delay that checks the state of the window.
The automation will only continue if the condition is true.

action:
      - delay: "00:{{ states.sensor.window_timer.state | int }}:00"
      - condition: state
        entity_id: sensor.your_window_sensor
        state: 'open'
      - service: notify.ios_iphonesk
        data:
          title: "Küche Fenster {{relative_time(states.group.Fensterkontakt_Kueche.last_changed).replace('hours','h').replace('minutes','min').replace('seconds','sek')}} geöffnet!"
          message: "Die Temperatur im Küche beträgt: {{states.climate.kuche.attributes.current_temperature}}° 
          \r\nund die Luftfeuchtigkeit: {{states.sensor.kuche_humidity.state}}%"
          data:
            push:
              badge: 0
              category: "reminder_kueche"
2 Likes

cool thanks
I didn’t know that this is possible