Does anyone have a simple template or example for adding an iOS Actionable Notification for an alert that will either silence or snooze the alert for a period of time?
I’m just looking for a simple example that I can learn from and then customize for my needs.
I’ve been able to make the actionable notification show, but I’m not following how I get it to do something like silence the alert for a period of time. I’m thinking it requires a separate automation, but ideally I’d like one that I can re-use across other automations that push alerts.
Any good examples that are relatively simple that anyone can share? E.g. automation to push alert when door opens, add X and Y to provide the snooze option for 30 minutes.
Recognizing this is an old question…I was after similar functionality and wanted to share the hack I cobbled together:
I achieved this by creating two scripts using the “confirmable notification” blueprint that installed with HA. In both scripts, the confirmation action does a thing (in my case, sets an input Boolean to true), and the dismiss action (ie “snooze”) waits for a period of time before calling the other version of the script. They continue on referencing each other for as long as you snooze the notifications.
I don’t like that this solution requires two scripts for every notification and came to the forums hunting for something better (or a single blueprint to at least streamline creating all these scripts) but, no success yet.
I also don’t like that the actions on the notification (in iOS at least) requires a long press to see, which I’ll be looking in to fixing eventually….
Anyway, here’s one of the scripts:
alias: Dog food reminder
use_blueprint:
path: homeassistant/confirmable_notification.yaml
input:
notify_device: #This is where my phone’s ID goes…in the visual editor you’re provided a device selection drop-down
title: Don’t forget
message: …to feed the dog!
confirm_text: I fed her
confirm_action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.dog_feeding_pm
dismiss_text: Snooze
dismiss_action:
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- service: script.dog_food_reminder_snooze #This is the second copy of the script. It’s identical, except this service calls back to this script
data: {}
icon: mdi:dog