Left Open Automation

how do you clear an ongoing alert after it has fired and the entity state returns to non alert state for instance i have this

service: notify.mobile_app_my_mobo
data:
title: Door Alert
message: >-
{{ trigger.to_state.attributes.friendly_name | replace(“sensor”,"") }} has
been left open for 30 mins!
data:
ttl: 0
priority: high
channel: alarm_stream

I would like if after this trigger has fired if the door is closed again the mobile notification should stop and clear off

That’s a point I’m also struggling with. So if there is any suggestion I would be very grateful for.

If youre using the Mobile App, you can use Clear and using Tags:

Hi,

I have this automation to notify me at 10 and 20 minutes. What can I do so it plays a different sound at 20 Minutes?

- id: 'Window'
  trigger:
    - platform: state
      entity_id: binary_sensor.window
      to: 'on'
      for: '00:10:00'
    - platform: state
      entity_id: binary_sensor.window
      to: 'on'
      for: '00:20:00'
  action:
    - service: media_player.play_media
      data:
        entity_id: media_player.mpd
        media_content_id: http://HA:8123/local/sounds/Window.mp3
        media_content_type: audio/mp3

Add an id to each trigger and give each one the name of the sound file you wish to play.

For example, let’s say the sound file you wish to play at 10 minutes is called window.mp3 and the file at 20 minutes is alert.mp3.

- id: 'Window'
  trigger:
    - id: 'window'
      platform: state
      entity_id: binary_sensor.window
      to: 'on'
      for: '00:10:00'
    - id: 'alert'
      platform: state
      entity_id: binary_sensor.window
      to: 'on'
      for: '00:20:00'
  action:
    - service: media_player.play_media
      target:
        entity_id: media_player.mpd
      data:
        media_content_id: 'http://HA:8123/local/sounds/{{ trigger.id }}.mp3'
        media_content_type: audio/mp3

Ah, cool. That Feature did not exist when I created that Automation :smiley:
Thanks alot :slight_smile: