2020-06-15 21:52:36 +00:00
>-
2019-09-10 13:00:33 +00:00
{%- macro dark_outside() -%}
{{ [
'It is pretty dark outside. I will turn on the outside lights now.' ,
2019-11-25 05:33:13 +00:00
'The sun is offical down. Exterior Cameras are now motion activated.' ,
2019-10-14 16:44:07 +00:00
'The sun has been ushered off the stage. Activating the perimiter cameras.' ,
2019-09-10 13:00:33 +00:00
'It is a little past Sunset. Time to turn on the outside lights. I am on it.' ,
'I will switch on the outside lights. It is getting dark outside.' ,
'Time to turn on the front lights. I will take care of it.' ,
2019-11-24 17:14:12 +00:00
'Switching to night mode! ' ,
'If you have not looked outside lately the light of the day is gone.' ,
'The outside world has switched to dark mode.'
2019-09-10 13:00:33 +00:00
] |random }}
{%- endmacro -%}
{%- macro responsibilities() -%}
{% if now().strftime('%a') == 'Wed' or now().strftime('%a') == 'Sun' %}
Today is {{ now().strftime('%A') }} and {{ now().strftime('%A') }} is garbage day.
{% endif %}
{% if now().strftime('%a') == 'Wed' %}
Both Recycling and regular Garbage goes out. Please take out all of the garbage cans tonight.
{% endif %}
2021-11-11 14:29:24 +00:00
{% if now().strftime('%j')|int(9999)% 2 != 0 %}
2019-09-10 13:00:33 +00:00
Today is Justin's day to do the chores.
{% else %}
Today is Paige's day to do the chores.
{% endif %}
{%- endmacro -%}
{%- macro inside_weather() -%}
Inside the house, it is {{ states.climate.downstairs.attributes['current_temperature'] }} degrees with around {{ states('sensor.downstairs_thermostat_humidity') }} percent humidity.
{%- endmacro -%}
{%- macro outside_weather() -%}
Outside, it is going to be {{ states('sensor.dark_sky_minutely_summary') }}
{%- endmacro -%}
2020-07-28 20:21:08 +00:00
{%- macro lightning() -%}
2021-11-11 14:29:24 +00:00
There have been {{ states('sensor.blitzortung_lightning_counter') }} lightning strikes detected within {{(states('sensor.blitzortung_lightning_distance') | int(9999)/ 1.69) | round (1, 'floor')}} Miles of our House. Please make sure everyone is inside the house.
2020-07-28 20:21:08 +00:00
{%- endmacro -%}
2020-09-07 16:13:46 +00:00
{%- macro fridge() -%}
The internal temperature of the refrigerator is currently {{ states('sensor.blink_blink1_temperature') }} degrees.
{%- endmacro -%}
2019-09-10 13:00:33 +00:00
{%- macro light_check() -%}
{% if states.group.all_lights.state != 'off' -%}
There are
{% for state in states.light if state.state == 'on' -%}
{%- if loop.last -%}
{{ loop.index }}
{%- endif -%}
{%- endfor %}
lights on right now.
{% set comma = joiner(', ') %}
The
{% for group in states.group|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on'
and entity.name.split(' ')[1]|lower == 'lights'
and entity.name.split(' ')[0]|lower != 'all'
and entity.name.split(' ')[0]|lower != 'interior'
-%}
{{ 'and' if loop.last and not loop.first else comma() }}
{{ entity.name|replace('Lights','')}}
{%- endfor -%}
{%- endfor -%}
lights are on.
{%- endif -%}
{%- endmacro -%}
{%- macro window_check() -%}
{% if states.group.entry_points.state != 'off' -%}
{% set comma = joiner(', ') %}
The
{% for state in states.binary_sensor if state.state == 'on' and state.attributes.device_class == 'opening' -%}
{%- endfor %}
{% for group in states.binary_sensor|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on' and entity.attributes.device_class == 'opening' -%}
{{ ' and' if loop.last and not loop.first else comma() }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{% endfor %}
need to be closed.
{%- endif -%}
{%- endmacro -%}
2020-02-14 04:21:11 +00:00
{%- macro lock_check() -%}
{% if states.group.locks.state !='locked' -%}
The
{%- for state in states.lock -%}
{%- endfor %}
{% for group in states.lock|groupby('state') -%}
{%- for entity in group.list if entity.state == 'unlocked' -%}
{{ ' and' if loop.last and not loop.first }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{%- endfor %}
needs to be locked.
{%- endif -%}
{%- endmacro -%}
2019-09-10 13:00:33 +00:00
{%- macro garage_check() -%}
2020-06-08 19:27:38 +00:00
{% if states.group.garage_doors.state !='closed' -%}
2019-09-10 13:00:33 +00:00
The
{%- for state in states.cover -%}
{%- endfor %}
{% for group in states.cover|groupby('state') -%}
{%- for entity in group.list if entity.state == 'open' and entity.attributes.device_class == 'garage' -%}
{{ ' and' if loop.last and not loop.first }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{%- endfor %}
need to be closed.
{%- endif -%}
{%- endmacro -%}
{%- macro medicine() -%}
{% if is_state('input_boolean.medicine', 'off') -%}
It looks like Carlo has not taken his medicine yet. Please make sure Carlo takes his medicine now.
{% endif -%}
{%- endmacro -%}
{%- macro iss() -%}
{% if is_state('binary_sensor.iss', 'on') -%}
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
{% endif -%}
{%- endmacro -%}
{%- macro moon() -%}
2019-11-24 17:14:12 +00:00
{%- if states.sensor.moon.state == 'Full moon' -%}
{{ [
"Check out the full moon tonight!" ,
"Hey look, There is the full moon. " ,
"The moon is huge! And full. " ,
"If you want to see the full moon tonight is the night."
] | random }}
{%- endif -%}
2019-09-10 13:00:33 +00:00
{%- endmacro -%}
{%- macro uv() -%}
2021-11-11 14:29:24 +00:00
{% if states.sensor.dark_sky_uv_index.state|int(9999)>= 6 and states.sensor.dark_sky_uv_index.state|int(9999)<= 7.9 %}
2019-09-10 13:00:33 +00:00
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. You should wear sunscreen if going outside.
2021-11-11 14:29:24 +00:00
{% elif states.sensor.dark_sky_uv_index.state|int(9999)>= 8 and states.sensor.dark_sky_uv_index.state|int(9999)<=10.9 %}
2019-09-10 13:00:33 +00:00
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. This is VERY HIGH. Be sure wear sunscreen and re-apply.
2021-11-11 14:29:24 +00:00
{% elif states.sensor.dark_sky_uv_index.state|int(9999)>= 11 %}
2019-09-10 13:00:33 +00:00
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. This is EXTREME. You should be very cautious going outside.
{% endif %}
{%- endmacro -%}
{%- macro holiday() -%}
{% if states.sensor.holiday.state != '' %}
Today is {{ states.sensor.holiday.state }}.
{% endif %}
{%- endmacro -%}
2019-11-16 00:16:23 +00:00
{# YOUTUBE VIDEO ********* https://www.vcloudinfo.com/2019/11/adding-days-until-sensor-to-my-home-assistant-speech-routines.html #}
2019-10-06 18:18:00 +00:00
{%- macro days_until() -%}
2021-11-11 14:29:24 +00:00
{%- if states('sensor.mothers_countdown') | int(9999)< 20 -%}
2020-10-09 18:34:31 +00:00
and don't forget, there is only {{ states.sensor.mothers_countdown.state }} days until Mothers day!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.fathers_countdown') | int(9999)< 20 -%}
2020-04-07 18:12:13 +00:00
and don't forget, there are {{ states.sensor.fathers_countdown.state }} days until Fathers day!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.easter_countdown') | int(9999)< 15 -%}
2020-05-25 21:44:25 +00:00
and don't forget, there are {{ states.sensor.easter_countdown.state }} days until Easter Sunday!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.thanksgiving_day_countdown') | int(9999)< 10 and states('sensor.thanksgiving_day_countdown') | int(9999)> 0 -%}
2020-11-25 18:20:11 +00:00
and don't forget, there are {{ states.sensor.thanksgiving_day_countdown.state }} days until Thanksgiving
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.thanksgiving_day_countdown') | int(9999)< 1 -%}
2020-11-25 18:20:11 +00:00
and don't forget, Thanksgiving is tomorrow!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.halloween_countdown') | int(9999)< 30 and states('sensor.halloween_countdown') | int(9999)> 0 -%}
2020-10-09 18:34:31 +00:00
and don't forget, there are {{ states.sensor.halloween_countdown.state }} Spooky days until Halloween!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.halloween_countdown') | int(9999)< 1 -%}
2020-11-25 18:20:11 +00:00
and don't forget, Tomorrow is Halloween!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.chanukkah_countdown') | int(9999)< 15 -%}
2020-05-23 18:09:48 +00:00
and don't forget, there are {{ states.sensor.chanukkah_countdown.state }} days until Chanukkah!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.christmas_countdown') | int(9999)< 30 and states('sensor.christmas_countdown') | int(9999)> 0 -%}
2020-10-09 18:34:31 +00:00
and don't forget, there are {{ states.sensor.christmas_countdown.state }} Merry days until Christmas!
2021-11-11 14:29:24 +00:00
{%- elif states('sensor.christmas_countdown') | int(9999)< 1 -%}
2020-11-25 18:20:11 +00:00
and don't forget, Santa Claus is coming tomorrow!
2019-10-06 18:18:00 +00:00
{% endif %}
{%- endmacro -%}
2019-09-10 13:00:33 +00:00
{% macro inspirational_quote() %}
{% set inspirational_quote = [
"and one more thing, Life is about making an impact, make it a positive one. " ,
"and one more thing, Whatever the mind of man can conceive and believe, it can achieve. " ,
"and one more thing, Strive not to be a success, but rather to be of value. " ,
"and one more thing, I attribute my overall success to never giving or taking an excuse. " ,
"and one more thing, You miss one hundred percent of the shots you don’ t take. " ,
"and one more thing, The most difficult thing is the decision to act, the rest is merely tenacity. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, The only difference between who you are and who you want to be, is what you do. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Every strike brings me closer to the next home run. " ,
"and one more thing, Defining thepurpose is the starting point of all achievement. " ,
"and one more thing, Life is not about getting and having, it's about giving and being. " ,
"and one more thing, We become what we think about. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, Be the change that you wish to see in the world. " ,
"and one more thing, A wise man changes his mind but a fool never will. " ,
"and one more thing, Change is inevitable. Growth is optional. " ,
"and one more thing, dont worry, be happy. " ,
2021-08-05 14:01:29 +00:00
"and one more thing, Trust the process. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, There are far better things ahead of us than behind us. " ,
2020-09-23 15:51:08 +00:00
"and one more thing, If you want to go fast, go alone but if you want to go far, go with others. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, The key to success is to focus on goals not obstacles. " ,
"and one more thing, Sometimes we are tested not to show our weaknesses, but to discover our strengths. " ,
"and one more thing, Do something today that your future self will thank you for. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Life is ten percent what happens to you and ninety percent of how you react to it. " ,
"and one more thing, The most common way people give up their power is by thinking they do not have any. " ,
"and one more thing, The mind is everything. What you think, you will become. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, Always try to Live your best life. " ,
"and one more thing, When nothing goes right, go left. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, The best time to plant a tree was twenty years ago. The second best time is now. " ,
"and one more thing, An unexamined life is not worth living. " ,
"and one more thing, Eighty percent of success is showing up. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, Do not stop when you are tired, stop when you are done. " ,
"and one more thing, Luck is being prepared and ready for the opportunities when they come. " ,
"and one more thing, Do not wait for opportunity. Create it." ,
"and one more thing, action is the foundation of success. " ,
"and one more thing, All progress takes place outside the comfort zone. " ,
"and one more thing, You can make mistakes but you should never quit. " ,
"and one more thing, Do not let the fear of losing be greater than the excitement of winning. " ,
"and one more thing, The way to get started is to quit talking and begin doing. " ,
"and one more thing, when you feel like quitting, remember why you started. " ,
"and one more thing, The harder you work, the more luck people will think you have. " ,
"and one more thing, The harder you work for something, the greater you will feel when you achieve it. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Your time is limited, so do not waste it living someone elses life. " ,
"and one more thing, Winning is not everything, but wanting to win is. " ,
"and one more thing, I am not a product of my circumstances. I am a product of my decisions. " ,
"and one more thing, You can never cross the ocean until you have the courage to lose sight of the shore. " ,
"and one more thing, Either you run the day, or the day runs you. " ,
"and one more thing, Whether you think you can or you think you cannot, you will be right. " ,
"and one more thing, The two most important days in your life are the day you are born and the day you find out why. " ,
2020-05-20 22:44:21 +00:00
"and one more thing, Never ruin a good day by thinking about a bad yesterday. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power and magic in it. " ,
"and one more thing, The best revenge is massive success. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, The universe cant put good into your hands unless you let go of the bad." ,
2019-09-10 13:00:33 +00:00
"and one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily. " ,
"and one more thing, Life shrinks or expands in proportion to ones courage. " ,
"and one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced. " ,
2021-03-08 16:03:15 +00:00
"and one more thing, Do not raise your voice, instead improve your argument. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing. " ,
"and one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you. " ,
"and one more thing, The only person you are destined to become is the person you decide to be. " ,
"and one more thing, Go confidently in the direction of your dreams. Live the life you have imagined. " ,
"and one more thing, Certain things catch your eye, but pursue only those that capture the heart. " ,
"and one more thing, Believe you can and you are halfway there. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, Good things take time. " ,
2021-08-06 19:36:12 +00:00
"and one more thing, If you cant beat the Fear... just do it scared! " ,
2020-06-15 22:41:56 +00:00
"and one more thing, There is no place like home. " ,
"and one more thing, Life can be tough but so are you. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Everything you have ever wanted is on the other side of fear. " ,
"and one more thing, Start where you are. Use what you have. Do what you can. " ,
"and one more thing, Fall seven times and stand up eight. " ,
"and one more thing, Everything has beauty, but not everyone can see. " ,
2021-07-20 14:34:14 +00:00
"and one more thing, Life is like riding a bicycle. To keep your balance, you must keep moving. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, in any given moment, we can choose to move forward and grow or retreat." ,
2019-09-10 13:00:33 +00:00
"and one more thing, Happiness is not something readymade. It comes from your own actions. " ,
"and one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on. " ,
2021-07-20 14:34:14 +00:00
"and one more thing, If the wind will not move you forward, take to the oars. " ,
2020-06-15 22:41:56 +00:00
"and one more thing, If you can dream it, you can do it. " ,
2019-09-10 13:00:33 +00:00
"and one more thing, You can not fall if you do not climb. But there’ s no joy in living your whole life on the ground. " ,
"and one more thing, Too many of us are not living our dreams because we are living our fears. " ,
2021-08-06 19:36:12 +00:00
"and one more thing, Live your dreams or live your fears. You can only choose one… " ,
2019-09-10 13:00:33 +00:00
"and one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful. " ,
2020-02-03 15:15:58 +00:00
"and one more thing, If you want to lift yourself up, lift up someone else. " ,
"and one more thing, Be nice to others and nice things will happen to you." ,
"and one more thing, It is nice to be important, but more important to be nice."
2019-09-10 13:00:33 +00:00
] %}
{{inspirational_quote|random}}
{% endmacro %}
2020-06-08 19:27:38 +00:00
{# a macro that removes all newline characters, empty spaces, and returns formatted text and replaces underscores with spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim | replace("_", " ") }} {% endfor -%}
{%- endmacro -%}
2019-09-10 13:00:33 +00:00
{# ********************************************* #}
{# ******** Start the Speech routines ******** #}
{# ********************************************* #}
2020-06-08 19:27:38 +00:00
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{% if call_no_announcement != 1 %}
2021-11-11 14:29:24 +00:00
{% if now().strftime('%H')|int(9999)< 12 and now().strftime('%H')|int(9999)> 6 %}
2020-06-08 19:27:38 +00:00
Good morning.
2021-11-11 14:29:24 +00:00
{% elif now().strftime('%H')|int(9999)>= 12 and now().strftime('%H')|int(9999)< 17 %}
2020-06-08 19:27:38 +00:00
Good afternoon.
{% else %}
Good evening.
{% endif %}
2020-05-25 21:44:25 +00:00
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{# Called from Annoucenments #}
2021-04-30 18:39:08 +00:00
{{ personarriving | default }}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{# Called from Nest when thermostats turn on #}
2021-04-30 18:39:08 +00:00
{{ NestStatus | default }}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if call_inside_weather == 1 %}
{{ inside_weather() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if call_outside_weather == 1 and is_state('sun.sun', 'above_horizon') %}
{{ outside_weather() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2021-11-11 14:50:24 +00:00
{% if (states('sensor.blitzortung_lightning_counter')|int(0)) > 0 %}
2020-07-28 20:21:08 +00:00
{{ lightning() }}
{% endif %}
2021-11-11 14:50:24 +00:00
{% if (states('sensor.blink_blink1_temperature')|int(0)) > 50 and no_fridge != 1 %}
2020-09-07 16:13:46 +00:00
{{ fridge() }}
{% endif %}
2021-04-30 18:39:08 +00:00
{{ DoorOpened | default }}
{{ DoorClosed | default }}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{{ lock_check() }}
{# These two lock statements are sent directly from automations. #}
2021-04-30 18:39:08 +00:00
{{ DoorLocked | default }}
{{ DoorUnLocked | default }}
2020-02-14 04:21:11 +00:00
2020-06-08 19:27:38 +00:00
{% if call_dark_outside == 1 %}
{{ dark_outside() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if call_garage_check == 1 or is_state('sun.sun', 'below_horizon') %}
{{ garage_check() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if (call_window_check == 1 or is_state('sun.sun', 'below_horizon')) or is_state('group.entry_points', 'on') %}
{{ window_check() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2021-04-30 18:39:08 +00:00
{{ NewDevice | default }}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if call_light_check == 1 %}
{{ light_check() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if call_responsibilities == 1 %}
{{ responsibilities() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2021-11-11 14:50:24 +00:00
{% if now().strftime('%H')|int(0) > 21 %}
2020-06-08 19:27:38 +00:00
{{ medicine() }}
{% endif %}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{% if value1 is not none %}
2021-04-30 18:39:08 +00:00
{{ value1 | default }}
2020-06-08 19:27:38 +00:00
{% endif %}
{# call a Random fact about the house or inspiration quote #}
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote]|random)() }}
2019-09-10 13:00:33 +00:00
2020-06-08 19:27:38 +00:00
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}