Last active
January 1, 2025 01:27
-
-
Save yougotborked/2a61daa1015615dca4357794dc6355bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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: Universal Actionable Notification | |
description: > | |
Send highly customizable notifications to iOS and Android devices, supporting critical notifications, dynamic actions, and camera streams. | |
domain: automation | |
input: | |
iphone_services: | |
name: iPhone Notification Services | |
description: Enter the `notify.mobile_app_<device_name>` services for iPhones (comma-separated). | |
default: "" | |
selector: | |
text: | |
android_services: | |
name: Android Notification Services | |
description: Enter the `notify.mobile_app_<device_name>` services for Android devices (comma-separated). | |
default: "" | |
selector: | |
text: | |
trigger_entity: | |
name: Trigger Entity | |
description: Entity to monitor for state changes. | |
selector: | |
entity: | |
notification_title: | |
name: Notification Title | |
description: Title of the notification. | |
default: "Alert" | |
notification_message: | |
name: Notification Message | |
description: Body of the notification. | |
default: "Action required." | |
critical_ios: | |
name: Enable Critical Notifications (iOS) | |
description: Enable critical notifications with sound or interruption-level. | |
default: false | |
selector: | |
boolean: | |
critical_android: | |
name: Enable Critical Notifications (Android) | |
description: Enable critical notifications with high priority and alarm stream. | |
default: false | |
selector: | |
boolean: | |
tts_message: | |
name: TTS Message (Android, Optional) | |
description: Text-to-Speech message for Android critical notifications. | |
default: "" | |
selector: | |
text: | |
tts_volume_max: | |
name: TTS at Max Volume (Android) | |
description: Enable Text-To-Speech at maximum volume. | |
default: false | |
selector: | |
boolean: | |
dynamic_camera: | |
name: Dynamic Camera Stream (Optional) | |
description: Display a real-time camera stream. | |
default: false | |
selector: | |
boolean: | |
camera_entity: | |
name: Camera Entity | |
description: The camera to stream or show an image from. | |
selector: | |
entity: | |
domain: camera | |
action_1_title: | |
name: First Action Name (Optional) | |
description: Label for the first button. | |
default: "" | |
selector: | |
text: | |
first_action: | |
name: First Action Sequence (Optional) | |
description: Sequence to execute when the first action is selected. | |
default: [] | |
selector: | |
action: | |
action_2_title: | |
name: Second Action Name (Optional) | |
description: Label for the second button. | |
default: "" | |
selector: | |
text: | |
second_action: | |
name: Second Action Sequence (Optional) | |
description: Sequence to execute when the second action is selected. | |
default: [] | |
selector: | |
action: | |
action_3_title: | |
name: Third Action Name (Optional) | |
description: Label for the third button. | |
default: "" | |
selector: | |
text: | |
third_action: | |
name: Third Action Sequence (Optional) | |
description: Sequence to execute when the third action is selected. | |
default: [] | |
selector: | |
action: | |
action_4_title: | |
name: Fourth Action Name (Optional) | |
description: Label for the fourth button. | |
default: "" | |
selector: | |
text: | |
fourth_action: | |
name: Fourth Action Sequence (Optional) | |
description: Sequence to execute when the fourth action is selected. | |
default: [] | |
selector: | |
action: | |
mode: restart | |
trigger: | |
- platform: state | |
entity_id: !input trigger_entity | |
variables: | |
iphone_services: !input iphone_services | |
iphone_services_list: > | |
{{ iphone_services.split(',') | map('trim') | list }} | |
android_services: !input android_services | |
android_services_list: > | |
{{ android_services.split(',') | map('trim') | list }} | |
action: | |
# Send notifications to iPhones | |
- choose: | |
- conditions: | |
- "{{ iphone_services_list | length > 0 }}" | |
sequence: | |
- repeat: | |
for_each: "{{ iphone_services_list }}" | |
sequence: | |
- service: "{{ repeat.item }}" | |
data: | |
title: !input notification_title | |
message: !input notification_message | |
data: | |
push: | |
critical: "{{ 1 if critical_ios else 0 }}" | |
interruption-level: "{{ 'critical' if critical_ios else 'active' }}" | |
entity_id: "{{ camera_entity if dynamic_camera else '' }}" | |
content-type: "image/jpeg" | |
hide-thumbnail: false | |
actions: > | |
{% set actions = [] %} | |
{% if action_1_title %} | |
{% set actions = actions + [{"action": "action_1", "title": action_1_title}] %} | |
{% endif %} | |
{% if action_2_title %} | |
{% set actions = actions + [{"action": "action_2", "title": action_2_title}] %} | |
{% endif %} | |
{% if action_3_title %} | |
{% set actions = actions + [{"action": "action_3", "title": action_3_title}] %} | |
{% endif %} | |
{% if action_4_title %} | |
{% set actions = actions + [{"action": "action_4", "title": action_4_title}] %} | |
{% endif %} | |
{{ actions }} | |
# Send notifications to Androids | |
- choose: | |
- conditions: | |
- "{{ android_services_list | length > 0 }}" | |
sequence: | |
- repeat: | |
for_each: "{{ android_services_list }}" | |
sequence: | |
- service: "{{ repeat.item }}" | |
data: | |
title: !input notification_title | |
message: "{{ tts_message if critical_android and tts_message else notification_message }}" | |
data: | |
ttl: 0 | |
priority: "{{ 'high' if critical_android else 'normal' }}" | |
channel: "{{ 'alarm_stream_max' if tts_volume_max else 'alarm_stream' }}" | |
media_stream: alarm_stream | |
tts_text: "{{ tts_message }}" | |
entity_id: "{{ camera_entity if dynamic_camera else '' }}" | |
content-type: "image/jpeg" | |
hide-thumbnail: false | |
actions: > | |
{% set actions = [] %} | |
{% if action_1_title %} | |
{% set actions = actions + [{"action": "action_1", "title": action_1_title}] %} | |
{% endif %} | |
{% if action_2_title %} | |
{% set actions = actions + [{"action": "action_2", "title": action_2_title}] %} | |
{% endif %} | |
{% if action_3_title %} | |
{% set actions = actions + [{"action": "action_3", "title": action_3_title}] %} | |
{% endif %} | |
{% if action_4_title %} | |
{% set actions = actions + [{"action": "action_4", "title": action_4_title}] %} | |
{% endif %} | |
{{ actions }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment