141 lines
3.9 KiB
YAML
141 lines
3.9 KiB
YAML
alias: Send Dynamic Notification To All Devices
|
|
sequence:
|
|
- variables:
|
|
image_url: "{{ base_url~image }}"
|
|
video_url: "{{ base_url~video }}"
|
|
- parallel:
|
|
- if:
|
|
- condition: template
|
|
value_template: '{{ send_to_sm_n986b | default(True) }}'
|
|
then:
|
|
- data:
|
|
message: "{{ message }}"
|
|
title: "{{ title }}"
|
|
data:
|
|
sticky: "true"
|
|
color: "#2DF56D"
|
|
channel: "{{ channel }}"
|
|
vibrationPattern: 100, 1000, 100, 1000, 100
|
|
priority: "{{ priority }}"
|
|
ledColor: red
|
|
importance: "{{ importance }}"
|
|
clickAction: "{{ image_url }}"
|
|
tag: "{{ notifTag }}"
|
|
group: "{{ group }}"
|
|
image: >-
|
|
{% if (importance == "default" and video != null) -%} {{ null }}
|
|
{%- else -%} {{ image_url }} {%- endif %}
|
|
video: >-
|
|
{% if (importance == "default" and video != null) -%} {{ video_url
|
|
}} {%- else -%} {{ null }} {%- endif %}
|
|
notification_icon: "{{ notifIcon }}"
|
|
when: "{{ when }}"
|
|
actions:
|
|
- action: URI
|
|
title: Open Image
|
|
uri: "{{ image_url }}"
|
|
- action: URI
|
|
title: Open Clip
|
|
uri: "{{ video_url }}"
|
|
action: notify.mobile_app_sm_n986b
|
|
- data:
|
|
message: '{{ message }}'
|
|
title: '{{ title }}'
|
|
data:
|
|
url: '{{ video_url }}'
|
|
tag: '{{ notifTag }}'
|
|
group: '{{ group }}'
|
|
attachment:
|
|
url: '{% if (importance == "default" and video != null) -%} {{ video }} {%- else -%} {{ image_url }} {%- endif %}'
|
|
push:
|
|
interruption-level: '{% if importance == "max" -%} time-sensitive {%- else -%} passive {%- endif %}'
|
|
# must test above data sent to notify.mobile_app_sm_n986b and check whether the following data is needed
|
|
# actions:
|
|
# - action: URI
|
|
# title: Open Image
|
|
# uri: https://home-assistant.sthome.org/api/frigate/notifications/{{ id }}/thumbnail.jpg?format=android
|
|
action: notify.mobile_app_sm_n986b
|
|
# - if:
|
|
# - condition: template
|
|
# value_template: '{{ states("media_player.nova4k") != "off" }}'
|
|
# - condition: template
|
|
# value_template: '{{ importance == "max" }}'
|
|
# then:
|
|
# - data:
|
|
# message: '{{ message }}'
|
|
# title: '{{ title }}'
|
|
# data:
|
|
# fontsize: medium
|
|
# image:
|
|
# url: https://frigate.sthome.org/api/events/{{id}}/snapshot.jpg
|
|
# action: notify.nova_4k
|
|
mode: parallel
|
|
icon: mdi:bell-ring-outline
|
|
max: 10
|
|
fields:
|
|
send_to_sm_n986b:
|
|
selector:
|
|
boolean: null
|
|
name: send_to_sm_n986b
|
|
required: false
|
|
send_to_nova_4k:
|
|
selector:
|
|
boolean: null
|
|
name: send_to_nova_4k
|
|
required: false
|
|
id:
|
|
selector:
|
|
text: null
|
|
name: id
|
|
required: true
|
|
title:
|
|
selector:
|
|
text: null
|
|
name: title
|
|
required: true
|
|
message:
|
|
selector:
|
|
text: null
|
|
name: message
|
|
required: true
|
|
notiftag:
|
|
selector:
|
|
text: null
|
|
name: notifTag
|
|
required: true
|
|
notificon:
|
|
selector:
|
|
text: null
|
|
name: notifIcon
|
|
required: true
|
|
group:
|
|
selector:
|
|
text: null
|
|
name: group
|
|
required: true
|
|
importance:
|
|
selector:
|
|
text: null
|
|
name: importance
|
|
required: true
|
|
base_url:
|
|
selector:
|
|
text: null
|
|
name: base_url
|
|
required: true
|
|
image:
|
|
selector:
|
|
text: null
|
|
name: image
|
|
required: true
|
|
video:
|
|
selector:
|
|
text: null
|
|
name: video
|
|
required: true
|
|
when:
|
|
selector:
|
|
text: null
|
|
name: when
|
|
required: true
|