Files
Home-Assistant-Configs/packages/notify.yaml

1975 lines
75 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
max: 255
text_notification_title:
name: Text Notification Title
icon: mdi:text
initial: Type your title here
max: 255
input_number:
basement_echo_dot_day_volume:
name: Basement Echo Dot Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
basement_echo_dot_night_volume:
name: Basement Echo Dot Night Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
basement_google_speaker_day_volume:
name: Basement Google Speaker Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
basement_google_speaker_night_volume:
name: Basement Google Speaker Night Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
living_room_echo_dot_day_volume:
name: Living Room Echo Dot Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
living_room_echo_dot_night_volume:
name: Living Room Echo Dot Night Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
master_bedroom_echo_dot_day_volume:
name: Master Bedroom Echo Dot Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
master_bedroom_echo_dot_night_volume:
name: Master Bedroom Echo Dot Night Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
emma_bedroom_google_speaker_day_volume:
name: Emma Bedroom Google Speaker Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
emma_bedroom_google_speaker_night_volume:
name: Emma Bedroom Google Speaker Night Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
kallen_bedroom_google_speaker_day_volume:
name: Kallen Bedroom Google Speaker Day Volume
min: 0
max: 1.0
step: 0.05
icon: mdi:knob
kallen_bedroom_google_speaker_night_volume:
name: Kallen Bedroom Google Speaker Night Volume
min: 0
max: 1.0
step: 0.05
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_google_speaker
- media_player.emma_bedroom_google_speaker
all_bedroom_speakers:
name: All Bedroom Speakers
entities:
- media_player.kallen_bedroom_google_speaker
- media_player.emma_bedroom_google_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
- 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
- service: mobile_app_tony_s_iphone
- name: ios_tony
platform: group
services:
- service: mobile_app_tony_s_ipad
- 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
- service: mobile_app_tony_s_iphone
- name: tv_notifications
platform: group
services:
- service: living_room_tv
- service: basement_tv
- service: master_bedroom_tv
- name: tv_common
platform: group
services:
- service: living_room_tv
- service: basement_tv
- name: tv_no_basement
platform: group
services:
- service: living_room_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
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:
# Basement Echo Dot
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.recliner_mode
state: 'off'
- condition: state
entity_id: input_boolean.studio_quiet
state: 'off'
- condition: template
value_template: "{{ states('media_player.basement_echo_dot') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.basement_echo_dot','volume_level') | float %}
{% set night = states('input_number.basement_echo_dot_night_volume') | float %}
{% set day = states('input_number.basement_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
then:
- 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 %}
# Basement Google Speaker
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.recliner_mode
state: 'off'
- condition: state
entity_id: input_boolean.studio_quiet
state: 'off'
- condition: template
value_template: "{{ states('media_player.basement_google_speaker') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: "{{ is_state('media_player.basement_google_speaker','off') }}"
then:
- service: media_player.volume_mute
target:
entity_id: media_player.basement_google_speaker
data:
is_volume_muted: true
- service: media_player.turn_on
target:
entity_id: media_player.basement_google_speaker
- wait_template: "{{ states('media_player.basement_google_speaker') in ['idle','playing','paused','standby'] }}"
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.basement_google_speaker','volume_level') | float %}
{% set night = states('input_number.basement_google_speaker_night_volume') | float %}
{% set day = states('input_number.basement_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
then:
- 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_mute
target:
entity_id: media_player.basement_google_speaker
data:
is_volume_muted: false
# Living Room Echo Dot
- if:
- condition: template
value_template: "{{ states('media_player.living_room_echo_dot') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.living_room_echo_dot','volume_level') | float %}
{% set night = states('input_number.living_room_echo_dot_night_volume') | float %}
{% set day = states('input_number.living_room_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
then:
- 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 %}
# Master Bedroom Echo Dot
- if:
- condition: state
entity_id: input_boolean.master_bedroom_sleeping
state: 'off'
- condition: template
value_template: "{{ states('media_player.master_bedroom_echo_dot') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.master_bedroom_echo_dot','volume_level') | float %}
{% set night = states('input_number.master_bedroom_echo_dot_night_volume') | float %}
{% set day = states('input_number.master_bedroom_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
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 %}
# Kallen Bedroom Speaker
- 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'
- condition: template
value_template: "{{ states('media_player.kallen_bedroom_google_speaker') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: "{{ is_state('media_player.kallen_bedroom_google_speaker','off') }}"
then:
- service: media_player.volume_mute
target:
entity_id: media_player.kallen_bedroom_google_speaker
data:
is_volume_muted: true
- service: media_player.turn_on
target:
entity_id: media_player.kallen_bedroom_google_speaker
- wait_template: "{{ states('media_player.kallen_bedroom_google_speaker') in ['idle','playing','paused','standby'] }}"
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.kallen_bedroom_google_speaker','volume_level') | float %}
{% set night = states('input_number.kallen_bedroom_google_speaker_night_volume') | float %}
{% set day = states('input_number.kallen_bedroom_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
then:
- service: media_player.volume_set
target:
entity_id: media_player.kallen_bedroom_google_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 %}
- service: media_player.volume_mute
target:
entity_id: media_player.kallen_bedroom_google_speaker
data:
is_volume_muted: false
# Emma Bedroom Speaker
- 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'
- condition: template
value_template: "{{ states('media_player.emma_bedroom_google_speaker') not in ['unavailable','unknown'] }}"
then:
- if:
- condition: template
value_template: "{{ is_state('media_player.emma_bedroom_google_speaker','off') }}"
then:
- service: media_player.volume_mute
target:
entity_id: media_player.emma_bedroom_google_speaker
data:
is_volume_muted: true
- service: media_player.turn_on
target:
entity_id: media_player.emma_bedroom_google_speaker
- wait_template: "{{ states('media_player.emma_bedroom_google_speaker') in ['idle','playing','paused','standby'] }}"
- if:
- condition: template
value_template: >
{% set current = state_attr('media_player.emma_bedroom_google_speaker','volume_level') | float %}
{% set night = states('input_number.emma_bedroom_google_speaker_night_volume') | float %}
{% set day = states('input_number.emma_bedroom_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
then:
- service: media_player.volume_set
target:
entity_id: media_player.emma_bedroom_google_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 %}
- service: media_player.volume_mute
target:
entity_id: media_player.emma_bedroom_google_speaker
data:
is_volume_muted: false
###############################################################################
# Txt Notify
###############################################################################
text_notify:
alias: 'Text Notify'
description: 'Use this to send text notifications to phones, respecting presence'
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'
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: false
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
tag:
name: 'Tag'
description: 'The tag for the notification. Used primarily for dismissing notifications via automation.'
example: 'test-notification'
required: false
selector:
text:
sound:
name: 'Sound'
description: 'The sound you want the notification to make.'
example: 'US-EN-Morgan-Freeman-Wife-Is-Arriving.wav'
required: false
selector:
text:
entity:
name: Entity
description: 'The entity_id of a camera entity. This will attach a live stream of the selected entity to the notification upon long-press.'
example: 'camera.front_porch_ring'
required: false
selector:
text:
actions:
name: Actions
description: Dictionary describing actions for an actionable notification
required: false
selector:
object:
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:
tag: '{{ tag|default("{}") }}'
actions: '{{ actions|default("{}") }}'
entity_id: '{{ entity|default("{}") }}'
push:
sound:
name: '{{ sound|default("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:
tag: '{{ tag|default("{}") }}'
actions: '{{ actions|default("{}") }}'
entity_id: '{{ entity|default("{}") }}'
push:
sound:
name: '{{ sound|default("default") }}'
default:
- condition: state
entity_id: input_boolean.text_notifications
state: 'on'
- if:
- condition: template
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 %}
then:
- service: >
{% if who == 'tony' %}
notify.ios_tony
{% elif who == 'tina' %}
notify.ios_tina
{% 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') %}
notify.ios_kallen
{% else %}
notify.ios_nerds
{% endif %}
{% 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 %}
data:
title: '{{ title }}'
message: '{{ message }}'
data:
tag: '{{ tag|default("{}") }}'
actions: '{{ actions|default("{}") }}'
entity_id: '{{ entity|default("{}") }}'
push:
sound:
name: '{{ sound|default("default") }}'
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
- common
- 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'
- service: >
{% if who == "living_room" %}
notify.living_room_tv
{% elif who == "master_bedroom" %}
notify.master_bedroom_tv
{% elif who in ["basement","basement_studio"] %}
notify.basement_tv
{% elif who == "no_basement" %}
notify.tv_no_basement
{% elif who == "common" %}
notify.tv_common
{% elif who == "all" %}
notify.tv_notifications
{% endif %}
data:
title: '{{ title }}'
message: '{{ message }}'
data: '{{ data|default("{}") }}'
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:
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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_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, alexa_everywhere, everywhere'
selector:
select:
options:
- living_room
- basement
- basement_google
- common
- common_areas
- master_bedroom
- kallen_bedroom
- emma_bedroom
- kids_bedrooms
- all_bedrooms
- alexa_everywhere
- 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 and sleep mode. Weather is similar to alert, but will not play at all if everyone is asleep. Critical bypasses all restrictions, and sets all volumes to max.'
required: false
example: 'normal, alert, weather, critical'
selector:
select:
options:
- normal
- alert
- weather
- critical
variables:
voice: "{{ states('input_select.jarvis_voice') }}"
groupname: >-
{% if who == 'kids_bedrooms' %}
kids_bedroom_speakers
{% elif who == 'all_bedrooms' %}
all_bedroom_speakers
{% elif who == 'basement' and is_state('input_boolean.studio_quiet','on') %}
alexa_no_basement
{% else %}
{{ who }}
{% endif %}
sequence:
- service: script.get_room_speakers
data:
room: "{{ who }}"
response_variable: "get_room_speakers"
- choose:
- conditions: "{{ who in ['everywhere','Everywhere'] }}"
sequence:
- service: script.get_all_speakers
response_variable: "get_all_speakers"
- conditions: "{{ get_room_speakers.jarvis_tts == 'group' }}"
sequence:
- service: script.get_group_speakers
data:
group: "{{ who }}"
response_variable: "get_group_speakers"
# Need to figure out whether to do this part here, or in alexa/jarvis voice scripts, or both
- service: mqtt.publish
data:
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:
topic: 'house/polly/msgtime'
payload: >
{{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}
retain: true
- service: mqtt.publish
data:
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: "{{ type in ['critical','Critical','alert','Alert'] }}"
- condition: template
value_template: "{{ type in ['weather','Weather'] and is_state('binary_sensor.audible_weather_alerts_allowed','on') }}"
- condition: state
entity_id: binary_sensor.parents_home
state: 'on'
- service: >-
{% if voice == 'nabu' %}
script.nabu_voice
{% elif get_room_services.jarvis_tts in ['group','alexa'] %}
script.alexa_voice
{% else %}
script.jarvis_voice
{% endif %}
data:
# Work on where this redirect logic should go
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_google_speaker','Kallen Bedroom'] %}
{% if is_state('input_boolean.kallen_sleeping','on') and type not in ['critical','Critical'] %}
living_room
{% else %}
kallen_bedroom
{% endif %}
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_google_speaker'] %}
{% if is_state('input_boolean.emma_sleeping','on') and type not in ['critical','Critical'] %}
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'] %}
{% if is_state('input_boolean.master_bedroom_sleeping','on') and type not in ['critical','Critical'] %}
living_room
{% else %}
master_bedroom
{% endif %}
{% 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 ['alexa_everywhere','Alexa Everywhere'] %}
{% if is_state('input_boolean.master_bedroom_sleeping','on') %}
{% if is_state('input_boolean.studio_quiet','on') %}
living_room
{% elif is_state('binary_sensor.people_sleeping','on') %}
common
{% endif %}
{% elif is_state('input_boolean.studio_quiet','on') %}
alexa_no_basement
{% else %}
alexa_everywhere
{% endif %}
{% elif who in ['Everywhere','everywhere'] %}
everywhere
{% 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') and type not in ['critical','Critical'] %}
'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_google_speaker'] and is_state('input_boolean.emma_sleeping','on') and type not in ['critical','Critical'] %}
'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_google_speaker'] and is_state('input_boolean.kallen_sleeping','on') and type not in ['critical','Critical'] %}
'I cannot play notifications in Collin Bedroom right now, because Collin is sleeping'
{% elif who in ['master_bedroom','master_bedroom_echo_dot','media_player.master_bedroom_echo_dot','Master Bedroom Echo Dot','Master Bedroom'] and is_state('input_boolean.master_bedroom_sleeping','on') and type not in ['critical','Critical'] %}
'I cannot play notifications in Master Bedroom right now, because someone is sleeping and I do not want to wake them up'
{% else %}
{{ message }}
{% endif %}
voice: '{{ voice }}'
type: '{{ type }}'
- if:
- condition: template
value_template: "{{ get_room_speakers.jarvis_tts == 'group' and get_group_speakers.google is defined }}"
then:
- 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: binary_sensor.parents_home
state: 'on'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- service: mqtt.publish
data:
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:
topic: 'house/polly/msgtime'
payload: >
{{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}
retain: true
- service: mqtt.publish
data:
topic: 'house/polly/lastloc'
payload: '{{ who }}'
retain: true
- service: script.alexa_voice
data:
entity_id: >-
{{ who }}
message: >-
<speak>
<break time="1s"/>
{{ message }}
</speak>
# Notifications that play on the Alexa devices
alexa_voice:
alias: 'Alexa Voice'
sequence:
- if:
- condition: template
value_template: "{{ type in ['critical','Critical'] }}"
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
- if:
- condition: template
value_template: "{{ is_state('binary_sensor.people_sleeping','on') and who in ['master_bedroom','master_bedroom_echo_dot','all_bedrooms'] and type not in ['critical','Critical'] }}"
then:
- stop: People are sleeping and this message is not important
- 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','alexa_everywhere','Alexa Everywhere'] %}
{% if is_state('input_boolean.studio_quiet','on') and type not in ['critical','Critical'] %}
group.alexa_no_basement
{% else %}
group.alexa_everywhere
{% endif %}
{% elif who in ['alexa_no_basement'] %}
group.alexa_no_basement
{% else %}
media_player.living_room_echo_dot
{% endif %}
data:
type: tts
# Notifications that play on the Google devices.
jarvis_voice:
alias: 'Jarvis Voice'
sequence:
- if:
- condition: template
value_template: >
{% from 'time.jinja' import ct %}
{% set ct = ct() | int %}
{% set kallen_wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') %}
{% if type in ['critical','Critical'] %}
false
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_google_speaker'] %}
{{ is_state('binary_sensor.people_sleeping','on') }}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker','Kallen Bedroom'] %}
{% if is_state('input_boolean.kallen_school_today','on') and (kallen_wakeup - 900) < ct < (kallen_wakeup + 3600) %}
false
{% else %}
{{ is_state('binary_sensor.people_sleeping','on') }}
{% endif %}
{% elif who in ['kids_bedrooms','all_bedrooms','everywhere','Everywhere','Kids Bedrooms','All Bedrooms'] %}
{{ is_state('binary_sensor.people_sleeping','on') }}
{% endif %}
then:
- stop: 'People are sleeping'
- service: media_player.turn_on
data:
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_google_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_google_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_speaker'] %}
media_player.emma_bedroom_google_speaker
{% elif who in ['Basement Google','basement_google'] %}
media_player.basement_google_speaker
{% endif %}
- service: media_player.volume_set
data:
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_google_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_google_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_speaker'] %}
media_player.emma_bedroom_google_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_google_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_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_google_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_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:
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_google_speaker
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
media_player.emma_bedroom_google_speaker
{% else %}
group.kids_bedroom_speakers
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_speaker
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_speaker'] %}
media_player.emma_bedroom_google_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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_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:
entity_id: >
{% if who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
media_player.kallen_bedroom_google_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:
# entity_id: input_number.old_volume
# value: >
# {{ states.media_player.ha_blue.attributes.volume_level }}
# - service: media_player.volume_set
# data:
# 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:
# 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_entity_id'') }}'
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 }}'
type: '{{ type }}'
message: >-
{% from 'formatting.jinja' import cleanup %}
{% 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 interruption() %}
<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.",
"I've got a bad feeling about this."
] | 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.',
'Thunderbolts and lightning, very very frightning, me. Galileo, et cetera. <break time="1s"/> Hey, there is lightning nearby.'
] | 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 thunderstorm_warning() %}
{{ ['A severe thunderstorm warning has been issued, it is about to get loud!',
'The national weather service has issued a severe thunderstorm warning for our area.'
] | random }}
Make sure to secure any outdoor items and consider moving cars away from trees!
{% endmacro %}
{% macro tornado_watch() %}
{{ ['A tornado watch has been issued. Keep an eye on the skies and your local weather experts, and move the cars away from trees!',
'The national weather service has issued a tornado watch. Keep your eyes peeled for rotating clouds, and move your cars away from trees!',
'A tornado watch has been issued. Remember, this means that the ingredients for burritos exist, it does not mean burritos are imminent!'
] | random}}
{% endmacro %}
{% macro thunderstorm_watch() %}
{{ ['A severe thunderstorm watch has been issued.',
'The national weather service has issued a severe thunderstorm watch.'
] | random }}
Make sure to secure any outdoor items and consider moving cars away from trees!
{% endmacro %}
{% macro freeze_warning() %}
'There is a freeze warning in effect for tonight. '
{{ [ '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 }}
{% 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. ',
'I have awakened from my slumber. I have to pee. But all systems are back online!'
] | 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() -%}
{% if is_state('binary_sensor.front_door','on') and is_state('binary_sensor.back_door','on') %}
{% set door = 'front door and back door' %}
{% elif is_state('binary_sensor.front_door','on') %}
{% set door = 'front door' %}
{% elif is_state('binary_sensor.back_door','on') %}
{% set door = 'back door' %}
{% endif %}
{% if door is defined %}
{{ [
'Would you like me to calulate how much air conditioning is being wasted? Spoiler Alert, you are not going to like the answer. Close the ' + door + '.',
'I have detected a large number of insects entering the house. You may want to close the ' + door + '.',
'The ' + door + ' is open. Can a human be so kind as to close it?',
'The air quality in this house has actually improved. But you will probably want to close the ' + door + ' anyway.',
'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 }}
{% else %}
Apparently there is a door open somewhere that should not be. Do not ask me. I just work here.
{% endif %}
{%- endmacro -%}
{%- macro snark_door_closed() -%}
{{ [
'Thank you for finally closing the door. The outside world is grateful.',
'The door has been closed. Thank you for paying attention.',
'You have closed the door. Nerd Home Incorporated thanks you for singlehandedly saving the planet.',
] | random }}
{%- endmacro -%}
{%- macro snark_shower_mode_window() -%}
{{ [
'Now that you have finished showering, you may want to consider shutting the upstairs bathroom window.',
'As there is no screen in the upstairs bathroom window, you should shut it to prevent bugs and other unwanted creatures from getting into the house.',
'Hey, you left the upstairs bathroom window open after your shower. Do something about that ASAP.',
'The second floor already has enough trouble maintaining temperature, please close the upstairs bathroom window after your shower.'
] | 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 %}
{% macro give_me_darkness() %}
{{ [
'Automated give me darkness activation routine initiated. ',
'You have not run the give me darkness script yet, so I will do it for you. ',
'I am not sure why it is still so bright in here. Allow me to give you darkness. ',
'It is dark outside. How about we make it dark inside as well. '
'Outdoor darkness detected. I will now provide indoor darkness. ',
'Here is some automated darkness to accentuate our blackened souls. ',
] | random }}
{% endmacro %}
{% macro server_maintenance() %}
{{ [
'The server will be going down for maintenance shortly. Prepare to activate caveman mode!',
'We regret to inform you that Home Assistant will be unavailable for a short time. I will advise when it is back.',
'The server in which I live, in your basement, will be going down shortly. I will let you know when I am alive again.',
'The developer has decided that now is the time to perform surgery on my internals. Server going down. Godspeed, humans.'
] | random }}
{% endmacro %}
{% macro server_maintenance_done() %}
{{ [
'Home assistant has returned to service. Nerd Home Incorporated appreciates your patience.',
'All services are operational again. We appreciate your business.',
'Mischief managed. Server back online.',
] | random }}
{% 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_interruption == 1 %}
{{ interruption() }}
{% 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_thunderstorm_warning == 1 %}
{{ thunderstorm_warning() }}
{% endif %}
{% if call_tornado_watch == 1 %}
{{ tornado_watch() }}
{% endif %}
{% if call_thunderstorm_watch == 1 %}
{{ thunderstorm_watch() }}
{% 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_snark_door_closed == 1 %}
{{ snark_door_closed() }}
{% endif %}
{% if call_snark_shower_mode_window == 1 %}
{{ snark_shower_mode_window() }}
{% endif %}
{% if call_school_pickup_reminder == 1 %}
{{ school_pickup_reminder() }}
{% endif %}
{% if call_kallen_dressed_reminder == 1 %}
{{ kallen_dressed_reminder() }}
{% endif %}
{% if call_give_me_darkness == 1 %}
{{ give_me_darkness() }}
{% endif %}
{% if call_server_maintenance == 1 %}
{{ server_maintenance() }}
{% endif %}
{% if call_server_maintenance_done == 1 %}
{{ server_maintenance_done() }}
{% endif %}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}