179 lines
8.6 KiB
YAML
179 lines
8.6 KiB
YAML
>
|
|
{# Welcome Home #}
|
|
{%- macro getReport() -%}
|
|
{% from 'speech.jinja' import dadjoke %}
|
|
{% from 'time.jinja' import input_datetime_12hr %}
|
|
<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') - 3600 %}
|
|
{% set endafter = state_attr('input_datetime.kallen_school_day_end','timestamp') + 3600 %}
|
|
{% 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_band_practice','on') %}
|
|
{{ [
|
|
'I hope you also enjoyed band practice this morning! ',
|
|
'I hope the trombone treated you well this morning! ',
|
|
'Band geeks are the best geeks! ',
|
|
'You did not achieve eighth position this morning, did you? ',
|
|
] | 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 %}
|
|
</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>
|
|
{% if is_state('input_boolean.tornado_alarm','on') %}
|
|
"We are under a tornado warning. If you are not already in shelter, you should be. Get on it! "
|
|
{% elif is_state('input_boolean.tornado_watch','on') %}
|
|
{{ [
|
|
"There is currently a tornado watch active. Please keep an eye on the sky and your local weather reports. ",
|
|
"We are currently under a tornado watch. This means the possibility exists for a tornado to form. Be prepared, and be safe! ",
|
|
"The National Weather Service has issued a tornado watch for our area. Be prepared to take shelter if a warning is issued! ",
|
|
] | random }}
|
|
{% endif %}
|
|
{% if is_state('binary_sensor.lightning_warning','on') %}
|
|
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
|
|
{{ [
|
|
"There are reports of lightning in the area, please stay safe. ",
|
|
"My sensors detect the presence of lightning nearby, so you should prepare to take shelter if needed. ",
|
|
"A little birdy told me there is lightning nearby. His feathers were all sticking up, I have no idea why. ",
|
|
"Please exercise caution, as there is lightning in the area. ",
|
|
"That flashing in the sky is not interstellar warfare, it is simply lightning. But you should still be careful outside. ",
|
|
] | random }}
|
|
"The nearest lightning strike is {{ ltgdist }} miles away. "
|
|
{% endif %}
|
|
{% if states('sensor.weatheralerts_active_alerts') > '0' %}
|
|
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weather_alerts_active_corrected') }}. They are as follows. "
|
|
{{ states('sensor.weather_alert_string') }}.
|
|
{% endif %}
|
|
{% if (states('sensor.kdfi_visibility') | int ) < 3 %}
|
|
"In case you are planning to go back out, "
|
|
{{ [
|
|
"It is foggy outside, please exercise caution when driving. ",
|
|
"The visibility outside is quite low. If you will be driving soon, please be cautious. ",
|
|
"It is pea soup outside right now, and that is just as awful to drive in as it is to eat. Be careful! ",
|
|
"Look out the window. Do you notice that you cannot see anything? Bear that in mind if you intend to drive any time soon. ",
|
|
"Be advised, it is very difficult to see outside right now. Drive safely. "
|
|
] | random }}
|
|
{% endif %}
|
|
</p>
|
|
|
|
<p>
|
|
{% if (states('sensor.climate_devices_installed') | int) > 0 %}
|
|
"The current climate control situation is as follows. "
|
|
{% if is_state('input_boolean.master_bedroom_aircon_installed','on') %}
|
|
"the master bedroom temperature is currently {{ state_attr('climate.master_bedroom_aircon','current_temperature') }} degrees. "
|
|
{% if is_state('climate.master_bedroom_aircon','cool') %}
|
|
"and the master bedroom air conditioner is currently 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 currently in fan only mode. "
|
|
{% elif is_state('climate.master_bedroom_aircon','dry') %}
|
|
"and the master bedroom air conditioner is currently moonlighting as a dehumidifier. "
|
|
{% elif is_state('climate.master_bedroom_aircon','off') %}
|
|
"and the master bedroom air conditioner is currently not running. "
|
|
{% 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 %}
|
|
{% else %}
|
|
"There is no air conditioner or temperature sensor currently installed in the master bedroom. "
|
|
{% 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_12hr('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') %}
|
|
"Kallen is at school right now. His pickup time will be at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}. "
|
|
{% elif is_state('input_boolean.kallen_school_today','on') %}
|
|
"Kallen has school today. "
|
|
{% endif %}
|
|
</p>
|
|
|
|
<p>
|
|
{{ states('sensor.emma_nap_info') }}
|
|
</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 -%}
|
|
|
|
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
|
{%- macro cleanup(data) -%}
|
|
{%- for item in data.split("\n") if item | trim != "" -%}
|
|
{{ item | trim }} {% endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
{# a macro to call all macros :) #}
|
|
{%- macro mother_of_all_macros() -%}
|
|
{{ getReport() }}
|
|
{%- endmacro -%}
|
|
|
|
{# Call the macro #}
|
|
{{- cleanup(mother_of_all_macros()) -}} |