docker-apps/home-assistant/Send Dynamic Notification To All Devices.yml

235 lines
8.2 KiB
YAML

alias: Send Dynamic Notification To All Devices
sequence:
- variables:
image_url: "{{ base_url~image }}"
video_url: "{{ base_url~video }}"
- parallel:
- sequence:
- if:
- condition: template
value_template: "{{ send_to_sm_n986b | default(True) }}"
alias: Send to SM_N986B?
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
alias: "Notify: Send message to SM_N986B"
- if:
- condition: template
value_template: '{{ send_to_nokia_c20 | default(True) }}'
then:
- sequence:
- 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_nokia_c20
- action: counter.increment
target:
entity_id: counter.nokia_c20_notification_counter
data: {}
alias: Increment NOKIA_C20 notification counter
- if:
- condition: template
value_template: '{{ send_to_sm_x115 | default(True) }}'
then:
- sequence:
- 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_x115
- action: counter.increment
target:
entity_id: counter.sm_x115_notification_counter
data: {}
alias: Increment SM_X115 notification counter
# - 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_nokia_c20:
selector:
boolean: null
name: send_to_nokia_c20
required: false
send_to_sm_x115:
selector:
boolean: null
name: send_to_sm_x115
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