> {# DAily Briefing #} {%- macro getReport() -%}
{% if now().strftime('%H')|int < 12 %} Good morning. {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} Good afternoon. {% else %} Good evening. {% endif %}
{% if is_state('binary_sensor.morning','on') %}Today is {{states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}.
{% else %}It is {{ now().strftime("%I:%M %p") }}
{% endif %}The Weather in Grayson is {{states('sensor.acurite_6045m_3078_f')|round}} degrees {% if is_state('weather.home', 'rainy') %} {{ [ 'with rain.', 'with showers.' ] | random }} {% elif is_state('weather.home', 'cloudy') %} {{ [ 'with clouds.', 'with cloudy skies.' ] | random }} {% elif is_state('weather.home', 'partlycloudy') %} {{ [ 'with some clouds.', 'with partly cloudy skies.', 'with scattered clouds' ] | random }} {% elif is_state('weather.home', '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.home.state }} {% endif %} {% if states.sensor.weatheralerts_active_alerts.state | int > 0 %} There are currently {{states.sensor.weatheralerts_active_alerts.state }} active weather alerts for our area. {% endif %} {% if is_state('binary_sensor.evening','on') %} The overnight forecast says we can expect {{ states.sensor.nws_overnight_forecast.state }} {% else %} The current forecast says we should expect {{ states.sensor.nws_current_forecast.state }} {% if is_state('input_boolean.freeze_warning','on') %} And based on the forecasted low, It will be near or below freezing. {{ [ 'So, Someone might want to bring the lemon tree in. ', 'Like, the turn water solid kind of cold. Do not leave the lemon tree out to die.', 'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on you.', 'I would say winter is coming. But, based on the weather forecast it appears to be here.', 'I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.' ] | random }} {% endif %} {% endif %}
{% if is_state('sun.sun', 'below_horizon') %} You have {% set seconds = as_timestamp(states.sun.sun.attributes.next_rising)-now().timestamp() %} {% set hours = seconds / 60 %} {% if seconds / ( 60 * 60 ) > 1 %} {{ (seconds // ( 60 * 60 )) | int }} hours {% else %} {{ (seconds // 60) | int }} minutes {% endif %} {{ [ 'until the sun rises.', 'until the sun is up.', 'before the sun officially rises. ' ]|random }} {% else %} You have {% set seconds = as_timestamp(states.sun.sun.attributes.next_setting)-now().timestamp() %} {% set hours = seconds / 60 %} {% if seconds / ( 60 * 60 ) > 1 %} {{ (seconds // ( 60 * 60 )) | int }} hours {% else %} {{ (seconds // 60) | int }} minutes {% endif %} {{ [ 'until the sun sets for the day.', 'until the sun slips below the horizon.', 'before the sun officially sets. ' ]|random }} {% endif %}
{% if is_state('binary_sensor.morning','on') %}Overnight, {%- if is_state('sensor.front_door_motion_away_count','0') %} There was no motion detected at the front door. {% else %} I detected motion at the front door {{ states.sensor.front_door_motion_away_count.state | int }} times. {% endif %}
{% endif %} {% set dow = as_timestamp(now()) | timestamp_custom('%A') %}
You have some things on the calendar.
{% if is_state('input_boolean.heartworm', 'on') %}
Today is the day Winston gets his heartworm medicine.
{% endif %}
{% if dow == 'Sunday' and is_state('binary_sensor.midday','on') %}
{% if now().strftime('%H')|int > 17 %}
{{ [ 'Do not forget to do Skylars laundry. ',
'Skylars laundry needs to be done today. ',
] | random }}
{% endif %}
{% endif %}
{% if dow == 'Monday' %}
{% if is_state('binary_sensor.evening','on') %}
{{ [ 'Do not forget tomorrow is Trash Day. ',
' The trash and recycle should go out.'
] | random }}
{% endif %}
{% endif %}
{% if dow == 'Tuesday' %}
{% if is_state('binary_sensor.evening','on') %}
{{ [ 'Do not forget to bring in the trash cans. ',
'The trash cans will feel lonely if you leave them out all night. ',
'The Pickup today will be at {{(state_attr('input_datetime.school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }}
{% if 'Digital Learning' in states('sensor.school_event') %}
But it is a digital learning day so the commute will be short.
{% endif %}
{% if 'Early Release' in states('sensor.school_event') %}
And It is early release!
{% endif %}
{% endif %}
{% if is_state('input_boolean.school_today', 'on') %}
{% if is_state('sensor.school_lunch', 'Nothing') %}
I am not sure what the school menu is for today, so plan on Skylar taking his lunch
{% else %}
Today's school lunch is {{ states.sensor.school_lunch.state }}, so he might be interested in buying his lunch.
{% endif %}
{% endif %}
{% if states.sensor.school_end_days2go.state | int <= 35 and states.sensor.school_end_days2go.state | int > 0 %}
{{ [ 'Oh, and look at that.',
'For those trying to keep count. ',
'In case you were wondering.',
'Also, did you know.'
] | random }}
There are only {{ states.sensor.school_end_days2go.state }} days left in the school year!
{% endif %}
{% if states.sensor.school_end_days2go.state | int == -1 -%}
Today is the first day of Summer Break!
{%- endif %}
{% if is_state('calendar.skylar_events', 'on') %}
Skylar has {{ states.calendar.skylar_events.attributes.message }} today as well!
{% endif %}
{% endif %}
{% if states.sensor.vacation_days2go.state | int < 32 and states.sensor.vacation_days2go.state | int < 0 and states.sensor.vacation_days2go.state != 'unknown' %}
{% if states.sensor.vacation_days2go.state | int > 1 %}
There are {{ states.sensor.vacation_days2go.state }} days until {{ states.calendar.vacation.attributes.message }}!
{% else %}
Oh, and there is {{ states.sensor.vacation_days2go.state }} one more sleep until {{ states.calendar.vacation.attributes.message }}!
{% endif %}
{% endif %}
Around the house, {% if is_state('binary_sensor.morning','on') %} {% if is_state('input_boolean.skylar_awake', 'on') %} Skylar was up and moving at {{ states.input_datetime.skylar_awake_at.state }}. {% if is_state('media_player.theater_tv', 'on') %} and he appears to be in the Theater. {% elif is_state('media_player.croft_tv', 'playing') %} and he appears to be in the Croft watching {{ states.media_player.croft_tv.attributes.app_name }} {% elif is_state('input_boolean.skylar_school', 'on') %} and he appears to be at School. {% else %} but I currently cannot find him on any of my sensors. {% endif %} {% else %} It doesn't appear that Skylar is out of bed yet. {% endif %} {% endif %} {%- if is_state('climate.home','off') %} The internal climate control system is off. The temperature inside is {{ states.climate.home.attributes.current_temperature }} degrees. {%- elif is_state('climate.home','heat_cool') %} The internal climate control system will try to keep the temperature between {{ states.climate.home.attributes.target_temp_low }} and {{ states.climate.home.attributes.target_temp_high }} degrees. {% else %} The internal climate control system is set to {{ states.climate.home.state }} with a current temperature of {{ states.climate.home.attributes.current_temperature }} which is {%- if states.climate.home.attributes.current_temperature | int - states.climate.home.attributes.temperature | int |round > 0 %} {{ states.climate.home.attributes.current_temperature | int - states.climate.home.attributes.temperature | int }} degrees above {%- elif states.climate.home.attributes.current_temperature | int - states.climate.home.attributes.temperature | int |round < 0 %} {{ (states.climate.home.attributes.current_temperature | int - states.climate.home.attributes.temperature | int) | abs }} degrees below {% else %} right at {% endif %} the set point of {{ states.climate.home.attributes.temperature }} degrees. {%- endif -%} And The internal humidity is currently {{ states.climate.home.attributes.current_humidity }} percent. The garage is {{states.sensor.acurite_tower_10968_t.state|round}} degrees with a humidity of {{states.sensor.acurite_tower_10968_h.state|round}} percent. {%- if is_state('media_player.croft_tv','playing') or is_state('binary_sensor.croft_occupancy','on') %} There appears to be activity in the Croft. {%- if is_state('media_player.croft_tv','playing') %} The croft TV is currently playing {%- if states.media_player.croft_tv.attributes.app_name == 'YouTube' %} You Tube. {% else %} {{ states.media_player.croft_tv.attributes.app_name }}. {%- endif -%} {%- endif -%} {%- endif -%} {%- if is_state('media_player.theater_tv','on') or is_state('binary_sensor.theater_occupancy','on') %} The theater is currently occupied. {%- if is_state('media_player.home_theater_2','playing') %} and the Apple TV is currently playing. {%- endif -%} {%- endif -%} There are currently {{ (states.light | selectattr('state', 'eq', 'on') | list | count) | int + (states.switch | selectattr('state', 'eq', 'on') | list | count) | int }} lights and switches on.
{%- if is_state('sensor.washer_status','complete') %}The washing machine completed its cycle {% set seconds = now().timestamp() - as_timestamp(states.sensor.washer_status.last_changed) %} {% set hours = seconds / 60 %} {% if (seconds / ( 60 * 60 )) | int == 1 %} over an hour ago. {{ [ 'Do not forget to rotate the clothes.', 'Was someone going to rotate the laundry?', 'Once you rotate the laundry I will stop reminding you to do it. So if you want me to stop. Its up to you.' ] | random }} {% elif (seconds / ( 60 * 60 )) | int > 1 and (seconds / ( 60 * 60 )) | int < 6 %} over {{ (seconds // ( 60 * 60 )) | int }} hours ago. {{ [ 'Much longer and you are going to need to wash them again.', 'Someone needs to rotate the laundry.', 'Do not forget about the clothes in the washing machine.', 'Surely you did not mean to forget about the clothes. Mistakes happen. But you can still fix it.', 'Do you like your clothes smelling like mildew? Becasue that is what is happening right now.' ] | random }} {% elif (seconds / ( 60 * 60 )) | int > 6 %} over {{ (seconds // ( 60 * 60 )) | int }} hours ago. {{ [ 'That is a crazy amount of time.', 'Did you decide you want those clothes to suffer?', 'You might as well just rewash those clothes.', 'I can smell the mildew. Virtually I mean.', 'Surely you did not mean to forget about the clothes.' ] | random }} {% else %} {{ (seconds // 60) | int }} minutes ago. {{ [ 'Do not forget to rotate the clothes.', 'Someone forgot to move the clothes to the dryer. I am not going to name names, but there is a camera in there. Do I need to publically shame someone?', 'You might want to move them to the dryer.' ] | random }} {% endif %}
{% 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()) -}}