Snooze Home Assistant Doorstep Alerts for One or Four Hours

Watch on YouTube ↗Get the code ↗Explore the gear →

When we’re unloading the car, I want the first picture of someone reaching the door. I can hold that notification on my iPhone and quiet repeat alerts for one or four hours. The camera keeps recording while both phones are quiet.

Snooze Home Assistant Doorstep Alerts for One or Four Hours

Give each button its own action

Create the timer helper timer.front_door_alert_snooze, or use this timer definition in a package.

timer:
  front_door_alert_snooze:
    name: Doorstep Alerts Snooze
    icon: mdi:bell-sleep
    duration: '01:00:00'
    restore: true

In an automation that already sends a push, place the actions in the inner data block. Replace the example notify service with the name for your own phone. This minimal push is enough to try both buttons. The production version also attaches the doorstep picture and a link to the recorded visit.

action: notify.mobile_app_your_phone
data:
  message: "A person reached the doorstep."
  data:
    actions:
      - title: Snooze 1 hour
        action: SNOOZE_DOORSTEP_ALERTS_1H
      - title: Snooze 4 hours
        action: SNOOZE_DOORSTEP_ALERTS_4H

My shared notification script builds that list from two title and action pairs. The title is what you read. The uppercase action string is what the phone sends when you tap.

Match the tap and start the timer

The two triggers below listen for the same mobile app event. The one that matches supplies its own duration through its trigger ID. This is the automation entry from my package, underneath its automation: list.

- alias: 'Front Door - Snooze alerts from notification'
  id: front_door_snooze_alerts_from_notification
  mode: queued
  triggers:
    - trigger: event
      event_type: mobile_app_notification_action
      event_data:
        action: SNOOZE_DOORSTEP_ALERTS_1H
      id: '01:00:00'
    - trigger: event
      event_type: mobile_app_notification_action
      event_data:
        action: SNOOZE_DOORSTEP_ALERTS_4H
      id: '04:00:00'
  actions:
    - action: timer.start
      target:
        entity_id: timer.front_door_alert_snooze
      data:
        duration: "{{ trigger.id }}"

Quiet the push and keep the recording

Put this check inside the sequence that sends the picture. With the timer active, a new visit can still produce a recording.

- condition: state
  entity_id: timer.front_door_alert_snooze
  state: idle

Hold an alert, tap Snooze 1 hour and look at the timer in Home Assistant. From a fresh alert, try Snooze 4 hours and check the same timer. If a tap does nothing, compare the action string in the outgoing payload with the one in the event trigger.

Expiry makes the next qualifying visit eligible for a fresh alert. The earlier visits stay in the recording history. See the complete doorstep package, my other uses for snooze buttons, and the custom iPhone icons walkthrough.

Watch the walkthrough on YouTube

Advertisement

Keep building

The next useful idea, in your inbox.

Get new vCloudInfo posts by email.

Get new posts