Last active
July 25, 2023 07:42
-
-
Save hunterjm/fb0d6fc49df910193cf61317149074ee to your computer and use it in GitHub Desktop.
Actionable Notification Blueprint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Acknowledge Alert Notification | |
description: | | |
## Acknowledge Alert Notification | |
This blueprint will repeatedly send a notification to your device at a pre-defined interval until it has been acknowledged via the actionable notification. | |
domain: automation | |
source_url: https://gist.github.com/hunterjm/fb0d6fc49df910193cf61317149074ee | |
input: | |
trigger_entity: | |
name: Trigger Entity | |
description: Entity to listen for state changes on. | |
selector: | |
entity: | |
desired_state: | |
name: Desired State | |
description: What state should this entity be in to trigger the notification? | |
default: 'on' | |
notify_device: | |
name: Device | |
description: The device must run the official Home Assistant app to receive notifications. | |
default: false | |
selector: | |
device: | |
integration: mobile_app | |
title: | |
name: Message Title | |
description: The title of the message to be sent. | |
message: | |
name: Message Body | |
description: The body of the message to be sent. | |
dismiss: | |
name: Dismiss Message | |
description: What to show as the actionable text in the notification. | |
default: Dismiss | |
critical: | |
name: (Optional) Critical Notification | |
description: Send as a critical notification to the mobile device. | |
default: false | |
selector: | |
boolean: | |
interval: | |
name: Notification Repeat Interval | |
description: > | |
How long to wait for acknowledgement before re-sending the notification. | |
default: 5 | |
selector: | |
number: | |
max: 300 | |
min: 0 | |
unit_of_measurement: minutes | |
mode: single | |
trigger: | |
- platform: state | |
entity_id: !input trigger_entity | |
to: !input desired_state | |
variables: | |
trigger_entity: !input trigger_entity | |
desired_state: !input desired_state | |
id: "{{ trigger_entity }}-{{ desired_state }}-notification" | |
title: !input title | |
message: !input message | |
dismiss: !input dismiss | |
critical: !input critical | |
interval: !input interval | |
action: | |
- repeat: | |
sequence: | |
- device_id: !input notify_device | |
domain: mobile_app | |
type: notify | |
title: "{{title}}" | |
message: "{{message}}" | |
data: | |
tag: "{{ id }}" | |
group: "{{ id }}" | |
# Android Specific | |
ttl: "{{ iif(critical, 0, 3600000) }}" | |
priority: "{{ iif(critical, 'high', 'normal') }}" | |
# iOS Specific | |
push: | |
interruption-level: "{{ iif(critical, 'critical', 'active') }}" | |
# Actions | |
actions: | |
- action: "ack-{{ id }}" | |
title: "{{ dismiss }}" | |
destructive: true | |
- wait_for_trigger: | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "ack-{{ id }}" | |
timeout: | |
minutes: !input interval | |
until: "{{ wait.remaining > 0 }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment