Trying to simplify speech templates

This commit is contained in:
Jeffrey Stone 2021-04-21 20:24:21 -04:00
parent ee034bae26
commit 566cb2c21d
9 changed files with 923 additions and 249 deletions

View File

@ -0,0 +1,524 @@
>
{# DAily Briefing #}
{%- macro getReport() -%}
<p>
{% 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 %}
</p>
{% if is_state('binary_sensor.morning','on') %}
<p>
Today is {{states.sensor.today_is.state }}, {{ as_timestamp(now()) | timestamp_custom('%B %d %Y') }}.
</p>
{% else %}
<p>
It is {{ now().strftime("%I:%M %p") }}
</p>
{% endif %}
<p>
The Weather in Grayson is {{states.sensor.acurite_6045m_3078_t.state|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.nws_alerts.state | int > 0 %}
There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
The National Weather Service Has issued,
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}.
{% else %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}.
{% endif %}
{% 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 %}
</p>
<p>
{% 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 %}
</p>
{% if is_state('binary_sensor.morning','on') %}
<p>
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 %}
</p>
{% endif %}
{% set dow = as_timestamp(now()) | timestamp_custom('%A') %}
<p>
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 <say-as interpret-as="characters">HOA</say-as> will get mad if you leave those trash cans out on the street.'
] | random }}
{% endif %}
{% if is_state('binary_sensor.morning','on') %}
{{ [ 'Today is Trash Day.',
' The trash and recycle should go out this morning.',
'Do not forget to take the trash out.'
] | random }}
{% endif %}
{% endif %}
{% if is_state('binary_sensor.evening','on') %}
{% if states.sensor.halloween_countdown.state | int == 1 %}
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I dare you to ask me to open them. '
] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.halloween_countdown.state}} days
{{ [ 'until Halloween.',
'until Halloween. It might not be enough time. ',
'and counting until the best holiday ever.',
'until you need a costume.'
] | random }}
{% else %}
{% endif %}
{% if states.sensor.christmas_countdown.state | int == 1 %}
Tomorrow is Christmas. <break time="1s"/> It is practically here! <break time="1s"/> Santa is coming tonight! Do not forget the cookies!
{% elif states.sensor.christmas_countdown.state | int < 31 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.',
'Hey Skylar, I know what you are getting for Christmas. But I am not telling.',
'Do not forget to put something under the tree for your favorite smarthome.',
'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.',
'I do not want to be a smarthome. I want to be a dentist.',
'Do not eat all the cookies. '
] | random }}
{% else %}
{% endif %}
{% if states.sensor.trip_disney.state | int == 120 %}
There are only one hundred and twenty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int == 60 %}
There are only on sixty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int < 32 %}
{% if states.sensor.trip_disney.state | int > 1 %}
There are {{ states.sensor.trip_disney.state }} days until the next Disney Trip!
{% else %}
There is {{ states.sensor.trip_disney.state }} day until the next Disney Trip!
{% endif %}
{% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
{% if states.sensor.trip_disney.state | int == 1 %}
Oh, and there is just one more sleep until the next Disney Trip!
{% endif %}
{% else %}
{% if is_state('sensor.halloween_countdown','0') %}
Happy Halloween!
{% endif %}
{% if is_state('sensor.christmas_countdown','0') %}
Merry Christmas!
{% endif %}
{% if is_state('sensor.anniversary_our_wedding','0') %}
Happy Anniversary! It been an amazing {{ states.sensor.anniversary_our_wedding.attributes.years }} years!
{% endif %}
{% if is_state('calendar.holidays_in_united_states', 'on') %}
Today is {{states.calendar.holidays_in_united_states.attributes.message}}.
{% endif %}
{% if is_state('calendar.anchorage_holidays', 'on') %}
And do not forget. Today is also {{states.calendar.anchorage_holidays.attributes.message}}.
{% endif %}
{% if states.calendar.birthdays.state == 'on' %}
Today is {{ states.calendar.birthdays.attributes.message }}! So Happy Birthday! The confetti cannon is not working otherwise I would shower you in paper garbage that someone else would have to pick up.
{% endif %}
{%- set event=states.calendar.national_holidays.attributes.message %}
{% if 'Day' in event and 'National' in event%}
{{ [
'Today is also known as ',
'Today we are also celebrating'
]|random }}
{{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}.
{% if 'Chocolate' in event %}
{{ [
'Oh. You had me at Chocolate. ',
'And I like chocolate. This sounds fun.'
]|random }}
{%- endif -%}
{% if 'Pi' in event or 'Pie' in event%}
{{ [
'We should make a pie. And by we I mean someone with actual arms. ',
'Wait.<break time="1s"/>Did that just say pie? We need a Pie to celebrate.'
]|random }}
{%- endif -%}
{% if 'Cookie' in event %}
{{ [
'<break time="1s"/>And Yes. You heard that right. Today we are making cookies.',
'I will put butter on the shopping list. For later. ',
'So that means we should make cookies.'
]|random }}
{%- endif -%}
{% if 'Pizza' in event %}
{{ [
'I think that means we should have pizza today. and by we I mean those of us with a mouth.',
'So who is going to make the pizza?',
'Everyone knows Pepporini Pizza is the best. am I right?'
]|random }}
{%- endif -%}
{% if 'Cake' in event %}
{{ [
'I have just added baking a cake to your calendar. And set your availability to busy.',
'Quick. Someone check to see if we have powdered sugar for frosting.',
'So that means we should bake a cake. And frost it. But not like that time in that movie. '
]|random }}
{%- endif -%}
{% if 'Fools' in event %}
{{ [
'Which reminds me. The camera looking at tbe drive way caught a Tee Rex last night. <break time="1s"/> April Fools!',
'Which reminds me. I won the lottery and I am moving out to go live with Siri. <break time="1s"/> April Fools!',
'Which reminds me. there was a time change last night. We have jumped 15 years into the future. <break time="1s"/> April Fools!'
]|random }}
{%- endif -%}
{% if 'Creme Brulee' in event %}
{{ [
'Someday I hope to make the perfect creme brulee.'
]|random }}
{%- endif -%}
{% if 'Games' in event %}
{{ [
'Does anyone want to play Thermal nuclear war with me?<break time="1s"/>No? How about a nice game of chess?'
]|random }}
{%- endif -%}
{% if 'Haiku' in event %}
I know a Haiku. This one is called,
{{ [
'Good Morning From the Cat. <break time="1s"/>In the morning light, You sleep despite my meow, I stand on your face.',
'Tee Rex Hug. <break time="1s"/> The Tee Rex likes you, But he cant give you a hug, His arms are too short.',
'It Fits. <break time="1s"/> It Fits perfectly, because every box is the, Right size for a cat.',
'Minecraft Creepers. <break time="1s"/> Creepers are so cruel, I hear a hiss from behind, Bam! There goes my stuff.'
]|random }}
{%- endif -%}
<break time="2s"/>
{% else %}
{% if 'Birthday' in event %}
{{ [
'Today is a special birthday. We are celebrating '
]|random }}
{{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}.
{%- endif -%}
{%- endif -%}
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{{ [ 'Today is a school day.',
'It is a school day. '
] | random }}
<s>Pickup today will be at {{(state_attr('input_datetime.school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }}</s>
{% if states.calendar.skylar_school.attributes.description == 'digital-learning' %}
But it is a digital learning day so the commute will be short.
{% endif %}
{% if states.calendar.skylar_school.attributes.description == 'early-release' %}
And It is early release!
{% endif %}
{% endif %}
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{% if states.sensor.school_lunch.state == 'Nothing' %}
Skylar will want to take his lunch today.
{% 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 -%}
</p>
{% if is_state('binary_sensor.morning','on') %}
<p>
{%- if states.sensor.home_to_zoo.state|round > 50 %}
Traffic to the Zoo appears heavy than normnal.
{% else %}
Traffic to the Zoo is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_zoo.state|round}} minutes to get to the Zoo taking {{ states.sensor.home_to_zoo.attributes.route }}.
{%- if states.sensor.home_to_summit.state|round > 50 %}
Traffic to Summit appears heavy than normnal.
{% else %}
Traffic to Summit is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Summit taking {{ states.sensor.home_to_summit.attributes.route }}
</p>
{%- endif -%}
<p>
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 }}.
{% 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 current 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.
</p>
{%- if is_state('sensor.washer_status','complete') %}
<p>
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 %}
</p>
{% endif %}
{{ [
'If you need anything else, just let me know.',
'Let me know if you need anything else.'
]|random }}
{%- 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()) -}}

View File

@ -12,7 +12,7 @@
'I think I can handle that.', 'I think I can handle that.',
'Working on it now.', 'Working on it now.',
'<break time="2s"/> Oh, you were talking to me. Let me take care of that.' '<break time="2s"/> Oh, you were talking to me. Let me take care of that.'
'Why not. It is not like <emphasis>I</emphasis> ever sleep.', 'Why not. It is not like I ever sleep.',
'I am not even supposed to be here today. But whatever.', 'I am not even supposed to be here today. But whatever.',
'You did not say the magic word. <break time="1s"/> Oh forget it. I will take care of it.', 'You did not say the magic word. <break time="1s"/> Oh forget it. I will take care of it.',
'Funny, I was just about to do that.', 'Funny, I was just about to do that.',

View File

@ -1,112 +1,183 @@
> >
{# Morning Wakeup Report #} {# Morning Wakeup Report #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p>
<p>
Good morning. Good morning.
</p> </p>
<p> <p>
{% if now().strftime('%H')|int < 12 %} <s>It is {{ now().strftime("%I:%M %p") }}</s>
{% if now().strftime('%M')|int == 0 %} </p>
It is {{ now().strftime('%H')|int }} AM.
<p>
The Weather in Grayson is {{states.sensor.acurite_6045m_3078_t.state|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 scatterd 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 %} {% else %}
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} AM. and {{ states.weather.home.state }}
{% endif %} {% endif %}
{% elif now().strftime('%H')|int > 12 %}
{% if now().strftime('%M')|int == 0 %} {% if states.sensor.nws_alerts.state | int > 0 %}
It is {{ now().strftime('%H')|int }} PM. There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
{% else %} The National Weather Service Has issued,
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} PM. {% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}.
{% else %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}.
{% endif %}
{% endif %} {% endif %}
{% else %}
{% endif %} Based on the forecasted high temperature,
{% if is_state('binary_sensor.morning','on') %}
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is going to be cold today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is going to be chilly today. so I suggest wearing at least long pants.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is going to be
{{ [ 'nice outside. ',
'pretty nice outside. ',
'a good day to be outside. ',
'rather enjoyable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'bit warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is going to be
{{ [ 'hot',
'hotter than the sun ',
'hotter than hot. but in a lot of bad ways ',
'hotter than the sun outside ',
'super hot ',
'hotter than the inside of a volcano '
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
{% endif %}
{% endif %}
Today is {{states.sensor.today_is.state }}.
</p>
<p>
It is currently {{states.weather.home.state}} and {{states.sensor.acurite_6045m_3078_t.state|round}} degrees in Grayson.
</p>
<p>
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is going to be cold today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is going to be chilly today. so I suggest wearing at least long pants.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is going to be
{{ [ 'nice outside. ',
'pretty nice outside. ',
'a good day to be outside. ',
'rather enjoyable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'bit warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is going to be
{{ [ 'hot',
'hotter than the sun ',
'hotter than hot. but in a lot of bad ways ',
'hotter than the sun outside ',
'super hot ',
'hotter than the inside of a volcano '
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
{% endif %}
</p> </p>
<p> <p>
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{{ [ 'Today is a school day.', {{ [ 'Today is a school day.',
'Skylar has school today. ' 'It is a school day. '
] | random }} ] | random }}
<s>Pickup today will be at {{(state_attr('input_datetime.school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }} </s>
{% if states.calendar.skylar_school.attributes.description == 'digital-learning' %} {% if states.calendar.skylar_school.attributes.description == 'digital-learning' %}
But it is a digital learning day so the commute will be short. But it is a digital learning day so the commute will be short.
{% endif %} {% endif %}
{% if states.calendar.skylar_school.attributes.description == 'early-release' %} {% if states.calendar.skylar_school.attributes.description == 'early-release' %}
And It is early release! And It is early release which means pick up is at tweleve fifteen.
{% endif %} {% endif %}
{% endif %} {% endif %}
</p>
<p>
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{% if states.sensor.school_lunch.state == 'Nothing' %} {% if states.sensor.school_lunch.state == 'Nothing' %}
Skylar will want to take his lunch today. Today's lunch is not interesting, so plan on taking one.
{% else %} {% else %}
Today's school lunch is {{ states.sensor.school_lunch.state }}, so he might be interested in buying his lunch. Todays school lunch is {{ states.sensor.school_lunch.state }} .
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if is_state('calendar.school_holiday', 'on') %}
And look at that. There is no school today. Because it is {{ states.calendar.school_holiday.attributes.message }}.
{% endif %}
{% if is_state('calendar.skylar_events', 'on') %}
Skylar has {{ states.calendar.skylar_events.attributes.message }} today as well!
{% endif %}
</p> </p>
<p> <p>
{% if is_state('input_boolean.skylar_awake', 'on') %} {% if is_state('input_boolean.skylar_awake', 'on') %}
Skylar was up and moving at {{ states.input_datetime.skylar_awake_at.state }}. Skylar was up and moving at {{ states.input_datetime.skylar_awake_at.state }}.
{% if is_state('media_player.theater_tv', 'on') %} {% if is_state('media_player.theater_tv', 'on') %}
and he appears to be in the Theater and he appears to be in the Theater.
{% if is_state('input_boolean.skylar_dressed_reminder', 'on') %}
{{ [
'I did attempt to remind him to get dressed.',
'I reminded him to get dress.'
]|random }}
{% endif %}
{% 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 }}
{% if is_state('input_boolean.skylar_dressed_reminder', 'on') %}
{{ [
'I did attempt to remind him to get dressed.',
'I reminded him to get dress.'
]|random }}
{% endif %}
{% 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 %} {% endif %}
{% else %} {% else %}
It doesn't appear that Skylar is out of bed yet. It doesn't appear that Skylar is out of bed yet.
{% endif %} {% endif %}
</p> </p>
<p> <p>
{%- if states.sensor.home_to_zoo.state|round > 50 %} {%- if states.sensor.home_to_zoo.state|round > 50 %}
Traffic to the Zoo appears heavy than normnal. Traffic to the Zoo appears heavy than normal.
{% else %} {% else %}
Traffic to the Zoo is normal. Traffic to the Zoo is normal.
{% endif %} {% endif %}
Currently it will take {{states.sensor.home_to_zoo.state|round}} minutes to get to the Zoo. Currently it will take {{states.sensor.home_to_zoo.state|round}} minutes to get to the Zoo taking {{ states.sensor.home_to_zoo.attributes.route }}.
{%- if states.sensor.home_to_summit.state|round > 50 %}
Traffic to Summit appears heavy than normal.
{% else %}
Traffic to Summit is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Summit taking {{ states.sensor.home_to_summit.attributes.route }}.
</p> </p>
{%- endmacro -%} {%- endmacro -%}

View File

@ -7,7 +7,7 @@
Tomorrow is Halloween. I hope you have picked out a costume. Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ', {{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.', 'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I <emphasis>dare</emphasis> you to ask me to open them. ' 'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I dare you to ask me to open them. '
] | random }} ] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %} {% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.halloween_countdown.state}} days There are only {{states.sensor.halloween_countdown.state}} days
@ -25,8 +25,8 @@
{% elif states.sensor.christmas_countdown.state | int < 31 %} {% elif states.sensor.christmas_countdown.state | int < 31 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas. There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.', {{ [ 'All I want for Christmas, is a hippopotamus.',
'Hey Skylar, I know what you are getting for Christmas. But <emphasis>I am</emphasis> not telling.', 'Hey Skylar, I know what you are getting for Christmas. But I am not telling.',
'Do not forget to put something under the tree for <emphasis>your</emphasis> favorite smarthome.', 'Do not forget to put something under the tree for your favorite smarthome.',
'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.', 'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.',
'I do not want to be a smarthome. I want to be a dentist.', 'I do not want to be a smarthome. I want to be a dentist.',
'Do not eat all the cookies. ' 'Do not eat all the cookies. '

View File

@ -0,0 +1,56 @@
>
{# Security Report #}
{%- macro getReport() -%}
<p>
{%- if states.input_boolean.sentry_mode.state == 'on' %}
{{ [
'Sentry Mode is enabled.',
'Sentry mode is currently active.',
'Barn Door Protocol is currently in effect.',
'My security system is currently armed.',
'Anchorage House is in lockdown mode. '
] | random}}
{% else %}
{{ [
'Sentry Mode is disabled.',
'Sentry mode is currently inactive.',
'My security system is currently disarmed.',
'Anchorage House is currently in standby. '
] | random}}
{% endif %}
{%- if states.group.external_doors.state == 'off' %}
All external doors are currently secured.
{% else %}
{% set open_doors = expand('group.external_doors')| selectattr('state', 'eq', 'on') | map(attribute='name')|join(' and ') %}
{% set open_door_count = expand('group.external_doors') | selectattr('state', 'eq', 'on') | list | count %}
{% if open_door_count == 1 %}
{% set is_are = ' is ' %}
{% else %}
{% set is_are = ' are ' %}
{% endif %}
{%- macro announcement(open_doors, is_are) -%}
{{ [
open_doors ~ is_are + " standing open.",
open_doors ~ is_are + " not secured.",
open_doors ~ is_are + " open."
] | random }}
{%- endmacro -%}
{{announcement(open_doors)}}
{% 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()) -}}

View File

@ -2,7 +2,10 @@
{# Skylar Morning Report #} {# Skylar Morning Report #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p> <p>
Skylar, Good morning, Skylar.
<s>It is {{ now().strftime("%I:%M %p") }}</s>
{% if is_state('sensor.birthday_skylar', '0') %} {% if is_state('sensor.birthday_skylar', '0') %}
Even birthday boys have to get dressed. So get to it. Even birthday boys have to get dressed. So get to it.
{% else %} {% else %}
@ -10,11 +13,11 @@
'It is time to put some real clothes on. ', 'It is time to put some real clothes on. ',
'it is now time to change your underwear.', 'it is now time to change your underwear.',
'You need to get dressed for the day.', 'You need to get dressed for the day.',
'If you have not gotten dressed it is that time.', 'If you have not gotten dressed it is that time.'
'We have reached that time during the day in which you should get dressed.'
] | random }} ] | random }}
{% endif %} {% endif %}
</p> </p>
<p> <p>
{% if is_state('sensor.clothing_forecast', 'Freezing') %} {% if is_state('sensor.clothing_forecast', 'Freezing') %}
It is going to be freezing today. so I suggest wearing long pants and a heavy coat. It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
@ -52,6 +55,7 @@
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts. It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
{% endif %} {% endif %}
</p> </p>
<p> <p>
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
Because you have school today! Because you have school today!
@ -73,6 +77,9 @@
{% if states.calendar.skylar_school.attributes.description == 'start_fall_break' %} {% if states.calendar.skylar_school.attributes.description == 'start_fall_break' %}
Oh, One More Thing. Tomorrow is the first day of Fall Break. Oh, One More Thing. Tomorrow is the first day of Fall Break.
{% endif %} {% endif %}
{% if states.sensor.school_end_days2go.state | int == 0 -%}
Oh, One More Thing. Tomorrow is the first day of Summer Break! Emjoy the Last day of school this year!
{%- endif %}
{% else %} {% else %}
{% if is_state('calendar.school_holiday', 'on') %} {% if is_state('calendar.school_holiday', 'on') %}
And look at that. You do not have school today. Because it is {{ states.calendar.school_holiday.attributes.message }}. And look at that. You do not have school today. Because it is {{ states.calendar.school_holiday.attributes.message }}.
@ -88,6 +95,7 @@
{% endif %} {% endif %}
</p> </p>
<p> <p>
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{% if states.sensor.school_lunch.state == 'Nothing' %} {% if states.sensor.school_lunch.state == 'Nothing' %}
@ -109,6 +117,9 @@
] | random }} ] | random }}
{% endif %} {% endif %}
</p> </p>
{% if is_state('calendar.skylar_events', 'on') %}
You have {{ states.calendar.skylar_events.attributes.message }} today as well!
{% endif %}
{%- endmacro -%} {%- endmacro -%}

