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

1005 lines
34 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.

# ATTENTION: The actual notify services are currently defined in configuration.yaml and NOT in this file.
# Just a note because I've already forgotten once ;)
###############################################################################
# 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_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
debug_texts:
name: Debug Texts
icon: mdi:debug-step-over
# 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"
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: "Tony Desktop HASS Agent"
platform: hass_agent_notifier
resource: http://192.168.1.2:5115/notify
- 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
script:
###############################################################################
# Txt Notify
###############################################################################
text_notify_all:
sequence:
- service: notify.all_ios
data_template:
title: '{{ title }}'
message: >
{{ message }}
text_debug:
sequence:
- condition: state
entity_id: input_boolean.debug_texts
state: 'on'
- service: notify.ios_tony
data_template:
title: '{{ title }}'
message: >
{{ message }}
text_notify_tony:
sequence:
- condition: state
entity_id: input_boolean.text_notify_tony
state: 'on'
- service: notify.ios_tony
data_template:
title: '{{ title }}'
message: >
{{ message }}
text_notify_tina:
sequence:
- condition: state
entity_id: input_boolean.text_notify_tina
state: 'on'
- service: notify.ios_tina
data_template:
title: '{{ title }}'
message: >
{{ message }}
text_notify_kallen:
sequence:
- condition: state
entity_id: input_boolean.text_notify_kallen
state: 'on'
- service: notify.ios_kallen
data_template:
title: '{{ title }}'
message: >
{{ message }}
text_notify:
sequence:
- condition: state
entity_id: input_boolean.text_notifications
state: 'on'
- choose:
- conditions:
- condition: template
value_template: '{{ who == "tony"}}'
- condition: state
entity_id: input_boolean.text_notify_tony
state: 'on'
sequence:
- service: notify.ios_tony
data:
title: '{{ title }}'
message: '{{ message }}'
- conditions:
- condition: template
value_template: '{{ who == "tina"}}'
- condition: state
entity_id: input_boolean.text_notify_tina
state: 'on'
sequence:
- service: notify.ios_tina
data:
title: '{{ title }}'
message: '{{ message }}'
- conditions:
- condition: template
value_template: '{{ who == "kallen"}}'
- condition: state
entity_id: input_boolean.text_notify_kallen
state: 'on'
sequence:
- service: notify.ios_kallen
data:
title: '{{ title }}'
message: '{{ message }}'
- conditions:
- condition: template
value_template: '{{ who == "parents"}}'
- condition: state
entity_id: input_boolean.text_notify_parents
state: 'on'
sequence:
- service: notify.ios_parents
data:
title: '{{ title }}'
message: '{{ message }}'
- conditions:
- condition: template
value_template: '{{ who == "nerds"}}'
- condition: state
entity_id: input_boolean.text_notify_nerds
state: 'on'
sequence:
- service: notify.ios_nerds
data:
title: '{{ title }}'
message: '{{ message }}'
default:
- service: notify.all_ios
data:
title: '{{ title }}'
message: '{{ message }}'
text_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
{% else %}
notify.all_ios
{% endif %}
data:
title: '{{ title }}'
message: '{{ message }}'
# data:
# attachment:
# url: '{{ url }}'
# content-type: '{{ content_type }}'
# hide-thumbnail: false
# push:
# sound: '{{ ios_sound }}'
# badge: 0
# category: '{{ ios_category }}'
# entity_id: '{{ camera_entity }}'
text_alert_image:
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
{% else %}
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 }}'
###############################################################################
# Alert Notify
# Conditions:
# => Vacation mode should be off
# Services:
# => Audible
# => iOS
###############################################################################
alert_notify:
sequence:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- service: tts.google_say
data_template:
entity_id: media_player.living_room_tv
message: >
{{ message }}
jarvis_alert:
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:
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: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: group.family
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'] %}
{% set who = 'living_room_echo_dot' %}
script.alexa_voice
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %}
{% set who = 'kallen_bedroom_speaker' %}
script.jarvis_voice
{% elif who in ['master_bedroom','master_bedroom_echo_dot','media_player.master_bedroom_echo_dot','Master Bedroom Echo Dot'] %}
{% set who = 'master_bedroom_echo_dot' %}
script.alexa_voice
{% elif who in ['basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot'] %}
{% set who = 'basement_echo_dot' %}
script.alexa_voice
{% elif who in ['Everywhere','everywhere'] %}
{% set who = 'everywhere' %}
script.alexa_voice
{% else %}
{% set who = 'living_room_echo_dot' %}
script.alexa_voice
{% endif %}
data:
who: '{{ who }}'
message: >
{{ message }}
- service: >-
{% if who in ['Everywhere','everywhere'] %}
{% set who = 'everywhere' %}
script.jarvis_voice
{% endif %}
data:
who: '{{ who }}'
message: >
{{ message }}
# 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:
sequence:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: group.family
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:
sequence:
# - service: media_player.turn_on
# data_template:
# entity_id: >-
# {% 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'] %}
# media_player.master_bedroom_echo_dot
# {% elif who in ['basement','basement_echo_dot'] %}
# media_player.basement_echo_dot
# {% elif who in ['Everywhere','everywhere'] %}
# - media_player.basement_echo_dot
# - media_player.living_room_echo_dot
# - media_player.master_bedroom_echo_dot
# {% else %}
# media_player.living_room_echo_dot
# {% endif %}
# - service: media_player.volume_set
# data_template:
# entity_id: >-
# {% 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'] %}
# media_player.master_bedroom_echo_dot
# {% elif who in ['basement','basement_echo_dot'] %}
# media_player.basement_echo_dot
# {% elif who in ['Everywhere','everywhere'] %}
# - media_player.basement_echo_dot
# - media_player.living_room_echo_dot
# - media_player.master_bedroom_echo_dot
# {% else %}
# media_player.living_room_echo_dot
# {% endif %}
# volume_level: >-
# {% if is_state('input_boolean.audible_notifications.state','on') %}
# .7
# {% else %}
# .3
# {% endif %}
- service: >-
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
notify.alexa_media_living_room_echo_dot
{% elif who in ['master_bedroom','master_bedroom_echo_dot'] %}
notify.alexa_media_master_bedroom_echo_dot
{% elif who in ['basement','basement_echo_dot'] %}
notify.alexa_media_basement_echo_dot
{% elif who in ['Everywhere','everywhere'] %}
notify.alexa_everywhere
{% else %}
notify.alexa_media_living_room_echo_dot
{% endif %}
data:
message: >
{{ message }}
data:
type: tts
# Default audible notifications. Notifcations play on the google devices.
jarvis_voice:
sequence:
- service: media_player.turn_on
data_template:
entity_id: >-
{% if who in ['Everywhere','everywhere'] %}
media_player.kallen_bedroom_speaker
{% elif 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 ['Everywhere','everywhere'] %}
media_player.kallen_bedroom_speaker
{% elif 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.amazon_polly_say
data_template:
entity_id: >-
{% if who in ['Everywhere','everywhere'] %}
media_player.kallen_bedroom_speaker
{% elif 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
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:
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:
sequence:
- service: mqtt.publish
data:
payload: "{{ message }}"
topic: home/notifications/"{{ target }}"
retain: true
status_annc:
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 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 issue() %}
<p>
{{ [
'Houston, We have a problem!',
'You might not like this.',
'There is something that needs your attention.'
] | random }}
</p>
{% endmacro %}
{% macro time_is() %}
<p>
It is {{ now().strftime("%I:%M %p") }}
</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 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 condition 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_interuption == 1 %}
{{ interuption() }}
{% endif %}
{% if call_issue == 1 %}
{{ issue() }}
{% 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 %}
{{ welcome_home }}
{{ speech_message }}
{% 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()) -}}