> {# Nightly Briefing #} {%- macro getReport() -%}
"Good evening. It is {{ now().strftime("%I:%M %p") }}. As the day reaches its end, here are a few items to wrap things up. "
{% if is_state('input_boolean.tony_streaming_today','on') %} "Tony will be streaming tonight. The studio is scheduled to go online at {{ (state_attr('input_datetime.tony_streaming_start_time','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% endif %} {% if is_state('sensor.school_tomorrow','on') %} {% if is_state('sensor.band_tomorrow','on') %} "Colin has school tomorrow, and there will be band practice in the morning at {{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}. " {% else %} "Colin has school tomorrow at {{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}. " {% endif %} {% else %} "Colin does not have school tomorrow. " {% endif %} {% if is_state('input_boolean.work_today','on') and states('person.christina_stork') in ['Bob Evans','BobEvans'] %} "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 at {{ (state_attr('input_datetime.tina_workday_start','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_boolean.work_today','off') and is_state('sensor.work_tomorrow','on') %} "Tina has work tomorrow at {{ as_timestamp(strptime(state_attr('calendar.family_tinawork','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}. " {% elif is_state('input_boolean.work_today','off') and is_state('sensor.work_tomorrow','off') %} "Tina appears to have tomorrow off from work. " {% else %} "Tony is an idiot and appears to have broken my awareness of Tina's schedule. Boo this man. " {% endif %}
{% set dow = as_timestamp(now()) | timestamp_custom('%A') %} {% if dow == 'Monday' %} "I hope that by now you have remembered to take the garbage can to the curb. " {% endif %} {% if dow == 'Tuesday' %} "At this point you should have already done this, but make sure the garbage can is brought back to the house! " {% endif %}"Bedroom climate scheduling will be as follows. " {% if is_state('input_boolean.master_bedroom_aircon_installed','on') %} {% if is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','AC') and is_state('input_boolean.hot_day','on') %} "Today was a hot day, so the master bedroom air conditioner will activate cooling mode a bit earlier tonight at {{ (state_attr('input_datetime.master_bedroom_cooling','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','AC') %} "The master bedroom air conditioner will activate cooling mode at {{ (state_attr('input_datetime.master_bedroom_cooling','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','Fan') %} "The master bedroom air conditioner will activate fan only mode at {{ (state_attr('input_datetime.master_bedroom_cooling','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_master_bedroom_aircon','N/A') %} "The master bedroom air conditioner will remain inactive tonight. " {% endif %} {% endif %} {% if is_state('input_select.scheduled_climate_mode_master_bedroom_fan','Fan') %} "The master bedroom fan will activate at {{ (state_attr('input_datetime.master_bedroom_fan','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_master_bedroom_fan','N/A') %} "The master bedroom fan will remain inactive tonight. " {% endif %} {% if is_state('input_boolean.kallen_overnight','off') %} {% if is_state('input_select.scheduled_climate_mode_kallen_fan','Fan') %} "Colins fan will activate at {{ (state_attr('input_datetime.kallen_bedtime','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_kallen_fan','White Noise') %} "Colins white noise generator will activate at {{ (state_attr('input_datetime.kallen_bedtime','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_kallen_fan','N/A') %} "Colins room will have no devices activated tonight. " {% endif %} {% else %} "Colins room will be left alone, as he is spending the night elsewhere tonight. " {% endif %} {% if is_state('input_select.scheduled_climate_mode_nursery_aircon','AC') %} "Emma's air conditioner will be activated at {{ (state_attr('input_datetime.nursery_cooling','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_nursery_aircon','White Noise') %} "Emma's white noise generator will activate at {{ (state_attr('input_datetime.nursery_cooling','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. " {% elif is_state('input_select.scheduled_climate_mode_nursery_aircon','N/A') %} "Emma's room will have no devices activated tonight. " {% endif %}
{% 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 %}
"This briefing is a work in progress. Stay tuned in the coming days for more updates! "
{%- 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()) -}}