Files
Home-Assistant-Configs/templates/speech/welcome_home.yaml

153 lines
6.9 KiB
YAML

>
{# Welcome Home #}
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %}
{% from 'time.jinja' import input_datetime_read %}
{% from 'status.jinja' import emma_sleep %}
{% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %}
<p>
"Welcome home, "
{% if is_state('person.tony_stork','home') and is_state('person.christina_stork','home') %}
"Stork family. "
{% elif is_state('person.tony_stork','home') %}
"Tony. "
{% elif is_state('person.christina_stork','home') %}
"Tina. "
{% else %}
"Whoever you are, Tony must have broken me again. "
{% endif %}
{% if now().strftime('%H')|int < 12 %}
"I hope you're having a great morning! "
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
"I hope your afternoon has been a good one! "
{% else %}
"and good evening. I hope you had a good day! "
{% endif %}
"It is currently {{ now().strftime("%I:%M %p") }}."
</p>
<p>
{% set endbefore = state_attr('input_datetime.kallen_school_day_end','timestamp') - 5400 %}
{% set endafter = state_attr('input_datetime.kallen_school_day_end','timestamp') + 5400 %}
{% set current = ((now().hour * 60 + now().minute) * 60 ) %}
{% if is_state('person.kallen_stork','home') and is_state('input_boolean.kallen_school_today_extended','on') and current > endbefore and current < endafter %}
"Welcome home Collin as well, "
{{ [
'I hope you had a great day at school! ',
'I hope school was as boring, uh I mean exciting as ever! ',
'Hopefully your day at school was educational and fun! ',
'Do not forget to do your homework! ',
'You must be glad that your school day is over! '
] | random }}
{% if is_state('input_boolean.kallen_btb','on') %}
{{ [
'I hope you enjoyed BTB today. ',
'I bet you are exhausted after a couple of extra hours at school. ',
'It is my sincere hope that your extra learning today was enjoyed to the fullest! '
] | random }}
{% endif %}
{% elif is_state('input_boolean.school_cancelled','on') and is_state('person.kallen_stork','home') %}
"I hope you are enjoying your free day off from school, Collin. "
{% endif %}
{% if count_the_days('input_datetime.school_last_day') | int == 0 %}
"Congratulations, today is the last day of school! Have an awesome day!"
{% endif %}
</p>
<p>
{% if is_state('sensor.anniversary_tony_s_birthday','0') %}
Happy Birthday Tony!
{% endif %}
{% if is_state('sensor.anniversary_tina_s_birthday','0') %}
Happy Birthday Tina!
{% endif %}
{% if is_state('sensor.anniversary_kallen_s_birthday','0') %}
Happy Birthday Collin!
{% endif %}
{% if is_state('sensor.anniversary_emmalynn_s_birthday','0') %}
Happy Birthday Emmalynn!
{% endif %}
</p>
<p>
{{ weatherReport('alerts','tts','day') }}
</p>
<p>
{% if (states('sensor.climate_devices_installed') | int) > 0 %}
{% if is_state('input_boolean.master_bedroom_aircon_installed','on') %}
"the master bedroom temperature is {{ states('sensor.master_bedroom_temperature') | int }} degrees. "
{% if not is_state('climate.master_bedroom_aircon','off') %}
{% if is_state('climate.master_bedroom_aircon','cool') %}
"and the master bedroom air conditioner is set for cooling to {{ state_attr('climate.master_bedroom_aircon','temperature') }} degrees. "
{% elif is_state('climate.master_bedroom_aircon','fan_only') %}
"and the master bedroom air conditioner is in fan only mode. "
{% elif is_state('climate.master_bedroom_aircon','dry') %}
"and the master bedroom air conditioner is moonlighting as a dehumidifier. "
{% elif is_state('climate.master_bedroom_aircon','auto') %}
"and the master bedroom air conditioner is making its own decisions. Be afraid, be very afraid. "
{% else %}
"and the master bedroom air conditioner is currently not speaking to me. Was it something I said? "
{% endif %}
{% endif %}
{% endif %}
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') and is_state('fan.emma_air_conditioner','on') %}
"Emma's air conditioner is {{ states('fan.emma_air_conditioner') }}. "
{% endif %}
{% endif %}
</p>
<p>
{% if is_state('light.living_room_lights','on') %}
{% if is_state('binary_sensor.early_night_mode','on') %}
"Because it is getting dark, I have turned on some lights for your convenience. "
{% else %}
"Due to less than optimal sunlight, I have turned on some lights for your convenience. "
{% endif %}
{% endif %}
</p>
<p>
{% set tina = states.person.christina_stork.state %}
{% if tina in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %}
"Tina is at work right now. She will be done at approximately {{ input_datetime_read('input_datetime.tina_workday_end') }}. "
{% elif is_state('input_boolean.work_today','on') %}
"Tina has work today. "
{% endif %}
{% if is_state('input_boolean.kallen_at_school','on') %}
"Collin is at school right now. His pickup time will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
{% elif is_state('input_boolean.kallen_school_today','on') %}
"Collin has school today. "
{% endif %}
</p>
<p>
{{ emma_sleep() }}
</p>
<p>
{% if state_attr('calendar.garbage_collection','start_time') != none %}
{% if count_the_days('calendar.garbage_collection','start_time') | int == 1 %}
{% if state_attr('calendar.garbage_collection','message') == 'Large Garbage Pickup' %}
Tomorrow is the monthly unlimited garbage pickup. Make sure to take out all regular trash, as well as any larger items that need to be disposed of.
{% else %}
Tomorrow is regular garbage pickup. Make sure that all trash cans are emptied and the outside bin has been wheeled to the curb.
{% endif %}
{% elif is_state('calendar.garbage_collection','on') %}
Today is garbage day. Please make sure to wheel the garbage bin back to the house.
{% endif %}
{% endif %}
</p>
<p>
{{ dadjoke() }}
</p>
<p>
{% if is_state('input_boolean.briefing_extras','on') %}
"And now we have the following extra information to pass along. {{ states('input_text.briefing_extras') }} "
{% endif %}
</p>
{%- endmacro -%}
{{- cleanup(getReport()) -}}