How to dismiss iOS notifications

I have an automation that sends a notification to my iPhone when the door is left unlocked. It looks like this:

- id: '2681711295789'
  alias: Front Door Lock Reminder
  description: Send a notification if the front door has been left unlocked for 5
    minutes.
  trigger:
  - entity_id: lock.front_door
    for: 00:05:00
    platform: state
    to: unlocked
  condition: []
  action:
  - data:
      message: The front door has been unlocked for 5 minutes.
      data:
        push:
          category: door
          sound: "front_door_unlocked.wav"
        apns_headers:
          'apns-collapse-id': 'front_door_unlocked'
    service: notify.mobile_app_my_iphone

The trouble is that I’d like to automatically dismiss that notification if the door is subsequently locked. I tried setting the message to delete_alert (which can be used to silently change the badge on HA icon), but it didn’t work. Any ideas on how I can dismiss a notification when the condition is no longer present?

Thanks in advance to whomever can help!

This is not possible with the iOS app currently. There’s a feature request for it here that you can add your support to.

Until that feature is added, I think the closest you can do at the moment is to send another notification with the same apns-collapse-id. So when the door is locked you could send a “Thank you for locking up!” notification and it will replace this one.

Thanks for letting me know! I made a couple comments that suggest it is possible, but not as easily as on Android (which is silly on Apple’s part, especially on such a mature OS).