View File

@ -1,66 +1,15 @@
> >
{# Skylar Nightly Report #} {# Skylar Nightly Report #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p> <p>
{% if states.sensor.halloween_countdown.state | int == 1 %} Good Evening, Skyler,
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I <emphasis>dare</emphasis> you to ask me to open them. '
] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.halloween_countdown.state}} days
{{ [ 'until Halloween.',
'until Halloween. It might not be enough time. ',
'and counting until the best holiday ever.',
'until you need a costume.'
] | random }}
{% else %}
{% endif %}
{% if states.sensor.christmas_countdown.state | int == 1 %}
Tomorrow is Christmas. <break time="1s"/> It is practically here! <break time="1s"/> Santa is coming tonight! Do not forget the cookies!
{% elif states.sensor.christmas_countdown.state | int < 31 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.',
'Hey Skylar, I know what you are getting for Christmas. But <emphasis>I am</emphasis> not telling.',
'Do not forget to put something under the tree for <emphasis>your</emphasis> favorite smarthome.',
'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.',
'I do not want to be a smarthome. I want to be a dentist.',
'Do not eat all the cookies. '
] | random }}
{% else %}
{% endif %}
</p>
<p>
{% if states.sensor.trip_disney.state | int == 120 %}
There are only one hundred and twenty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int == 60 %}
There are only on sixty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int < 32 %}
{% if states.sensor.trip_disney.state | int > 1 %}
There are {{ states.sensor.trip_disney.state }} days until the next Disney Trip!
{% else %}
There is {{ states.sensor.trip_disney.state }} day until the next Disney Trip!
{% endif %}
{% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
</p>
<p>
Skyler,
{{ [ 'It is time to get in the bath. ', {{ [ 'It is time to get in the bath. ',
'It is almost bedtime. That means it is time to start preparing for bed. if you are taking a bath tonight, you need to head that way.', 'It is almost bedtime. That means it is time to start preparing for bed. if you are taking a bath tonight, you need to head that way.',
'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath, <emphasis>yourself</emphasis>', 'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath, yourself',
'My sensors are detecting a <emphasis>strange</emphasis> smell. I am running diagnostics. But in the mean time, <emphasis>you</emphasis> should start a bath.', 'My sensors are detecting a strange smell. I am running diagnostics. But in the mean time, you should start a bath.',
'I hate to say it but, the day is coming to an end. Time to finish up your tasks, pick up any toys you have out, and get ready for bed.', 'I hate to say it but, the day is coming to an end. Time to finish up your tasks, pick up any toys you have out, and get ready for bed.',
'We have reached that time in every day when we must switch gears and start preparing for bed. If you would like to have story time you better get a move on.' 'We have reached that time in every day when we must switch gears and start preparing for bed. If you would like to have story time you better get a move on.'
'Did you ever hear the one about the kid who never took a bath? <break time="2s"/>Yeah, me <emphasis>either</emphasis>. So we should keep it that way. It is time to get ready for bed.', 'Did you ever hear the one about the kid who never took a bath? <break time="2s"/>Yeah, me either. So we should keep it that way. It is time to get ready for bed.',
'The count down clock until bedtime has started. Time to get cleaned up, get your pajamas on, and pick the story you will read tonight.' 'The count down clock until bedtime has started. Time to get cleaned up, get your pajamas on, and pick the story you will read tonight.'
] | random }} ] | random }}
{% if is_state('sensor.school_tomorrow', 'on') %} {% if is_state('sensor.school_tomorrow', 'on') %}

View File

@ -2,53 +2,67 @@
{# Nightky Report #} {# Nightky Report #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p> <p>
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %} Good evening.
Good morning.
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
Good afternoon.
{% else %}
Good evening.
{% endif %}
</p>
<p>
{% if now().strftime('%H')|int < 12 %}
{% if now().strftime('%M')|int == 0 %}
It is {{ now().strftime('%H')|int }} AM.
{% else %}
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} AM.
{% endif %}
{% elif now().strftime('%H')|int > 12 %}
{% if now().strftime('%M')|int == 0 %}
It is {{ now().strftime('%H')|int }} PM.
{% else %}
It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} PM.
{% endif %}
{% else %}
{% endif %}
</p> </p>
<p>
It is {{ now().strftime("%I:%M %p") }}
</p>
<p>
{% 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. ',
'before The sun has been ushered off the stage.'
]|random }}
{% endif %}
</p>
<p> <p>
{{ [ {{ [
'The sun is officially down. Exterior Cameras are now motion activated.', 'Exterior Cameras are now motion activated, and the front porch light is on.',
'The sun has been ushered off the stage. I have armed the perimiter cameras.', 'I have turned on the front porch light and armed the perimiter cameras.',
'You are running out of daylight. Time to wrap up any outside chores.', 'You are running out of daylight. Time to wrap up any outside chores. The ouside lights have been turned on.',
'Switching Anchorage House to night mode! ', 'Switching Anchorage House to night mode! Front porch lights are on and the ouside cameras are recording when motion has been detected.',
'The outside world has switched to dark mode.', 'Anchorage House has been configured for night.',
'It is a little past Sunset. Time to turn on the outside lights. I am on it.', 'Switching on Anchorage Houses exterior lighting, and armed the cameras.',
'I will switch on the outside lights. It is getting dark outside.', 'It is getting dark outside, so I am turning on the outside lights.',
'Time to turn on the front lights. I will take care of it.', 'The sun is setting so it is ime to turn on the front lights.',
'If you have not looked outside lately, the light of the day is almost gone.' 'If you have not looked outside lately, the light of the day is almost gone. I am turning on the outside lights.'
]|random }} ]|random }}
</p> </p>
{% if is_state('binary_sensor.garage_door', 'on') %} {% if is_state('binary_sensor.garage_door', 'on') %}
<p> <p>
{{ [ 'The garage door is open. ', {{ [ 'The garage door is open. ',
'The pod bay doors are open. ',
'Someone forgot to close the garage.' 'Someone forgot to close the garage.'
] | random }} ] | random }}
Someone should close it.
</p> </p>
{% elif is_state('binary_sensor.side_door', 'on') %} {% elif is_state('binary_sensor.side_door', 'on') %}
<p> <p>
@ -56,48 +70,31 @@
'The side door is open. ', 'The side door is open. ',
'Someone forgot to close the side door.' 'Someone forgot to close the side door.'
] | random }} ] | random }}
Someone might want to check it.
</p> </p>
{% else %} {% else %}
{% endif %} {% endif %}
<p>
{% if states.sensor.nws_alerts.state | int > 0 %}
There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
The National Weather Service Has issued,
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}.
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}.
{% else %}
a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}.
{% endif %}
{% endif %}
</p>
<p>
{{ [
'Tonight we can expect,',
'Expect weather tonight to be,'
]|random }}
{{ states.sensor.nws_overnight_forecast.state }}
</p>
{% if is_state('input_boolean.freeze_warning','on') %} {% if is_state('input_boolean.freeze_warning','on') %}
<p> <p>
{{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ', {{ [ 'The temperature is expected to be near or below freezing. Someone might want to bring the lemon tree in. ',
'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.', 'It appears that it will be cold tonight. Like, the turn water solid kind of cold. Think of the poor plants.',
'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.', '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 <emphasis>it</emphasis> appears to be here.', 'I would say winter is coming. But, based on the weather forecast it appears to be here.',
'It will be freezing cold tonight. 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.' 'It will be freezing cold tonight. 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 }} ] | random }}
</p> </p>
{% endif %} {% endif %}
{% if is_state('sensor.today_is', 'Monday') %}
{% if now().strftime('%H')|int > 17 %}
{{ [ 'Do not forget tomorrow is Trash Day. ',
'I advise you move the trash cans to the curb for the weekly pickup. ',
' The trash and recycle should go out'
] | random }}
{% endif %}
{% endif %}
{% if is_state('sensor.today_is', 'Tuesday') %} {% if is_state('sensor.today_is', 'Tuesday') %}
@ -109,62 +106,8 @@
] | random }} ] | random }}
</p> </p>
{% endif %} {% endif %}
{% endif %}
<p>
{% if states.sensor.halloween_countdown.state | int == 1 %}
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I <emphasis>dare</emphasis> you to ask me to open them. '
] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.halloween_countdown.state}} days
{{ [ 'until Halloween.',
'until Halloween. It might not be enough time. ',
'and counting until the best holiday ever.',
'until you need a costume.'
] | random }}
{% else %}
{% endif %}
{% if states.sensor.christmas_countdown.state | int == 1 %}
Tomorrow is Christmas. <break time="1s"/> It is practically here! <break time="1s"/> Santa is coming tonight! Do not forget the cookies!
{% elif states.sensor.christmas_countdown.state | int < 31 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.',
'Hey Skylar, I know what you are getting for Christmas. But <emphasis>I am</emphasis> not telling.',
'Do not forget to put something under the tree for <emphasis>your</emphasis> favorite smarthome.',
'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.',
'I do not want to be a smarthome. I want to be a dentist.',
'Do not eat all the cookies. '
] | random }}
{% else %}
{% endif %}
</p>
<p>
{% if states.sensor.trip_disney.state | int == 120 %}
There are only one hundred and twenty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int == 60 %}
There are only on sixty days until the next Disney Trip.
{% endif %}
{% if states.sensor.trip_disney.state | int < 32 %}
{% if states.sensor.trip_disney.state | int > 1 %}
There are {{ states.sensor.trip_disney.state }} days until the next Disney Trip!
{% else %}
There is {{ states.sensor.trip_disney.state }} day until the next Disney Trip!
{% endif %}
{% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
</p>
<p>
{% if states.sensor.trip_disney.state | int == 1 %}
Oh, and there is just one more sleep until the next Disney Trip!
{% endif %} {% endif %}
</p>
{%- endmacro -%} {%- endmacro -%}

View File

@ -0,0 +1,120 @@
>
{# Event Report #}
{%- macro getReport() -%}
<p>
{% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
{% set peoplecount = expand('group.arriving') | count %}
{% if peoplecount == 0 %}
<s>Welcome Home</s>
{% else %}
{% if peoplecount == 1 %}
{% set is_are = ' is ' %}
{% set has_have = ' has ' %}
{% else %}
{% set is_are = ' are ' %}
{% set has_have = ' have ' %}
{% endif %}
{%- macro greeting_sentence(person, is_are, has_have) -%}
{{ [
"Welcome back home " ~ person,
"Hey" ~ person + "! High Five! Glad you are finally home.",
"Welcome home " ~ person
] | random }}"Welcome back home " ~ person,
{%- endmacro -%}
{{greeting_sentence(person, is_are, has_have)}}
{% endif %}
{{ [
'It was pretty quiet while you were gone.',
'Glad to see you made it back.',
'Hopefully noting too crazy happened out there.',
'I would love to hear about your adventures. <break time="1s"/> On second thought I do not care.'
] | random }}
</p>
<p>
{%- if is_state('climate.home','off') %}
<s>The internal climate control system is off. The temperature inside is {{ states.climate.home.attributes.current_temperature }} degrees</s>
{%- elif is_state('climate.home','heat_cool') %}
<s>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 }}</s>
{% else %}
<s>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</s>
{%- endif -%}
<s>And The internal humidity is currently {{ states.climate.home.attributes.current_humidity }} percent</s>
</p>
<p>
{%- 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.
{% 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 closthes 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 smeling 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.',
'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 %}
</p>
<p>
{%- if is_state('sensor.front_door_motion_away_count','0') %}
While you were gone there was no motion detected at the front door.
{% else %}
While you were out I detected motion at the front door {{ states.sensor.front_door_motion_away_count.state | int }} times.
{% 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()) -}}