> {# Welcome Home #} {%- macro getReport() -%}
"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 %}
{% set endbefore = state_attr('input_datetime.school_day_end','timestamp') - 3600 %} {% set endafter = state_attr('input_datetime.school_day_end','timestamp') + 3600 %} {% set current = ((now().hour * 60 + now().minute) * 60 ) %} {% if is_state('input_boolean.school_today_extended','on') and current > endbefore and current < endafter %} "Welcome home Colin 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 you school day is over! ' ] | random }} {% endif %}
{% 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 Colin! {% endif %} {% if is_state('sensor.anniversary_emmalynn_s_birthday','0') %} Happy Birthday Emmalynn! {% endif %}
As you are no doubt aware, the weather outside is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees {% if is_state('weather.iron_nerd_weather_station','rainy') %} {{ [ 'with rain.', 'with showers.' ] | random }} {% elif is_state('weather.iron_nerd_weather_station','cloudy') %} {{ [ 'with clouds.', 'with cloudy skies.' ] | random }} {% elif is_state('weather.iron_nerd_weather_station','partlycloudy') %} {{ [ 'with some clouds.', 'with partly cloudy skies.', 'with scattered clouds.' ] | random }} {% elif is_state('weather.iron_nerd_weather_station','sunny') %} {% if is_state('sun.sun','above_horizon') %} {{ [ 'and sunny.', 'with sun.' ] | random }} {% else %} {{ [ 'and clear.', 'with clear skies.' ] | random }} {% endif %} {% else %} and {{ states.weather.iron_nerd_weather_station.state }} {% endif %}
"However, inside the house " {% 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 off. " {% 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 %} "The first floor thermostat refuses to be my friend. " {{ [ "I am very sad about this. I mean, who the hell is Honeywell anyway? ", "This makes me indescribably angry, I demand compensation! ", "This is an incredibly minor inconvenience, and I am outraged! ", "I am not sure how to fix that. This one might be on you, buddy. ", "Do you have any tips on how to impress her? " "Smart house, more like fart house! Okay, stop laughing Colin, it wasn't that funny. " ] | random }}
{% if is_state('light.living_room_lights','on') %} "Because it is getting dark, I have turned on the lights for you in the living room, dining room, and mud room. This makes for a total of {{ states.sensor.current_lights_on.state }} lights on. " {% endif %}
{% if is_state('person.christina_stork','Bob Evans') and is_state('input_boolean.work_today','on') %} Tina is at work right now. She will be done at approximately {{ (state_attr('input_datetime.tina_workday_end','timestamp') | int | timestamp_custom('%I:%M %p', False)) }} {% elif is_state('input_boolean.work_today','on') %} Tina has work today. {% endif %}
{%- 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()) -}}