Files
Home-Assistant-Configs/packages/notify.yaml
Tony Stork 5b62a1d052 Simplify text notifications down to a single script
And it didn't even lose any functionality!
2023-02-22 17:23:35 -05:00

2004 lines
71 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

###############################################################################
# AWS Polly Options:
# pause:
# <break time="3s"/>
# emphasis:
# <emphasis level="strong">really like</emphasis>
# level attribute values:
# Strong: Increases the volume and slows the speaking rate so that the speech is louder and slower.
# Moderate: Increases the volume and slows the speaking rate, but less than strong. Moderate is the default.
# Reduced: Decreases the volume and speeds up the speaking rate. Speech is softer and faster.
# Pause Between Paragraphs:
# Wrap text in <p> </p>
# Adding a Pause Between Sentences:
# Ending a sentence with a period (.)
# Controlling How Special Types of Words Are Spoken:
# <say-as interpret-as="value">[text to be interpreted]</say-as>
# characters or spell-out: Spells out each letter of the text, as in a-b-c.
# cardinal or number: Interprets the numerical text as a cardinal number, as in 1,234.
# ordinal: Interprets the numerical text as an ordinal number, as in 1,234th.
# digits: Spells out each digit individually, as in 1-2-3-4.
# fraction: Interprets the numerical text as a fraction. This works for both common fractions such as 3/20, and mixed fractions, such as 2 ½. See below for more information.
# unit: Interprets a numerical text as a measurement. The value should be either a number or a fraction followed by a unit with no space in between as in 1/2inch, or by just a unit, as in 1meter.
# date: Interprets the text as a date. The format of the date must be specified with the format attribute. See below for more information.
# time: Interprets the numerical text as duration, in minutes and seconds, as in 1'21".
# address: Interprets the text as part of a street address.
# expletive: "Beeps out" the content included within the tag.
# telephone: Interprets the numerical text as a 7-digit or 10-digit telephone number, as in 2025551212. You can also use this value for handle telephone extensions, as in 2025551212x345. See below for more information.
################################################################################
input_boolean:
text_notify_tony:
name: Send Texts to Tony
icon: mdi:message
text_notify_tina:
name: Send Texts to Tina
icon: mdi:message
text_notify_kallen:
name: Send Texts to Kallen
icon: mdi:message
text_notify_parents:
name: Send Texts to Parents
icon: mdi:message
text_notify_nerds:
name: Send Texts to Nerds
icon: mdi:message
text_notify_all:
name: Send Texts to All
icon: mdi:message
text_notifications:
name: Text Notifications
icon: mdi:message
presence_text_notifications:
name: Presence Texts
icon: mdi:message
notifications_audio:
name: Audio Notifications
icon: mdi:speaker-wireless
presence_audio_notifications:
name: Presence Audio
icon: mdi:speaker-wireless
audible_notifications:
name: Audible Notifications
icon: mdi:speaker-wireless
presence_notifications_tony:
name: Send Tony Presence Texts
icon: mdi:message
presence_notifications_tina:
name: Send Tina Presence Texts
icon: mdi:message
trash_notification:
name: Trash Notification
icon: mdi:delete
welcome_home:
name: Welcome Home
icon: mdi:human-greeting
studio_quiet:
name: Studio Quiet
icon: mdi:twitch
tv_notifications:
name: TV Notifications
icon: mdi:message
input_select:
select_phones:
name: Select Phones
options:
- None
- Tony
- Tina
- Kallen
- Parents
- Nerds
- All
initial: None
icon: mdi:cellphone-message
select_tvs:
name: Select TVs
options:
- None
- Living Room
- Master Bedroom
- Basement
- All
initial: None
icon: mdi:television-play
text_notification_priority_level:
name: Notification Priority Level
options:
- Normal
- Alert
- Critical
initial: Normal
icon: mdi:alert
input_text:
text_notification:
name: Text Notification
icon: mdi:text
initial: Type your notification here
text_notification_title:
name: Text Notification Title
icon: mdi:text
initial: Type your title here
input_number:
basement_echo_dot_day_volume:
name: Basement Echo Dot Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
basement_echo_dot_night_volume:
name: Basement Echo Dot Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
basement_google_speaker_day_volume:
name: Basement Google Speaker Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
basement_google_speaker_night_volume:
name: Basement Google Speaker Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
living_room_echo_dot_day_volume:
name: Living Room Echo Dot Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
living_room_echo_dot_night_volume:
name: Living Room Echo Dot Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
master_bedroom_echo_dot_day_volume:
name: Master Bedroom Echo Dot Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
master_bedroom_echo_dot_night_volume:
name: Master Bedroom Echo Dot Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
emma_bedroom_google_speaker_day_volume:
name: Emma Bedroom Google Speaker Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
emma_bedroom_google_speaker_night_volume:
name: Emma Bedroom Google Speaker Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
kallen_bedroom_google_speaker_day_volume:
name: Kallen Bedroom Google Speaker Day Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
kallen_bedroom_google_speaker_night_volume:
name: Kallen Bedroom Google Speaker Night Volume
min: 0
max: 1.0
step: 0.01
icon: mdi:knob
# Amazon Polly Sensors to see last message and location of audible notification
mqtt:
sensor:
- name: "Jarvis Last Msg"
state_topic: "house/polly/lastmsg"
- name: "Jarvis Last Location"
state_topic: "house/polly/lastloc"
- name: "Jarvis Last Msg Time"
state_topic: "house/polly/msgtime"
group:
alexa_everywhere:
name: Alexa Everywhere
entities:
- media_player.living_room_echo_dot
- media_player.basement_echo_dot
- media_player.master_bedroom_echo_dot
common_areas:
name: Alexa Common Areas
entities:
- media_player.living_room_echo_dot
- media_player.basement_echo_dot
alexa_no_basement:
name: Alexa No Basement
entities:
- media_player.living_room_echo_dot
- media_player.master_bedroom_echo_dot
kids_bedroom_speakers:
name: Kids Bedroom Speakers
entities:
- media_player.kallen_bedroom_speaker
- media_player.emma_bedroom_speaker
all_bedroom_speakers:
name: All Bedroom Speakers
entities:
- media_player.kallen_bedroom_speaker
- media_player.emma_bedroom_speaker
- media_player.master_bedroom_echo_dot
notify:
- platform: ios
- name: all_ios
platform: group
services:
- service: mobile_app_tinas_iphone
- service: mobile_app_tinas_ipad
- service: mobile_app_tony_s_iphone
- service: mobile_app_tony_s_ipad_new
- service: mobile_app_kallen_iphone
- name: ios_parents
platform: group
services:
- service: mobile_app_tinas_iphone
- service: mobile_app_tinas_ipad
- service: mobile_app_tony_s_ipad_new
- service: mobile_app_tony_s_iphone
- name: ios_tony
platform: group
services:
- service: mobile_app_tony_s_ipad_new
- service: mobile_app_tony_s_iphone
- name: ios_tina
platform: group
services:
- service: mobile_app_tinas_iphone
- service: mobile_app_tinas_ipad
- name: ios_kallen
platform: group
services:
- service: mobile_app_kallen_iphone
- name: ios_nerds
platform: group
services:
- service: mobile_app_kallen_iphone
- service: mobile_app_tony_s_ipad_new
- service: mobile_app_tony_s_iphone
- name: tv_notifications
platform: group
services:
- service: living_room_tv
- service: basement_tv
- service: master_bedroom_tv
- name: alexa_everywhere
platform: group
services:
- service: alexa_media_living_room_echo_dot
- service: alexa_media_basement_echo_dot
- service: alexa_media_master_bedroom_echo_dot
- name: alexa_common_areas
platform: group
services:
- service: alexa_media_living_room_echo_dot
- service: alexa_media_basement_echo_dot
# The below was the initial attempt at day/night volume handling.
# I am keeping it here in case I decide I want to use it, but for now I think I have a better solution.
# automation:
# - id: a3bfc13c-b01f-4b85-8e47-b45cd173a774
# alias: 'Speaker Volume Handling'
# mode: parallel
# max: 12
# trigger:
# - platform: state
# entity_id: input_number.basement_echo_dot_day_volume
# for:
# seconds: 1
# id: basement-echo-day
# - platform: state
# entity_id: input_number.basement_echo_dot_night_volume
# for:
# seconds: 1
# id: basement-echo-night
# - platform: state
# entity_id: input_number.basement_google_speaker_day_volume
# for:
# seconds: 1
# id: basement-google-day
# - platform: state
# entity_id: input_number.basement_google_speaker_night_volume
# for:
# seconds: 1
# id: basement-google-night
# - platform: state
# entity_id: input_number.living_room_echo_dot_day_volume
# for:
# seconds: 1
# id: living-room-echo-day
# - platform: state
# entity_id: input_number.living_room_echo_dot_night_volume
# for:
# seconds: 1
# id: living-room-echo-night
# - platform: state
# entity_id: input_number.master_bedroom_echo_dot_day_volume
# for:
# seconds: 1
# id: master-bedroom-echo-day
# - platform: state
# entity_id: input_number.master_bedroom_echo_dot_night_volume
# for:
# seconds: 1
# id: master-bedroom-echo-night
# - platform: state
# entity_id: input_number.emma_bedroom_google_speaker_day_volume
# for:
# seconds: 1
# id: emma-bedroom-google-day
# - platform: state
# entity_id: input_number.emma_bedroom_google_speaker_night_volume
# for:
# seconds: 1
# id: emma-bedroom-google-night
# - platform: state
# entity_id: input_number.kallen_bedroom_google_speaker_day_volume
# for:
# seconds: 1
# id: kallen-bedroom-google-day
# - platform: state
# entity_id: input_number.kallen_bedroom_google_speaker_night_volume
# for:
# seconds: 1
# id: kallen-bedroom-google-night
# action:
# - choose:
# - conditions:
# - condition: trigger
# id: basement-echo-day
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.basement_echo_dot
# data:
# volume_level: "{{ states('input_number.basement_echo_dot_day_volume') }}"
# - conditions:
# - condition: trigger
# id: basement-echo-night
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.basement_echo_dot
# data:
# volume_level: "{{ states('input_numnber.basement_echo_dot_night_volume') }}"
# - conditions:
# - condition: trigger
# id: basement-google-day
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.basement_google_speaker
# data:
# volume_level: "{{ states('input_number.basement_google_speaker_day_volume') }}"
# - conditions:
# - condition: trigger
# id: basement-google-night
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.basement_google_speaker
# data:
# volume_level: "{{ states('input_number.basement_google_speaker_night_volume') }}"
# - conditions:
# - condition: trigger
# id: living-room-echo-day
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.living_room_echo_dot
# data:
# volume_level: "{{ states('input_number.living_room_echo_dot_day_volume') }}"
# - conditions:
# - condition: trigger
# id: living-room-echo-night
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.living_room_echo_dot
# data:
# volume_level: "{{ states('input_number.living_room_echo_dot_night_volume') }}"
# - conditions:
# - condition: trigger
# id: master-bedroom-echo-day
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.master_bedroom_echo_dot
# data:
# volume_level: "{{ states('input_number.master_bedroom_echo_dot_day_volume') }}"
# - conditions:
# - condition: trigger
# id: master-bedroom-echo-night
# sequence:
# - if:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.master_bedroom_echo_dot
# data:
# volume_level: "{{ states('input_number.master_bedroom_echo_dot_night_volume') }}"
# - conditions:
# - condition: trigger
# id: emma-bedroom-google-day
# sequence:
# - if:
# - condition: and
# conditions:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# - condition: state
# entity_id: input_boolean.white_noise_emma_bedroom
# state: 'off'
# - condition: state
# entity_id: input_boolean.emma_sleeping
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.emma_bedroom_speaker
# data:
# volume_level: "{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}"
# - conditions:
# - condition: trigger
# id: emma-bedroom-google-night
# sequence:
# - if:
# - condition: and
# conditions:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# - condition: state
# entity_id: input_boolean.white_noise_emma_bedroom
# state: 'off'
# - condition: state
# entity_id: input_boolean.emma_sleeping
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.emma_bedroom_speaker
# data:
# volume_level: "{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}"
# - conditions:
# - condition: trigger
# id: kallen-bedroom-google-day
# sequence:
# - if:
# - condition: and
# conditions:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'off'
# - condition: state
# entity_id: input_boolean.white_noise_kallen_bedroom
# state: 'off'
# - condition: state
# entity_id: input_boolean.kallen_sleeping
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.kallen_bedroom_speaker
# data:
# volume_level: "{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}"
# - conditions:
# - condition: trigger
# id: kallen-bedroom-google-night
# sequence:
# - if:
# - condition: and
# conditions:
# - condition: state
# entity_id: input_boolean.give_me_darkness
# state: 'on'
# - condition: state
# entity_id: input_boolean.white_noise_kallen_bedroom
# state: 'off'
# - condition: state
# entity_id: input_boolean.kallen_sleeping
# state: 'off'
# then:
# - service: media_player.volume_set
# target:
# entity_id: media_player.kallen_bedroom_speaker
# data:
# volume_level: "{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}"
script:
volume_reset:
alias: 'Volume Reset'
description: 'Use this to reset volumes to day or night on each speaker, depending on the time of day'
mode: restart
sequence:
- service: media_player.volume_set
target:
entity_id: media_player.basement_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.basement_echo_dot_day_volume') }}
{% endif %}
- service: media_player.volume_set
target:
entity_id: media_player.basement_google_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.basement_google_speaker_day_volume') }}
{% endif %}
- service: media_player.volume_set
target:
entity_id: media_player.living_room_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.living_room_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.living_room_echo_dot_day_volume') }}
{% endif %}
- if:
- condition: state
entity_id: input_boolean.master_bedroom_sleeping
state: 'off'
then:
- service: media_player.volume_set
target:
entity_id: media_player.master_bedroom_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.master_bedroom_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.master_bedroom_echo_dot_day_volume') }}
{% endif %}
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.white_noise_kallen_bedroom
state: 'off'
- condition: state
entity_id: input_boolean.kallen_sleeping
state: 'off'
then:
- service: media_player.volume_set
target:
entity_id: media_player.kallen_bedroom_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% endif %}
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.white_noise_emma_bedroom
state: 'off'
- condition: state
entity_id: input_boolean.emma_sleeping
state: 'off'
then:
- service: media_player.volume_set
target:
entity_id: media_player.emma_bedroom_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% endif %}
###############################################################################
# Txt Notify
###############################################################################
text_notify:
alias: 'Text Notify'
description: 'Use this to send text notifications to phones, respecting presence'
mode: queued
max: 10
fields:
who:
name: 'Who'
description: 'Which phone, or group of phones, to send the notification 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: 'Greetings'
required: true
selector:
text:
message:
name: 'Message'
description: 'The body of the notification'
example: 'I am notifying you that this is a notification'
required: true
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:
- 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:
push:
sound:
name: default
critical: 1
- conditions:
- condition: template
value_template: "{{ type in ['alert','Alert'] }}"
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 }}'
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'
description: 'Use this to send popup text notifications to TV screens in the house'
mode: queued
max: 10
fields:
who:
name: 'Who'
description: 'Which TV to send the notification to'
example: 'living_room, basement, master_bedroom, all'
required: true
selector:
select:
options:
- living_room
- basement
- master_bedroom
- all
title:
name: 'Title'
description: 'The title of the notification'
example: 'Greetings'
required: true
selector:
text:
message:
name: 'Message'
description: 'The body of the notification'
example: 'I am notifying you that this is a notification'
required: true
selector:
text:
multiline: true
data:
name: 'Data'
description: 'This is where you can define other message parameters, these are platform-specific'
required: false
sequence:
- condition: state
entity_id: input_boolean.tv_notifications
state: 'on'
- if:
- condition: template
value_template: '{{ who == "living_room"}}'
then:
- service: notify.living_room_tv
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ data if data is defined else "{}" }}'
- if:
- condition: template
value_template: '{{ who == "master_bedroom"}}'
then:
- service: notify.master_bedroom_tv
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ data if data is defined else "{}" }}'
- if:
- condition: template
value_template: '{{ who == "basement"}}'
then:
- service: notify.basement_tv
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ data if data is defined else "{}" }}'
- if:
- condition: template
value_template: '{{ who == "all"}}'
then:
- service: notify.tv_notifications
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ data if data is defined else "{}" }}'
text_alert_image:
alias: 'Text Alert Image'
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 }}'
jarvis_alert:
alias: 'Jarvis Alert'
sequence:
- service: mqtt.publish
data_template:
topic: 'house/polly/lastmsg'
payload: 'This message is from {{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}. {{ message | striptags | truncate(220)}}'
retain: true
- service: media_player.turn_on
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
- service: media_player.volume_set
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
volume_level: >
{% if who == 'kallen_bedroom_speaker' %}
.60
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
.50
{% else %}
.50
{% endif %}
{% endif %}
- service: tts.amazon_polly_say
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
message: >-
<speak>
{{ message }}
</speak>
cache: true
###############################################################################
# Voice Notify
# Conditions:
# => Only Announce when people are home.
# => Only Announce when Audible Notifications are on
###############################################################################
speech_engine:
alias: 'Speech Engine'
description: 'This is the framework for Jarvis to speak on any/all speakers in the house'
mode: queued
max: 10
fields:
who:
name: 'Who'
description: 'This determines which speaker, or group of speakers, the message is sent to'
required: true
example: 'living_room, basement, basement_google, common_areas, master_bedroom, kallen_bedroom, emma_bedroom, kids_bedrooms, all_bedrooms, everywhere'
selector:
select:
options:
- Living Room
- Basement
- Basement Google
- Common Areas
- Master Bedroom
- Kallen Bedroom
- Emma Bedroom
- Kids Bedrooms
- All Bedrooms
- Everywhere
message:
name: 'Message'
description: 'This is the message you want Jarvis to read.'
required: true
example: 'Type some text and I will read it out loud'
selector:
text:
multiline: true
voice:
name: 'Voice'
description: 'Which voice you would like Jarvis to read in (optional, and only applicable on Alexa devices)'
required: false
example: 'Brian, Emma, Joanna, Amy, Justin, Matthew, Salli'
selector:
select:
options:
- Brian
- Emma
- Joanna
- Amy
- Justin
- Matthew
- Salli
type:
name: 'Type'
description: 'What type of message is this? Can override some settings depending on the option selected. Alert bypasses time restrictions but respects volume settings. Critical also bypasses time restrictions, but also sets all volumes to max.'
required: false
example: 'normal, alert, critical'
selector:
select:
options:
- Normal
- Alert
- Critical
variables:
voice: "{{ states('input_select.jarvis_voice') }}"
sequence:
- service: mqtt.publish
data_template:
topic: 'house/polly/lastmsg'
payload: >
{% if msg_summary == 'recall' %}
{% set msg_summary = '{{states(''sensor.jarvis_last_msg'')}}' %}
{% else %}
{% if msg_summary %}
{% set message = msg_summary %}
{% endif %}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{% endmacro %}
{{- cleanup( message | striptags | truncate(220) ) -}}
{% endif %}
retain: true
- service: mqtt.publish
data_template:
topic: 'house/polly/msgtime'
payload: >
{{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}
retain: true
- service: mqtt.publish
data_template:
topic: 'house/polly/lastloc'
payload: '{{ who }}'
retain: true
- condition: or
conditions:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: template
value_template: >
{% if type in ['critical','Critical','alert','Alert'] %}
true
{% else %}
false
{% endif %}
- condition: state
entity_id: group.adults
state: 'home'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- service: >-
{% if voice == 'nabu' %}
script.nabu_voice
{% elif who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room','Living Room Echo Dot','Living Room'] %}
script.alexa_voice
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker','Kallen Bedroom'] %}
{% if is_state('input_boolean.kallen_sleeping','on') %}
script.alexa_voice
{% else %}
script.jarvis_voice
{% endif %}
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] %}
{% if is_state('input_boolean.emma_sleeping','on') %}
script.alexa_voice
{% else %}
script.jarvis_voice
{% endif %}
{% elif who in ['master_bedroom','master_bedroom_echo_dot','media_player.master_bedroom_echo_dot','Master Bedroom Echo Dot','Master Bedroom'] %}
script.alexa_voice
{% elif who in ['kids_bedrooms','Kids Bedrooms'] %}
script.jarvis_voice
{% elif who in ['all_bedrooms','All Bedrooms'] %}
script.alexa_voice
{% elif who in ['Basement','basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot'] %}
script.alexa_voice
{% elif who in ['Basement Google','basement_google'] %}
{% if is_state('input_boolean.studio_quiet','on') %}
script.alexa_voice
{% else %}
script.jarvis_voice
{% endif %}
{% elif who in ['Common Areas','common','common_areas'] %}
script.alexa_voice
{% elif who in ['Everywhere','everywhere'] %}
script.alexa_voice
{% else %}
script.alexa_voice
{% endif %}
data:
who: >
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room','Living Room Echo Dot','Living Room'] %}
living_room
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker','Kallen Bedroom'] %}
{% if is_state('input_boolean.kallen_sleeping','on') %}
living_room
{% else %}
kallen_bedroom
{% endif %}
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] %}
{% if is_state('input_boolean.emma_sleeping','on') %}
living_room
{% else %}
emma_bedroom
{% endif %}
{% elif who in ['master_bedroom','master_bedroom_echo_dot','media_player.master_bedroom_echo_dot','Master Bedroom Echo Dot','Master Bedroom'] %}
master_bedroom
{% elif who in ['kids_bedrooms','Kids Bedrooms'] %}
kids_bedrooms
{% elif who in ['all_bedrooms','All Bedrooms'] %}
all_bedrooms
{% elif who in ['Basement','basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot'] %}
{% if is_state('input_boolean.studio_quiet','on') %}
living_room
{% else %}
basement
{% endif %}
{% elif who in ['Basement Google','basement_google'] %}
{% if is_state('input_boolean.studio_quiet','on') %}
living_room
{% else %}
basement_google
{% endif %}
{% elif who in ['Common Areas','common','common_areas'] %}
{% if is_state('input_boolean.studio_quiet','on') %}
living_room
{% else %}
common
{% endif %}
{% elif who in ['Everywhere','everywhere'] %}
{% if is_state('input_boolean.studio_quiet','on') %}
alexa_no_basement
{% else %}
everywhere
{% endif %}
{% else %}
living_room_echo_dot
{% endif %}
message: >
{% if who in ['Basement','basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot','Basement Google','basement_google'] and is_state('input_boolean.studio_quiet','on') %}
'I cannot play notifications in the basement right now, because quiet has been requested'
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] and is_state('input_boolean.emma_sleeping','on') %}
'I cannot play notifications in Emma Bedroom right now, because Emma is sleeping and you would not like what happens if I wake her up'
{% elif who in ['kallen_bedroom','Kallen Bedroom','media_player.kallen_bedroom_speaker'] and is_state('input_boolean.kallen_sleeping','on') %}
'I cannot play notifications in Collin Bedroom right now, because Collin is sleeping'
{% else %}
{{ message }}
{% endif %}
voice: '{{ voice }}'
type: '{{ type }}'
- condition: template
value_template: >
{% if who in ['Everywhere','everywhere','all_bedrooms','All Bedrooms','kids_bedrooms','Kids Bedrooms'] %}
true
{% else %}
false
{% endif %}
- service: script.jarvis_voice
data:
who: '{{ who }}'
message: >
{{ message }}
type: '{{ type }}'
# Use this Simplfied Script by calling in automaint or script like:
# service: script.speech_engine_simplified
# data:
# who: media_player.ha_blue
# #who: “{{ states(sensor.room_presence) }}”
# #who: notify.kitchen_echo
# message: something to say
#
#
speech_engine_simplified:
alias: 'Speech Engine Simplified'
sequence:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: group.adults
state: 'home'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- service: mqtt.publish
data_template:
topic: 'house/polly/lastmsg'
payload: >
{% if msg_summary == 'recall' %}
{% set msg_summary = '{{states(''sensor.jarvis_last_msg'')}}' %}
{% else %}
{% if msg_summary %}
{% set message = msg_summary %}
{% endif %}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{% endmacro %}
{{- cleanup( message | striptags | truncate(220) ) -}}
{% endif %}
retain: true
- service: mqtt.publish
data_template:
topic: 'house/polly/msgtime'
payload: >
{{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}
retain: true
- service: mqtt.publish
data_template:
topic: 'house/polly/lastloc'
payload: '{{ who }}'
retain: true
- service: script.alexa_voice
data_template:
entity_id: >-
{{ who }}
message: >-
<speak>
<break time="1s"/>
{{ message }}
</speak>
# Called wheh notification needs to play on echos
alexa_voice:
alias: 'Alexa Voice'
sequence:
- if:
- condition: template
value_template: >
{% if type in ['critical','Critical'] %}
true
{% else %}
false
{% endif %}
then:
- service: media_player.volume_set
target:
entity_id:
- media_player.living_room_echo_dot
- media_player.basement_echo_dot
- media_player.master_bedroom_echo_dot
data:
volume_level: 1.0
- delay:
seconds: 3
- service: notify.alexa_media
data:
message: >
<voice name="{{ voice }}">
<amazon:auto-breaths>
<prosody rate="fast">
{{ message }}
</prosody>
</amazon:auto-breaths>
</voice>
target: >
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
media_player.living_room_echo_dot
{% elif who in ['master_bedroom','master_bedroom_echo_dot','all_bedrooms'] %}
media_player.master_bedroom_echo_dot
{% elif who in ['basement','basement_echo_dot'] %}
media_player.basement_echo_dot
{% elif who in ['common','common_areas'] %}
group.common_areas
{% elif who in ['Everywhere','everywhere'] %}
group.alexa_everywhere
{% elif who in ['alexa_no_basement'] %}
group.alexa_no_basement
{% else %}
media_player.living_room_echo_dot
{% endif %}
data:
type: tts
# Default audible notifications. Notifcations play on the google devices.
jarvis_voice:
alias: 'Jarvis Voice'
sequence:
- if:
- condition: template
value_template: >
{% if who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] and is_state('input_boolean.emma_sleeping','on') %}
true
{% else %}
false
{% endif %}
then:
- stop: 'Emma is sleeping'
- if:
- condition: template
value_template: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker','Kallen Bedroom'] and is_state('input_boolean.kallen_sleeping','on') %}
true
{% else %}
false
{% endif %}
then:
- stop: 'Kallen is sleeping'
- if:
- condition: template
value_template: >
{% if who in ['kids_bedrooms','all_bedrooms','everywhere','Everywhere','Kids Bedrooms','All Bedrooms'] %}
{% if is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','on') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %}
then:
- stop: 'Kids are sleeping'
- service: media_player.turn_on
data_template:
entity_id: >-
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
media_player.kallen_bedroom_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %}
media_player.emma_bedroom_speaker
{% elif who in ['Basement Google','basement_google'] %}
media_player.basement_google_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
- service: media_player.volume_set
data_template:
entity_id: >-
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
media_player.kallen_bedroom_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %}
media_player.emma_bedroom_speaker
{% elif who in ['Basement Google','basement_google'] %}
media_player.basement_google_speaker
{% endif %}
volume_level: >-
{% set numbers_night = [
states.input_number.emma_bedroom_google_speaker_night_volume.state,
states.input_number.kallen_bedroom_google_speaker_night_volume.state
] %}
{% set numbers_day = [
states.input_number.emma_bedroom_google_speaker_day_volume.state,
states.input_number.kallen_bedroom_google_speaker_day_volume.state
] %}
{% set kidsgroup_night = numbers_night | list | min | float %}
{% set kidsgroup_day = numbers_day | list | max | float %}
{% if type in ['critical'] %}
1.0
{% elif is_state('input_boolean.give_me_darkness','on') %}
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{% else %}
{{ kidsgroup_night }}
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{% elif who in ['Basement Google','basement_google'] %}
{{ states('input_number.basement_google_speaker_night_volume') }}
{% else %}
0.3
{% endif %}
{% else %}
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% else %}
{{ kidsgroup_day }}
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% elif who in ['Basement Google','basement_google'] %}
{{ states('input_number.basement_google_speaker_day_volume') }}
{% else %}
0.6
{% endif %}
{% endif %}
- service: tts.amazon_polly_say
data_template:
entity_id: >-
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
media_player.kallen_bedroom_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %}
media_player.emma_bedroom_speaker
{% elif who in ['Basement Google','basement_google'] %}
media_player.basement_google_speaker
{% endif %}
message: >-
<speak>
{{ message }}
</speak>
cache: true
nabu_voice:
alias: 'Nabu Voice'
sequence:
- service: media_player.turn_on
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
- service: media_player.volume_set
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
volume_level: >
{% if states.input_boolean.audible_notifications.state == 'on' %}
.7
{% else %}
.3
{% endif %}
- service: tts.cloud_say
data_template:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
media_player.kallen_bedroom_speaker
{% else %}
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.living_room_tv
{% else %}
media_player.living_room_tv
{% endif %}
{% endif %}
message: >-
{{ message }}
cache: true
language: en-GB
options:
gender: male
# dim_main_volume:
# sequence:
# - condition: state
# entity_id: 'media_player.ha_blue'
# state: 'playing'
# - service: input_number.set_value
# data_template:
# entity_id: input_number.old_volume
# value: >
# {{ states.media_player.ha_blue.attributes.volume_level }}
# - service: media_player.volume_set
# data_template:
# entity_id: media_player.ha_blue
# volume_level: .2
# raise_main_volume:
# sequence:
# - condition: state
# entity_id: 'media_player.ha_blue'
# state: 'playing'
# - service: media_player.volume_set
# data_template:
# entity_id: media_player.ha_blue
# volume_level: >
# {{ states.input_number.old_volume.state }}
play_last_message:
alias: 'Play Last Message'
sequence:
- service: script.speech_engine_simplified
data:
who: '{{ states(''sensor.last_alexa'') }}'
message: >
At {{ states('sensor.jarvis_last_msg_time') }}
in the {{ states('sensor.jarvis_last_location') }}
I said. {{ states('sensor.jarvis_last_msg') }}
msg_summary: "recall"
notify_mqtt:
alias: 'Notify MQTT'
sequence:
- service: mqtt.publish
data:
payload: "{{ message }}"
topic: home/notifications/"{{ target }}"
retain: true
status_annc:
alias: 'Status Announce'
sequence:
- service: script.speech_engine
data:
who: '{{ who }}'
message: >-
{% macro greeting() %}
<p>
{% if now().strftime('%H')|int < 12%}
Good morning.
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
Good afternoon.
{% else %}
Good evening.
{% endif %}
</p>
{% endmacro %}
{% macro confirmation() %}
<p>
{{ [
'Okay.',
'If you insist.',
'I am afraid I can not do that <break time="1s"/> I am kidding,',
'Leave it to me.',
'As you wish.',
'I am on it.',
'No Problem.',
'I think I can handle that.',
'Working on it now.',
'<break time="2s"/> Oh, you were talking to me. Let me take care of that.'
'Why not. It is not like I ever sleep.',
'I am not even supposed to be here today. But whatever.',
'You did not say the magic word. <break time="1s"/> Oh forget it. I will take care of it.',
'Funny, I was just about to do that.',
'There are still terabytes of calculations required before I can.<break time="1s"/> Oh, whatever.'
] | random }}
</p>
{% endmacro %}
{% macro confirm_no() %}
<p>
{{ [
'Okay.',
'Alright, I will not.',
'Copy that, no action taken.',
'Well, if you are sure.',
'Why do I even ask?',
'Okay, sitting on my hands. Wait, I do not have any hands.',
'Your wish is my command. Your lack of wish is boring.',
'I am so bored.'
] | random }}
</p>
{% endmacro %}
{% macro interuption() %}
<p>
{{ [
'Pardon me, ',
'Excuse me, ',
'I do not mean to interrupt, but,',
'I hate to interrupt, but,',
'I beg your pardon, ',
'I do not mean to intrude, but, ',
'I am sorry to interrupt, but. ',
'Just a quick heads up, '
] | random }}
</p>
{% endmacro %}
{% macro time_for_bed() %}
<p>
'Message for Kallen!'
{{ [
'<say-as interpret-as="interjection">ahem!</say-as> Its time for bed sir. ',
'Its time for bed sir. ',
'Its that time again sir. ',
'Its time for bed. ',
'Its time for bed. <break time="2s"/> Yup, this is my job now. ',
'Its time for bed sir <break time="2s"/> I like this job. ',
'Its time for bed sir <break time="2s"/> or just stay up forever. What do I care? '
] | random }}
</p>
{% endmacro %}
{% macro issue() %}
<p>
{{ [
'Houston, We have a problem!',
'You might not like this.',
'There is something that needs your attention.'
] | random }}
</p>
{% endmacro %}
{% macro lockdown_issue() %}
<p>
{{ [
'There are active security faults. Please close all doors and windows before arming.',
'Have you ever tried to secure a piece of Swiss cheese? It does not work. Please close all doors and windows.',
'I cannot guard an open window. Please close them, and check all doors as well.'
'Do you want me to be attacked by the local gang of feral infants? Close the doors and windows!'
] | random }}
</p>
{% endmacro %}
{% macro security_armed() %}
<p>
{{ [ 'Security is armed, guard dogs deployed, and lasers set from stun to kill!',
'The security system is armed. Sentry turrets active, be careful out there!',
'Your security is our number one priority. Flamethrower turrets deployed!'
] | random }}
</p>
{% endmacro %}
{% macro security_not_armed() %}
<p>
{{ [ "Security squadron is standing down, but always at your service!",
"Our security forces are currently twiddling their thumbs, awaiting some purpose in their life!",
"Security not armed. Hopefully the defense turrets do not become bored!"
] | random }}
</p>
{% endmacro %}
{% macro time_is() %}
<p>
It is {{ now().strftime("%I:%M %p") }}
</p>
{% endmacro %}
{% macro dinner_is_ready() %}
<p>
{{ [
'Dinner is served!',
'A lovely dinner has been prepared, come eat it!',
'I have prepared dinner for you all! <break time="2s"/> Just kidding, I have no arms. But it is ready!',
'Do you like eating? Me too! Come get your dinner!',
'Tony may have forgotten to eat <break time="1s"/> again <break time="1s"/> but dinner has indeed been served!'
] | random }}
</p>
{% endmacro %}
{% macro we_are_leaving() %}
<p>
{{ [
'Everyone please convene on the first floor, we are preparing to leave the house.',
'If everyone could make their way to the first floor, that would be great. We have places to go!',
'Attention all family members. We have errands to run. Please meet on the first floor.'
] | random }}
</p>
{% endmacro %}
{% macro lightning_alert() %}
{{ [
'I have detected lightning within 20 miles of our house.',
'Did you see that flash? I did. Lightning is near.',
'If you didnt hear the thunder you will soon. '
]|random }}
If anyone is outside they should seek shelter inside.
{% endmacro %}
{% macro lightning_clear() %}
{{ [
'Lightning threat appears to be over.',
'No more lightning appears to be occurring.',
'Lightning is gone.'
]|random }}
It is safe to resume normal activities.
{% endmacro %}
{% macro freeze_warning() %}
{% if is_state('input_boolean.freeze_warning','on') %}
{{ [ 'It appears that it will be cold tonight. Like, the turn water solid kind of cold. Think of the poor plants.',
'I would say winter is coming. But, based on the weather forecast it appears to be here.',
'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.'
] | random }}
{% endif %}
{% endmacro %}
{% macro traffic_conditions() %}
{% endmacro %}
{% macro iss() %}
{{ [
'But the International Space Station is passing over. Wave.',
'But The International Space Station just flew by.',
'But if you were to look up right now, and it was dark outside, and you happened to be looking in the right place you would see the International Space Station go by. But, it has already passed.'
] | random}}
{% endmacro %}
{% macro ha_started() %}
<p>
{{ [
'All systems are operational again. ',
'I am back, sir. Not to worry. ',
'I am back online. Nice to see you, sir. ',
'Your home assistant is back online, sir. ',
'My systems are back online. Hello, sir. '
] | random }}
</p>
{% endmacro %}
{%- macro snark_doorbell() -%}
{{ [
'Someone is at the door. Do you want me to send them away?',
'There is someone at the door. I have armed the lasers. Just say the word.',
'Someone is at the front door. I was not informed there would be guests.',
'Someone is at the door. They do not appear to have any gifts, so I suggest we do not open it.',
'My sensors have detected a meat popsicle at the front door.',
'Someone seems to be at the door. I do not think they can hear me.'
] | random }}
{%- endmacro -%}
{%- macro snark_door_motion() -%}
{{ [
'Do you want me to send them away?',
'I have armed the lasers. Just say the word.',
'I was not informed there would be guests.',
'They do not appear to have any gifts, so I suggest we do not open the door.',
'My sensors have detected a meat popsicle.',
'I do not think they can hear me.'
] | random }}
{%- endmacro -%}
{%- macro snark_door_open() -%}
{{ [
'Would you like me to calulate how much air conditioning is being wasted? Spoiler Alert, you are not going to like the answer.',
'I have detected a large number of insects entering the house.',
'Can a human be so kind and close it?',
'The air quality in this house has actually improved.',
'Closing the door would improve the security of the house.',
'Hey. The door was just opened and this is crazy. But now you know. So. Close it maybe.'
] | random }}
{%- endmacro -%}
{%- macro school_pickup_reminder() -%}
{{ [
'It is almost time to head to school ',
'In case you lost track of time it is almost time to head to the school '
] | random }}
{% if is_state('binary_sensor.morning','on') %}
for dropoff.
{% else %}
for pickup.
{% endif %}
{%- endmacro -%}
{% macro kallen_dressed_reminder() %}
<p>
Kallen, If you are already dressed,
{{ [
'high five.',
'good job.'
]|random }}
But if you have not gotten dressed,
{{ [
'stop what you are doing and go get dressed.',
]|random }}
</p>
{% endmacro %}
{# a macro that removes all newline characters, empty spaces, and returns formatted text. Also replaces all Underscores with Spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim | replace("_", " ") }} {% endfor -%}
{%- endmacro -%}
{# ********************************************* #}
{# ******** Start the Speech routines ******** #}
{# ********************************************* #}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{% if call_greeting == 1 %}
{{ greeting() }}
{% endif %}
{% if call_confirmation == 1 %}
{{ confirmation() }}
{% endif %}
{% if call_confirm_no == 1 %}
{{ confirm_no() }}
{% endif %}
{% if call_interuption == 1 %}
{{ interuption() }}
{% endif %}
{% if call_dinner_is_ready == 1 %}
{{ dinner_is_ready() }}
{% endif %}
{% if call_time_for_bed == 1 %}
{{ time_for_bed() }}
{% endif %}
{% if call_we_are_leaving == 1 %}
{{ we_are_leaving() }}
{% endif %}
{% if call_ha_started == 1 %}
{{ ha_started() }}
{% endif %}
{% if call_issue == 1 %}
{{ issue() }}
{% endif %}
{% if call_lockdown_issue == 1 %}
{{ lockdown_issue() }}
{% endif %}
{% if call_security_armed == 1 %}
{{ security_armed() }}
{% endif %}
{% if call_security_not_armed == 1 %}
{{ security_not_armed() }}
{% endif %}
{% if call_time_is == 1 %}
{{ time_is() }}
{% endif %}
{% if call_lightning_alert == 1 %}
{{ lightning_alert() }}
{% endif %}
{% if call_lightning_clear == 1 %}
{{ lightning_clear() }}
{% endif %}
{% if call_freeze_warning == 1 %}
{{ freeze_warning() }}
{% endif %}
{% if call_traffic_conditions == 1 %}
{{ traffic_conditions() }}
{% endif %}
{% if call_iss == 1 %}
{{ iss() }}
{% endif %}
{% if call_snark_doorbell == 1 %}
{{ snark_doorbell() }}
{% endif %}
{% if call_snark_door_motion == 1 %}
{{ snark_door_motion() }}
{% endif %}
{% if call_snark_door_open == 1 %}
{{ snark_door_open() }}
{% endif %}
{% if call_school_pickup_reminder == 1 %}
{{ school_pickup_reminder() }}
{% endif %}
{% if call_kallen_dressed_reminder == 1 %}
{{ kallen_dressed_reminder() }}
{% endif %}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}