Simplify text notifications down to a single script
And it didn't even lose any functionality!
This commit is contained in:
@ -13,12 +13,13 @@
|
||||
action:
|
||||
- service: script.max_brightness
|
||||
data: {}
|
||||
- service: script.text_urgent_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
who: all
|
||||
type: Critical
|
||||
title: Tornado Warning - TAKE COVER!
|
||||
message: The National Weather Service has issued a Tornado Warning for our area.
|
||||
Take Cover NOW!!!!
|
||||
who: all
|
||||
alias: CRITICAL PHONE ALERT
|
||||
- service: script.tv_notify
|
||||
data:
|
||||
@ -433,8 +434,9 @@
|
||||
- sensor.tony_s_iphone_battery_level
|
||||
- sensor.tony_s_ipad_battery_level
|
||||
actions:
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: normal
|
||||
who: all
|
||||
title: Low Batteries in House
|
||||
message: 'Low battery alert for: {{sensors}}'
|
||||
|
Submodule node-red/projects/NerdFlows updated: e0c8a7c451...61617a7aca
@ -182,8 +182,9 @@ automation:
|
||||
entity_id: sensor.garbage_collection_large_pickup
|
||||
state: '1'
|
||||
then:
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: "all"
|
||||
title: "Garbage Collection - Unlimited"
|
||||
message: "Tomorrow is large trash pickup day. Please take out all large items, and don't forget the trash can!"
|
||||
@ -193,8 +194,9 @@ automation:
|
||||
entity_id: sensor.garbage_collection
|
||||
state: '1'
|
||||
then:
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: "all"
|
||||
title: "Garbage Collection - Regular"
|
||||
message: "Tomorrow is regular trash pickup day. Make sure the trash can is taken to the curb!"
|
||||
@ -214,8 +216,9 @@ automation:
|
||||
attribute: days
|
||||
state: '7'
|
||||
then:
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: "all"
|
||||
title: "Retrieve Garbage Can"
|
||||
message: "Garbage has been collected. Don't forget to move the trash can back to the house!"
|
||||
|
@ -692,102 +692,172 @@ script:
|
||||
selector:
|
||||
text:
|
||||
multiline: true
|
||||
type:
|
||||
name: 'Type'
|
||||
description: 'The type of notification to send. Normal will respect whether a person/group is home. Alert will ignore home/away status. Critical will ignore home/away and send a persistant critical notification.'
|
||||
example: 'normal, alert, critical'
|
||||
required: false
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- Normal
|
||||
- Alert
|
||||
- Critical
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notifications
|
||||
state: 'on'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "tony"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_tony
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_tony
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ type in ['critical','Critical'] }}"
|
||||
sequence:
|
||||
- service: >
|
||||
{% if who == 'tony' %}
|
||||
notify.ios_tony
|
||||
{% elif who == 'tina' %}
|
||||
notify.ios_tina
|
||||
{% elif who == 'kallen' %}
|
||||
notify.ios_kallen
|
||||
{% elif who == 'parents' %}
|
||||
notify.ios_parents
|
||||
{% elif who == 'nerds' %}
|
||||
notify.ios_nerds
|
||||
{% elif who == 'all' %}
|
||||
notify.all_ios
|
||||
{% endif %}
|
||||
data:
|
||||
title: "{{ title }}"
|
||||
message: "{{ message }}"
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "tina"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_tina
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_tina
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "kallen"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_kallen
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_kallen
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "parents"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_parents
|
||||
state: 'on'
|
||||
then:
|
||||
- service: >
|
||||
{% if is_state('input_boolean.text_notify_tina','off') and is_state('input_boolean.text_notify_tony','on') %}
|
||||
push:
|
||||
sound:
|
||||
name: default
|
||||
critical: 1
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ type in ['alert','Alert'] }}"
|
||||
sequence:
|
||||
- service: >
|
||||
{% if who == 'tony' %}
|
||||
notify.ios_tony
|
||||
{% elif is_state('input_boolean.text_notify_tina','on') and is_state('input_boolean.text_notify_tony','off') %}
|
||||
{% elif who == 'tina' %}
|
||||
notify.ios_tina
|
||||
{% else %}
|
||||
notify.ios_parents
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "nerds"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_nerds
|
||||
state: 'on'
|
||||
then:
|
||||
- service: >
|
||||
{% if is_state('input_boolean.text_notify_tony','on') and is_state('input_boolean.text_notify_kallen','off') %}
|
||||
notify.ios_tony
|
||||
{% elif is_state('input_boolean.text_notify_tony','off') and is_state('input_boolean.text_notify_kallen','on') %}
|
||||
{% elif who == 'kallen' %}
|
||||
notify.ios_kallen
|
||||
{% else %}
|
||||
{% elif who == 'parents' %}
|
||||
notify.ios_parents
|
||||
{% elif who == 'nerds' %}
|
||||
notify.ios_nerds
|
||||
{% elif who == 'all' %}
|
||||
notify.all_ios
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "all"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_all
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.all_ios
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
# data:
|
||||
# attachment:
|
||||
# url: '{{ url }}'
|
||||
# content-type: '{{ content_type }}'
|
||||
# hide-thumbnail: false
|
||||
# push:
|
||||
# sound: '{{ ios_sound }}'
|
||||
# badge: 0
|
||||
# category: '{{ ios_category }}'
|
||||
# entity_id: '{{ camera_entity }}'
|
||||
default:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notifications
|
||||
state: 'on'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "tony"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_tony
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_tony
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "tina"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_tina
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_tina
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "kallen"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_kallen
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.ios_kallen
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "parents"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_parents
|
||||
state: 'on'
|
||||
then:
|
||||
- service: >
|
||||
{% if is_state('input_boolean.text_notify_tina','off') and is_state('input_boolean.text_notify_tony','on') %}
|
||||
notify.ios_tony
|
||||
{% elif is_state('input_boolean.text_notify_tina','on') and is_state('input_boolean.text_notify_tony','off') %}
|
||||
notify.ios_tina
|
||||
{% else %}
|
||||
notify.ios_parents
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "nerds"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_nerds
|
||||
state: 'on'
|
||||
then:
|
||||
- service: >
|
||||
{% if is_state('input_boolean.text_notify_tony','on') and is_state('input_boolean.text_notify_kallen','off') %}
|
||||
notify.ios_tony
|
||||
{% elif is_state('input_boolean.text_notify_tony','off') and is_state('input_boolean.text_notify_kallen','on') %}
|
||||
notify.ios_kallen
|
||||
{% else %}
|
||||
notify.ios_nerds
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "all"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_all
|
||||
state: 'on'
|
||||
then:
|
||||
- service: notify.all_ios
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
|
||||
tv_notify:
|
||||
alias: 'TV Notify'
|
||||
@ -867,70 +937,6 @@ script:
|
||||
message: '{{ message }}'
|
||||
data: '{{ data if data is defined else "{}" }}'
|
||||
|
||||
text_alert:
|
||||
alias: 'Text Alert'
|
||||
description: 'Use this to send more important text alerts to phones, this will ignore presence'
|
||||
mode: queued
|
||||
max: 10
|
||||
fields:
|
||||
who:
|
||||
name: 'Who'
|
||||
description: 'Which phone, or group of phones, to send the alert to'
|
||||
example: 'tony, tina, kallen, parents, nerds, all'
|
||||
required: true
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- tony
|
||||
- tina
|
||||
- kallen
|
||||
- parents
|
||||
- nerds
|
||||
- all
|
||||
title:
|
||||
name: 'Title'
|
||||
description: 'The title of the alert'
|
||||
example: 'Important Alert'
|
||||
required: true
|
||||
selector:
|
||||
text:
|
||||
message:
|
||||
name: 'Message'
|
||||
description: 'The body of the alert'
|
||||
example: 'I am alerting you to the possibility that this is an alert'
|
||||
required: true
|
||||
selector:
|
||||
text:
|
||||
multiline: true
|
||||
sequence:
|
||||
- service: >
|
||||
{% if who == 'tony' %}
|
||||
notify.ios_tony
|
||||
{% elif who == 'tina' %}
|
||||
notify.ios_tina
|
||||
{% elif who == 'kallen' %}
|
||||
notify.ios_kallen
|
||||
{% elif who == 'parents' %}
|
||||
notify.ios_parents
|
||||
{% elif who == 'nerds' %}
|
||||
notify.ios_nerds
|
||||
{% elif who == 'all' %}
|
||||
notify.all_ios
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
# data:
|
||||
# attachment:
|
||||
# url: '{{ url }}'
|
||||
# content-type: '{{ content_type }}'
|
||||
# hide-thumbnail: false
|
||||
# push:
|
||||
# sound: '{{ ios_sound }}'
|
||||
# badge: 0
|
||||
# category: '{{ ios_category }}'
|
||||
# entity_id: '{{ camera_entity }}'
|
||||
|
||||
text_alert_image:
|
||||
alias: 'Text Alert Image'
|
||||
sequence:
|
||||
@ -962,85 +968,6 @@ script:
|
||||
# category: '{{ ios_category }}'
|
||||
# entity_id: '{{ camera_entity }}'
|
||||
|
||||
text_urgent_alert:
|
||||
alias: 'Text Urgent Alert'
|
||||
description: 'Use this to send CRITICAL text alerts to phones. This will ignore presence, make a loud annoying sound, and create a persistent notification, DO NOT USE UNLESS NECESSARY'
|
||||
mode: queued
|
||||
max: 10
|
||||
fields:
|
||||
who:
|
||||
name: 'Who'
|
||||
description: 'Which phone, or group of phones, to send the alert to'
|
||||
example: 'tony, tina, kallen, parents, nerds, all'
|
||||
required: true
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- tony
|
||||
- tina
|
||||
- kallen
|
||||
- parents
|
||||
- nerds
|
||||
- all
|
||||
title:
|
||||
name: 'Title'
|
||||
description: 'The title of the notification'
|
||||
example: 'Critical Alert'
|
||||
required: true
|
||||
selector:
|
||||
text:
|
||||
message:
|
||||
name: 'Message'
|
||||
description: 'The body of the notification'
|
||||
example: 'I am alerting you to a critical situation!'
|
||||
required: true
|
||||
selector:
|
||||
text:
|
||||
multiline: true
|
||||
sequence:
|
||||
- service: >
|
||||
{% if who == 'tony' %}
|
||||
notify.ios_tony
|
||||
{% elif who == 'tina' %}
|
||||
notify.ios_tina
|
||||
{% elif who == 'kallen' %}
|
||||
notify.ios_kallen
|
||||
{% elif who == 'parents' %}
|
||||
notify.ios_parents
|
||||
{% elif who == 'nerds' %}
|
||||
notify.ios_nerds
|
||||
{% elif who == 'all' %}
|
||||
notify.all_ios
|
||||
{% endif %}
|
||||
data:
|
||||
title: "{{ title }}"
|
||||
message: "{{ message }}"
|
||||
data:
|
||||
push:
|
||||
sound:
|
||||
name: default
|
||||
critical: 1
|
||||
|
||||
###############################################################################
|
||||
# Alert Notify
|
||||
# Conditions:
|
||||
# => Vacation mode should be off
|
||||
# Services:
|
||||
# => Audible
|
||||
# => iOS
|
||||
###############################################################################
|
||||
alert_notify:
|
||||
alias: 'Alert Notify'
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.vacation_mode
|
||||
state: 'off'
|
||||
- service: tts.google_say
|
||||
data_template:
|
||||
entity_id: media_player.living_room_tv
|
||||
message: >
|
||||
{{ message }}
|
||||
|
||||
jarvis_alert:
|
||||
alias: 'Jarvis Alert'
|
||||
sequence:
|
||||
|
@ -307,8 +307,9 @@ automation:
|
||||
entity_id: input_boolean.kallen_at_school
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.kallen_awake
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: parents
|
||||
message: "Kallen has been dropped off at school."
|
||||
- service: light.turn_off
|
||||
@ -345,8 +346,9 @@ automation:
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.kallen_at_school
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: parents
|
||||
message: "Kallen has been picked up from school."
|
||||
initial_state: true
|
||||
|
@ -261,8 +261,9 @@ automation:
|
||||
|
||||
Doors:{% if is_state('binary_sensor.exterior_doors','on') %} {{ extdoors }} {% else %} None {% endif %}
|
||||
Windows:{% if is_state('binary_sensor.windows','on') %} {{ windows }} {% else %} None {% endif %}
|
||||
- service: script.text_urgent_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: critical
|
||||
who: 'parents'
|
||||
title: 'Security Not Armed!'
|
||||
message: >-
|
||||
|
@ -1541,8 +1541,9 @@ automation:
|
||||
entity_id: binary_sensor.windows
|
||||
state: 'on'
|
||||
action:
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: 'all'
|
||||
title: "WINDOWS ARE OPEN!"
|
||||
message: "It is raining and there are windows open in the house. Please close them!"
|
||||
@ -1598,8 +1599,9 @@ script:
|
||||
who: 'common'
|
||||
call_interuption: 1
|
||||
call_lightning_alert: 1
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: 'all'
|
||||
title: "Lightning Detected!"
|
||||
message: >-
|
||||
@ -1622,8 +1624,9 @@ script:
|
||||
who: 'common'
|
||||
call_interuption: 1
|
||||
call_lightning_clear: 1
|
||||
- service: script.text_alert
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: 'all'
|
||||
title: "Lightning Clear"
|
||||
message: "The lightning threat has passed. It is safe to resume normal activities."
|
||||
|
Reference in New Issue
Block a user