Simplified normal text notifications further
Additionally made the script capable of clearing notifications. Should be almost no need to call notify services directly at all anymore.
This commit is contained in:
@ -459,8 +459,10 @@
|
||||
entity_id: input_boolean.vacation_mode
|
||||
state: 'off'
|
||||
action:
|
||||
- service: notify.all_ios
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: tornado-warning
|
||||
|
@ -692,7 +692,7 @@ script:
|
||||
name: 'Title'
|
||||
description: 'The title of the notification'
|
||||
example: 'Greetings'
|
||||
required: true
|
||||
required: false
|
||||
selector:
|
||||
text:
|
||||
message:
|
||||
@ -778,101 +778,29 @@ script:
|
||||
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 }}'
|
||||
data:
|
||||
tag: >
|
||||
{% if tag is defined %}
|
||||
{{ tag }}
|
||||
{% else %}
|
||||
{}
|
||||
value_template: >
|
||||
{% if who == 'tony' %}
|
||||
{{ is_state('input_boolean.text_notify_tony','on') }}
|
||||
{% elif who == 'tina' %}
|
||||
{{ is_state('input_boolean.text_notify_tina','on') }}
|
||||
{% elif who == 'kallen' %}
|
||||
{{ is_state('input_boolean.text_notify_kallen','on') }}
|
||||
{% elif who == 'parents' %}
|
||||
{{ is_state('input_boolean.text_notify_parents','on') }}
|
||||
{% elif who == 'nerds' %}
|
||||
{{ is_state('input_boolean.text_notify_nerds','on') }}
|
||||
{% elif who == 'all' %}
|
||||
{{ is_state('input_boolean.text_notify_all','on') }}
|
||||
{% endif %}
|
||||
- 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 }}'
|
||||
data:
|
||||
tag: >
|
||||
{% if tag is defined %}
|
||||
{{ tag }}
|
||||
{% else %}
|
||||
{}
|
||||
{% endif %}
|
||||
- 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 }}'
|
||||
data:
|
||||
tag: >
|
||||
{% if tag is defined %}
|
||||
{{ tag }}
|
||||
{% else %}
|
||||
{}
|
||||
{% endif %}
|
||||
- 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') %}
|
||||
{% 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 }}'
|
||||
data:
|
||||
tag: >
|
||||
{% if tag is defined %}
|
||||
{{ tag }}
|
||||
{% else %}
|
||||
{}
|
||||
{% endif %}
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ who == "nerds"}}'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_notify_nerds
|
||||
state: 'on'
|
||||
then:
|
||||
- service: >
|
||||
{% elif who == 'kallen' %}
|
||||
notify.ios_kallen
|
||||
{% elif who == 'nerds' %}
|
||||
{% 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') %}
|
||||
@ -880,26 +808,17 @@ script:
|
||||
{% else %}
|
||||
notify.ios_nerds
|
||||
{% endif %}
|
||||
data:
|
||||
title: '{{ title }}'
|
||||
message: '{{ message }}'
|
||||
data:
|
||||
tag: >
|
||||
{% if tag is defined %}
|
||||
{{ tag }}
|
||||
{% elif who == 'parents' %}
|
||||
{% 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 %}
|
||||
{% elif who == 'all' %}
|
||||
notify.all_ios
|
||||
{% endif %}
|
||||
- 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 }}'
|
||||
|
@ -487,8 +487,10 @@ script:
|
||||
continue_on_timeout: true
|
||||
timeout:
|
||||
minutes: 1
|
||||
- service: notify.all_ios
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: "clear_notification"
|
||||
data:
|
||||
tag: skip-away
|
||||
|
@ -320,6 +320,8 @@ automation:
|
||||
then:
|
||||
- service: notify.all_ios
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: lockdown-issue
|
||||
|
@ -1560,8 +1560,10 @@ automation:
|
||||
- condition: template
|
||||
value_template: "{{ is_state('binary_sensor.windows','off') and is_state('binary_sensor.precipitation','on') }}"
|
||||
sequence:
|
||||
- service: notify.all_ios
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: rain-window-warning
|
||||
@ -1573,8 +1575,10 @@ automation:
|
||||
- condition: template
|
||||
value_template: "{{ is_state('binary_sensor.precipitation','off') }}"
|
||||
sequence:
|
||||
- service: notify.all_ios
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: rain-window-warning
|
||||
@ -1658,8 +1662,10 @@ script:
|
||||
lightning_clear:
|
||||
alias: 'Lightning Clear'
|
||||
sequence:
|
||||
- service: notify.all_ios
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: all
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: lightning-warning
|
||||
|
Reference in New Issue
Block a user