diff --git a/config/templates/speech/daily_briefing.yaml b/config/templates/speech/daily_briefing.yaml new file mode 100755 index 0000000..0e5bc54 --- /dev/null +++ b/config/templates/speech/daily_briefing.yaml @@ -0,0 +1,524 @@ +> + {# 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_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 %} +
+ ++ {% 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 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 -%}
+
+
+ {%- 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 }} +
+ {%- 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 }}. + {% 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. + +
+ + + {%- 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 %} + + + {{ [ + '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()) -}} \ No newline at end of file diff --git a/config/templates/speech/interjections.yaml b/config/templates/speech/interjections.yaml index a2437d1..0971ca3 100755 --- a/config/templates/speech/interjections.yaml +++ b/config/templates/speech/interjections.yaml @@ -12,7 +12,7 @@ 'I think I can handle that.', 'Working on it now.', '+
Good morning. -
+
- {% if now().strftime('%H')|int < 12 %}
- {% if now().strftime('%M')|int == 0 %}
- It is {{ now().strftime('%H')|int }} AM.
+ It is {{ now().strftime("%I:%M %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 %} - It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} AM. + and {{ states.weather.home.state }} {% 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. + + {% 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 %} - - {% 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 }}. -
-- It is currently {{states.weather.home.state}} and {{states.sensor.acurite_6045m_3078_t.state|round}} degrees in Grayson. -
-- {% 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 %}
+
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
{{ [ 'Today is a school day.',
- 'Skylar has school today. '
+ 'It is a school day. '
] | random }}
+ Pickup today will be at {{(state_attr('input_datetime.school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }}
{% 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!
+ And It is early release which means pick up is at tweleve fifteen.
{% 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. + Today's lunch is not interesting, so plan on taking one. {% 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 %} + {% 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 %}
+{% 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 + 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 %} {% else %} It doesn't appear that Skylar is out of bed yet. {% endif %}
+{%- 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 %} Traffic to the Zoo is normal. {% 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 }}.
+ {%- endmacro -%} diff --git a/config/templates/speech/nightly_briefing.yaml b/config/templates/speech/nightly_briefing.yaml index 6081df8..d5ad74a 100755 --- a/config/templates/speech/nightly_briefing.yaml +++ b/config/templates/speech/nightly_briefing.yaml @@ -7,7 +7,7 @@ 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+ {%- 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 %} +
+ {%- 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()) -}} \ No newline at end of file diff --git a/config/templates/speech/skylar_morning_briefing.yaml b/config/templates/speech/skylar_morning_briefing.yaml index de78a63..8c0503f 100755 --- a/config/templates/speech/skylar_morning_briefing.yaml +++ b/config/templates/speech/skylar_morning_briefing.yaml @@ -2,7 +2,10 @@ {# Skylar Morning Report #} {%- macro getReport() -%}
- Skylar,
+ Good morning, Skylar.
+
+ It is {{ now().strftime("%I:%M %p") }}
+
{% if is_state('sensor.birthday_skylar', '0') %}
Even birthday boys have to get dressed. So get to it.
{% else %}
@@ -10,11 +13,11 @@
'It is time to put some real clothes on. ',
'it is now time to change your underwear.',
'You need to get dressed for the day.',
- 'If you have not gotten dressed it is that time.',
- 'We have reached that time during the day in which you should get dressed.'
+ 'If you have not gotten dressed it is that time.'
] | random }}
{% endif %}
{% if is_state('sensor.clothing_forecast', 'Freezing') %} 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. {% endif %}
+{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} Because you have school today! @@ -73,6 +77,9 @@ {% if states.calendar.skylar_school.attributes.description == 'start_fall_break' %} Oh, One More Thing. Tomorrow is the first day of Fall Break. {% 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 %} {% 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 }}. @@ -88,6 +95,7 @@ {% endif %}
+{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.sensor.school_lunch.state == 'Nothing' %} @@ -109,6 +117,9 @@ ] | random }} {% endif %}
+ {% if is_state('calendar.skylar_events', 'on') %} + You have {{ states.calendar.skylar_events.attributes.message }} today as well! + {% endif %} {%- endmacro -%} diff --git a/config/templates/speech/skylar_nightly_briefing.yaml b/config/templates/speech/skylar_nightly_briefing.yaml index d3a5fc9..3064e27 100755 --- a/config/templates/speech/skylar_nightly_briefing.yaml +++ b/config/templates/speech/skylar_nightly_briefing.yaml @@ -1,66 +1,15 @@ > {# Skylar Nightly Report #} {%- macro getReport() -%} -
- {% 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
- {% 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 %} -
-
- Skyler,
+ Good Evening, Skyler,
{{ [ '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.',
- 'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath,
- {% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %} - Good morning. - {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %} - Good afternoon. - {% else %} - Good evening. - {% endif %} -
-- {% 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 %} + Good evening.
+ ++ It is {{ now().strftime("%I:%M %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 %} + +
+{{ [ - 'The sun is officially down. Exterior Cameras are now motion activated.', - 'The sun has been ushered off the stage. I have armed the perimiter cameras.', - 'You are running out of daylight. Time to wrap up any outside chores.', - 'Switching Anchorage House to night mode! ', - 'The outside world has switched to dark mode.', - 'It is a little past Sunset. Time to turn on the outside lights. I am on it.', - 'I will switch on the outside lights. It is getting dark outside.', - 'Time to turn on the front lights. I will take care of it.', - 'If you have not looked outside lately, the light of the day is almost gone.' + 'Exterior Cameras are now motion activated, and the front porch light is on.', + '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. The ouside lights have been turned on.', + 'Switching Anchorage House to night mode! Front porch lights are on and the ouside cameras are recording when motion has been detected.', + 'Anchorage House has been configured for night.', + 'Switching on Anchorage Houses exterior lighting, and armed the cameras.', + 'It is getting dark outside, so I am turning on the outside lights.', + '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. I am turning on the outside lights.' ]|random }}
{% if is_state('binary_sensor.garage_door', 'on') %}{{ [ 'The garage door is open. ', - 'The pod bay doors are open. ', 'Someone forgot to close the garage.' ] | random }} + Someone should close it.
{% elif is_state('binary_sensor.side_door', 'on') %}@@ -56,48 +70,31 @@ 'The side door is open. ', 'Someone forgot to close the side door.' ] | random }} + Someone might want to check it.
{% else %} {% 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 %} -
-- {{ [ - 'Tonight we can expect,', - 'Expect weather tonight to be,' - ]|random }} - {{ states.sensor.nws_overnight_forecast.state }} -
- + {% if is_state('input_boolean.freeze_warning','on') %}
- {{ [ 'The temperature is expected to be near or below freezing.
- {% 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
- {% 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 %} -
+ {%- endmacro -%} diff --git a/config/templates/speech/welcome_briefing.yaml b/config/templates/speech/welcome_briefing.yaml new file mode 100755 index 0000000..6d8717f --- /dev/null +++ b/config/templates/speech/welcome_briefing.yaml @@ -0,0 +1,120 @@ +> + {# Event Report #} + {%- macro getReport() -%} +
+ {% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
+ {% set peoplecount = expand('group.arriving') | count %}
+ {% if peoplecount == 0 %}
+ Welcome Home
+ {% 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.
+ {%- 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
+
+ {%- 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 %} +
+ ++ {%- 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 %} +
+ + + + + + + {%- 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()) -}} \ No newline at end of file