Support the use of tags and notification clearing with text_notify

This commit is contained in:
2023-02-26 20:10:36 -05:00
parent 11b859ef22
commit cec5f2840d
7 changed files with 112 additions and 22 deletions

View File

@ -24,6 +24,7 @@
message: The National Weather Service has issued a Tornado Warning for our area.
Take Cover NOW!!!!
who: all
tag: tornado-warning
alias: CRITICAL PHONE ALERT
- service: script.tv_notify
data:
@ -444,6 +445,7 @@
who: all
title: Low Batteries in House
message: 'Low battery alert for: {{sensors}}'
tag: battery-monitoring
- id: '1655493590791'
alias: NWS Announce Weather Alert for Tornado (CLEAR)
description: ''
@ -457,6 +459,12 @@
entity_id: input_boolean.vacation_mode
state: 'off'
action:
- service: notify.all_ios
data:
message: clear_notification
data:
tag: tornado-warning
alias: Clear critical notification
- service: input_boolean.turn_off
data: {}
target:
@ -471,6 +479,7 @@
message: Check your surroundings and make sure it is safe to leave cover
who: all
type: alert
tag: tornado-cleared
- service: script.tv_notify
data:
title: Tornado Warning is cleared

View File

@ -188,6 +188,7 @@ automation:
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!"
tag: garbage-unlimited
else:
- if:
- condition: state
@ -200,6 +201,7 @@ automation:
who: "all"
title: "Garbage Collection - Regular"
message: "Tomorrow is regular trash pickup day. Make sure the trash can is taken to the curb!"
tag: garbage-regular
- conditions:
- condition: and
conditions:
@ -222,6 +224,7 @@ automation:
who: "all"
title: "Retrieve Garbage Can"
message: "Garbage has been collected. Don't forget to move the trash can back to the house!"
tag: garbage-retrieve
- id: d7641b5e-3cbb-4fb3-b6ed-5edf3157b88d
alias: Kallen Briefing Location Change
@ -261,7 +264,10 @@ script:
- service: script.text_notify
data:
who: "kallen"
title: "Yo Doofus"
message: "Heads up, here comes your nightly briefing!"
type: normal
tag: kallen-nightly-briefing
- delay:
seconds: 3
- service: script.speech_engine

View File

@ -145,6 +145,8 @@ script:
who: "parents"
title: "Emma Climate Schedule"
message: "The air conditioner in Emma's Bedroom has been activated."
type: normal
tag: emma-climate
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
@ -162,6 +164,8 @@ script:
who: "parents"
title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom."
type: normal
tag: emma-climate
default:
- if:
- condition: template
@ -172,6 +176,8 @@ script:
who: "parents"
title: "Emma Climate Schedule"
message: "No option selected for Emma's climate mode. No devices will be activated."
type: normal
tag: emma-climate
- conditions:
- condition: state
entity_id: binary_sensor.early_night_mode

View File

@ -663,6 +663,17 @@ script:
mode: queued
max: 10
fields:
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
who:
name: 'Who'
description: 'Which phone, or group of phones, to send the notification to'
@ -692,17 +703,13 @@ 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'
tag:
name: 'Tag'
description: 'The tag for the notification. Used primarily for dismissing notifications via automation.'
example: 'test-notification'
required: false
selector:
select:
options:
- normal
- alert
- critical
text:
sequence:
- choose:
- conditions:
@ -727,6 +734,12 @@ script:
title: "{{ title }}"
message: "{{ message }}"
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
push:
sound:
name: default
@ -752,16 +765,13 @@ script:
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 }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
default:
- condition: state
entity_id: input_boolean.text_notifications
@ -779,6 +789,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
- if:
- condition: template
value_template: '{{ who == "tina"}}'
@ -792,6 +809,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
- if:
- condition: template
value_template: '{{ who == "kallen"}}'
@ -805,6 +829,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
- if:
- condition: template
value_template: '{{ who == "parents"}}'
@ -825,6 +856,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
- if:
- condition: template
value_template: '{{ who == "nerds"}}'
@ -845,6 +883,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
- if:
- condition: template
value_template: '{{ who == "all"}}'
@ -858,6 +903,13 @@ script:
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: >
{% if tag is defined %}
{{ tag }}
{% else %}
{}
{% endif %}
tv_notify:
alias: 'TV Notify'

View File

@ -312,6 +312,8 @@ automation:
type: alert
who: parents
message: "Kallen has been dropped off at school."
title: "Kallen Location Alert"
tag: kallen-dropoff
- service: light.turn_off
entity_id: light.kallen_bedroom_lights
initial_state: true
@ -351,6 +353,8 @@ automation:
type: alert
who: parents
message: "Kallen has been picked up from school."
title: "Kallen Location Alert"
tag: kallen-pickup
initial_state: true
- id: 94b57d79-efe0-4f34-b5e3-baeaa5eea9f4

View File

@ -266,6 +266,7 @@ automation:
type: critical
who: 'parents'
title: 'Security Not Armed!'
tag: lockdown-issue
message: >-
{% set extdoors = expand('binary_sensor.exterior_doors') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
{% set windows = expand('binary_sensor.windows') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
@ -317,6 +318,14 @@ automation:
entity_id: binary_sensor.security_faults
state: 'off'
then:
- service: notify.all_ios
data:
message: clear_notification
data:
tag: lockdown-issue
- service: persistent_notification.dismiss
data:
notification_id: lockdown_issue
- if:
- condition: state
entity_id: group.adults
@ -330,9 +339,6 @@ automation:
data:
who: common
message: 'I am unable to resolve the security issue, so I am giving up. Please report the issue to Tony if applicable.'
- service: persistent_notification.dismiss
data:
notification_id: lockdown_issue
- service: scene.turn_on
target:
entity_id: scene.light_state_before_lockdown_issue

View File

@ -1547,6 +1547,7 @@ automation:
who: 'all'
title: "WINDOWS ARE OPEN!"
message: "It is raining and there are windows open in the house. Please close them!"
tag: rain-window-warning
- service: script.speech_engine
data:
who: everywhere
@ -1607,6 +1608,7 @@ script:
message: >-
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
"Lightning has been detected within 20 miles of the house. Nearest storm is {{ ltgdist }} miles away."
tag: lightning-warning
- service: input_boolean.turn_on
target:
entity_id: input_boolean.lightning_warning
@ -1619,6 +1621,11 @@ script:
lightning_clear:
alias: 'Lightning Clear'
sequence:
- service: notify.all_ios
data:
message: clear_notification
data:
tag: lightning-warning
- service: script.status_annc
data_template:
who: 'common'