From da591c9631e2ae91ddb714c5ae5176c41cc18668 Mon Sep 17 00:00:00 2001 From: Jeffrey Stone Date: Fri, 4 Dec 2020 01:01:28 -0500 Subject: [PATCH] Coninuing with the major audible notifications overhual of 2020 --- config/binary_sensors/calendar.yaml | 2 +- config/groups.yaml | 1 - config/packages/announcements.yaml | 85 ++++----- config/packages/audio.yaml | 11 +- config/packages/daily.yaml | 40 ++-- config/packages/presence.yaml | 19 +- config/packages/security.yaml | 2 + config/templates/speech/event_briefing.yaml | 36 +++- config/templates/speech/morning_briefing.yaml | 20 +- .../speech/morning_wakeup_report.yaml | 2 +- config/templates/speech/nightly_briefing.yaml | 169 ++++------------- config/templates/speech/security_report.yaml | 37 ++-- .../speech/skylar_nightly_briefing.yaml | 51 +++++ config/templates/speech/sundown_briefing.yaml | 174 ++++++++++++++++++ 14 files changed, 405 insertions(+), 244 deletions(-) create mode 100755 config/templates/speech/sundown_briefing.yaml diff --git a/config/binary_sensors/calendar.yaml b/config/binary_sensors/calendar.yaml index ad844b0..64c2cc8 100755 --- a/config/binary_sensors/calendar.yaml +++ b/config/binary_sensors/calendar.yaml @@ -13,4 +13,4 @@ - platform: tod name: Quiet time after: '21:00' - before: '07:00' \ No newline at end of file + before: '06:00' \ No newline at end of file diff --git a/config/groups.yaml b/config/groups.yaml index b9d9fab..9a6bf9d 100755 --- a/config/groups.yaml +++ b/config/groups.yaml @@ -11,7 +11,6 @@ arriving: name: Arriving entities: [] - House Conditions: - climate.first_floor - sensor.accurite_back_porch_temperature diff --git a/config/packages/announcements.yaml b/config/packages/announcements.yaml index 17be174..17e2119 100755 --- a/config/packages/announcements.yaml +++ b/config/packages/announcements.yaml @@ -44,46 +44,34 @@ input_datetime: # Announcment Automation - fires at the time of the above input_datetimes ################################ automation: - - id: turn_off_audible_notifications - alias: Turn Off Audible Notifications - initial_state: true - trigger: - platform: template - value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_off', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" - action: - - service: input_boolean.turn_off - entity_id: input_boolean.audible_notifications - - - - id: turn_on_audible_notifications - alias: Turn On Audible Notifications at 7am + + - id: 81bee5ee-6820-4626-aebf-3deb8de69e4d + alias: Turn On Audible Notifications initial_state: true trigger: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_on', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - - service: script.turn_on_ha_speaker + - service: input_boolean.turn_on + entity_id: input_boolean.audible_notifications - - - id: set_audible_time_off_guest - alias: set audible time off guest + # Turn off audible notifications if they have't been turned off yet. + - id: e0e9c774-6abe-42aa-bdab-32108bebb0e9 + alias: Turn Off Audible Notifications + initial_state: true trigger: - - platform: state - entity_id: input_boolean.guest_mode - to: 'on' + - platform: template + value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_off', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" + condition: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' action: - - service: input_datetime.set_datetime - entity_id: input_datetime.audible_notification_off - data_template: - time: > - {% if states.binary_sensor.school_tomorrow.state == 'on' %} - 19:30 - {% else %} - 20:30 - {% endif %} + - service: input_boolean.turn_off + entity_id: input_boolean.audible_notifications - - id: prebed_routine + - id: cb0063e4-1dfe-4537-8b9e-4f64b2eba35d initial_state: true alias: Skylar Nightly Announcements trigger: @@ -92,16 +80,16 @@ automation: action: - service: script.skylar_nightly_briefing - - id: nightly_report - initial_state: true - alias: Nightly Report - trigger: - platform: template - value_template: "{{ states('sensor.time') == (state_attr('input_datetime.nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" - action: - - service: script.nightly_briefing_report + # - id: 15056866-5ac7-4b33-a371-ab9e449548d1 + # initial_state: true + # alias: Nightly Report + # trigger: + # platform: template + # value_template: "{{ states('sensor.time') == (state_attr('input_datetime.nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" + # action: + # - service: script.nightly_briefing_report - - id: good_morning_report + - id: 1d8f396a-f6ec-460d-97e3-d11900418f95 alias: Good Morning Report initial_state: true trigger: @@ -116,7 +104,7 @@ automation: before: '08:30:00' - condition: state entity_id: input_boolean.good_morning_report - state: 'on' + state: 'off' action: - service: script.morning_briefing - service: script.twitter_notify @@ -135,7 +123,7 @@ automation: entity_id: input_boolean.good_morning_report - - id: master_bedroom_report + - id: e8580ba4-fa76-4185-818b-fba3c3cea41c alias: Master Bedroom Report initial_state: true trigger: @@ -152,7 +140,7 @@ automation: action: - service: script.morning_wakeup_report - - id: skylar_morning_alarm_announcement + - id: 09bf89e7-180c-40fb-9543-5bd862e21049 alias: skylar morning alarm announcement trigger: platform: template @@ -170,7 +158,7 @@ automation: script.skylar_morning_briefing_alexa {%- endif %} - - id: set_skylar_morning_report_time + - id: bbbafc52-eab1-44cd-ac24-4f9b7f4210b6 alias: set skylar morning report time trigger: - platform: time @@ -214,14 +202,14 @@ script: sequence: - service: script.jarvis_voice data_template: - who: kitchen + who: '{{ states.sensor.alexa_audio.state }}' message: !include ../templates/speech/security_report.yaml event_briefing: sequence: - service: script.jarvis_voice data_template: - who: kitchen + who: '{{ states.sensor.alexa_audio.state }}' message: !include ../templates/speech/event_briefing.yaml skylar_morning_briefing_jarvis: @@ -253,6 +241,13 @@ script: who: '{{ states.sensor.room_audio.state }}' message: !include ../templates/speech/nightly_briefing.yaml + sundown_briefing: + sequence: + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: !include ../templates/speech/sundown_briefing.yaml + morning_briefing: sequence: - service: script.jarvis_voice diff --git a/config/packages/audio.yaml b/config/packages/audio.yaml index 1291c7e..6b3b56c 100755 --- a/config/packages/audio.yaml +++ b/config/packages/audio.yaml @@ -112,7 +112,6 @@ sensor: sensors: room_audio: friendly_name: "Room Audio" - unit_of_measurement: '' value_template: >- {%- if is_state('binary_sensor.theater_occupancy', 'on') and is_state('media_player.theater_tv', 'on') %} theater @@ -127,6 +126,16 @@ sensor: {% else %} all_google {%- endif %} + alexa_audio: + friendly_name: "Alexa Audio" + value_template: >- + {%- if is_state('sensor.last_alexa', 'media_player.living_room') %} + main + {% elif is_state('sensor.last_alexa', 'media_player.kitchen') %} + kitchen + {% else %} + main + {%- endif %} last_alexa: value_template: > {{ states.media_player | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }} \ No newline at end of file diff --git a/config/packages/daily.yaml b/config/packages/daily.yaml index 040d3b5..7c35f96 100755 --- a/config/packages/daily.yaml +++ b/config/packages/daily.yaml @@ -7,7 +7,7 @@ automation: - - id: coffee_time + - id: 3a0175f8-9caf-45fb-a461-585474f73e6b alias: Coffee Time initial_state: true trigger: @@ -25,7 +25,7 @@ automation: entity_id: alarm_control_panel.aarlo_ah_base_station mode: 'home' - - id: good_morning + - id: ce3d7e63-3eaa-4cc5-959b-1334e6c5c4e6 alias: Good Morning initial_state: true trigger: @@ -54,7 +54,7 @@ automation: {{ [ "/config/www/tweet_images/coffee.jpg", "/config/www/tweet_images/coffee2.jpg"] | random }} - - id: skylar_bedtime + - id: ff00b2a6-be6a-4f1f-ac14-84de9d42bb6a alias: Skylar Bedtime initial_state: true trigger: @@ -69,7 +69,7 @@ automation: entity_id: scene.skylar_room_prebed - - id: master_bedroom_lights_dim + - id: 745ee642-26ef-4818-8068-67f8ffccb29f alias: Master Bedroom lights dim initial_state: true trigger: @@ -83,7 +83,7 @@ automation: - service: scene.turn_on entity_id: scene.master_bedroom_dim - - id: master_bedroom_lights_out + - id: 68891fc2-b631-4195-ae63-b660e04f1615 alias: Master Bedroom lights out initial_state: true trigger: @@ -97,7 +97,7 @@ automation: - service: scene.turn_on entity_id: scene.master_bedroom_off - - id: master_bedroom_lights_on + - id: 27b83e67-b509-427a-aa2f-1ce4bb7ad0ab alias: Master Bedroom Lights On initial_state: true trigger: @@ -112,7 +112,7 @@ automation: entity_id: scene.master_bedroom_on - - id: master_bedroom_alarm + - id: b054e477-be50-480e-bd2e-2996b3e1c997 alias: Master bedroom alarm initial_state: true trigger: @@ -126,7 +126,7 @@ automation: - service: scene.turn_on entity_id: scene.master_bedroom_on - - id: master_bedroom_wake_up + - id: 1feafed1-0de9-44a4-a2f0-e693bc637ea1 alias: Master bedroom Wake Up initial_state: true trigger: @@ -140,7 +140,7 @@ automation: - service: scene.turn_on entity_id: scene.master_bedroom_dim - - id: good_night + - id: 0d5cea61-f295-4e5d-87a9-f12dfb5b67d6 alias: Good Night initial_state: true trigger: @@ -165,6 +165,8 @@ automation: data: entity_id: light.kitchen_cabinets - service: script.good_night_loft + - service: input_boolean.turn_off + entity_id: input_boolean.audible_notifications - service: script.reset_annc_switches - service: script.twitter_notify_image data_template: @@ -181,7 +183,7 @@ automation: "/config/www/tweet_images/clock.jpg"] | random }} - - id: outside_lights_on_sunset + - id: 79886677-4fdb-4cec-ad46-92a9c3c75681 alias: Outside Lights on at Sunset initial_state: true trigger: @@ -195,6 +197,7 @@ automation: - service: scene.turn_on entity_id: scene.normal_livingroom_lighting - service: script.sunset_garage_open + - service: script.sundown_briefing - service: script.twitter_notify_image data_template: tweet: >- @@ -212,7 +215,7 @@ automation: "/config/www/tweet_images/light.jpg", "/config/www/tweet_images/lamp2.jpg"] | random }} - - id: sunset + - id: a01624c1-1222-4d53-a9b3-95eee9a6a4b0 alias: Sunset initial_state: true trigger: @@ -223,9 +226,8 @@ automation: data: entity_id: alarm_control_panel.aarlo_ah_base_station mode: 'Armed' - - service: script.nightly_briefing_report - - id: outside_lights_off_sunrise + - id: 18656c32-65ab-4578-9cc0-2de5820290de alias: Outside Lights off at Sunrise initial_state: true trigger: @@ -277,7 +279,7 @@ automation: # "Since I monitor the conditions inside and outside the Anchorage House I know all the things. Like it is time to turn on the inside lights." # ] | random }} - - id: inside_off_after_sunrise + - id: 9c4e0720-6496-49a9-ad49-fe59b52fc056 alias: Inside off after Sunrise initial_state: true trigger: @@ -297,7 +299,7 @@ automation: entity_id: scene.master_bedroom_off - - id: ha_start + - id: 86fd5de9-3136-4d86-aef9-268f097eae35 alias: HA Startup initial_state: true trigger: @@ -308,7 +310,7 @@ automation: data: name: midnight-AH - - id: jeff_eta_home + - id: 82b96b73-2407-49d7-8ea2-1f78a69e025b alias: Jeff eta home initial_state: true trigger: @@ -355,7 +357,7 @@ automation: ] | random }} - - id: set_coffee_time + - id: 49fcdf4f-5cb1-442a-9a1a-16eefc3da503 alias: set soffee time trigger: - platform: time @@ -371,7 +373,7 @@ automation: 07:15 {% endif %} - - id: set_skylar_nightly_report_time + - id: 7ad448b3-f2f0-4dfc-9549-732fa6396bc5 alias: set skylar nightly report time trigger: - platform: time @@ -387,7 +389,7 @@ automation: 20:15 {% endif %} - - id: set_good_morning_time + - id: bd8e4e20-f138-49ec-a9f6-d23ab1450b98 alias: set good morning time trigger: - platform: time diff --git a/config/packages/presence.yaml b/config/packages/presence.yaml index 6843221..8624e91 100755 --- a/config/packages/presence.yaml +++ b/config/packages/presence.yaml @@ -76,7 +76,9 @@ sensor: friendly_name: "Skylar's Current Location" unit_of_measurement: '' value_template: >- - {%- if is_state('input_boolean.skylar_school', 'on')%} + {% if is_state('person.skylar', 'home') %} + home + {%- elif is_state('input_boolean.skylar_school', 'on') or is_state('person.skylar', 'Starling')%} school {%- elif is_state('sensor.jeff_location', 'home') and is_state('sensor.kat_location', 'home') and is_state('input_boolean.skylar_school', 'off')%} home @@ -168,10 +170,14 @@ automation: - platform: state entity_id: binary_sensor.skylar_room_occupancy to: 'on' + from: 'off' condition: - condition: time after: '05:00:00' before: '08:30:00' + - condition: state + entity_id: input_boolean.skylar_awake + state: 'off' action: - service: input_datetime.set_datetime entity_id: input_datetime.skylar_awake_at @@ -212,7 +218,8 @@ automation: - service: script.jarvis_voice data_template: who: '{{ states.sensor.room_audio.state }}' - message: + message: Katherine appears to be headed home. Based on current traffic conditions, she should be here in {{states.sensor.kat_ett_home.attributes.duration | round}} minutes. + - id: '1550109528753' alias: Jeff Is Heading Home @@ -227,7 +234,7 @@ automation: - service: script.jarvis_voice data_template: who: '{{ states.sensor.room_audio.state }}' - message: + message: Jeff appears to be headed home. Based on current traffic conditions, he should be here in {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes. - id: jeff_heading_to_work alias: Jeff Is Heading To Work @@ -253,7 +260,7 @@ automation: condition: condition: time after: '07:25:00' - before: '08:30:00' + before: '09:00:00' weekday: - mon - tue @@ -440,8 +447,8 @@ automation: - service: script.standby - service: script.washer_finished_notification_audible - wait_template: "{{ states.binary_sensor.kitchen_door.state == 'on' }}" - timeout: '00:1:00' - - delay: '00:01:00' + timeout: '00:01:00' + - delay: '00:02:00' - service: script.jarvis_voice data_template: who: main diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 9a7aecc..7a21460 100755 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -143,6 +143,8 @@ automation: - service: input_boolean.turn_on entity_id: input_boolean.garage_after_dark + + - id: door_chime alias: Door Chine trigger: diff --git a/config/templates/speech/event_briefing.yaml b/config/templates/speech/event_briefing.yaml index 7d56027..5edc51d 100755 --- a/config/templates/speech/event_briefing.yaml +++ b/config/templates/speech/event_briefing.yaml @@ -1,15 +1,47 @@ > {# Event Report #} {%- macro getReport() -%} +

+ {% 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') %} + Today is {{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. + {% endif %} + {%- set event=states.calendar.national_holidays.attributes.message %} + {% if 'Day' in event and 'National' in event%} + {{ [ + 'And a very special Happy ', + 'It is also ', + 'Today is also known as ', + 'Oh Look. Today is ', + 'Want to know a fact? Today is ', + 'Everyday can be a holiday. So today is ' + ]|random }} + {{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}. + {%- endif -%} +

{% if states.sensor.birthday_skylar.state | int == 1 %} Tomorrow is Skylar's Birthday. + {% elif states.sensor.birthday_skylar.state | int > 1 and states.sensor.birthday_skylar.state | int < 15 %} + Skylar's Birthday is in {{ states.sensor.birthday_skylar.state }} days! + {% else %} {% endif %} {% if states.sensor.birthday_jeff.state | int == 1 %} Tomorrow is Jeff's Birthday. + {% elif states.sensor.birthday_jeff.state | int > 1 and states.sensor.birthday_jeff.state | int < 15 %} + Jeff's Birthday is in {{ states.sensor.birthday_jeff.state }} days! + {% else %} {% endif %} {% if states.sensor.birthday_kat.state | int == 1 %} Tomorrow is Katherine's Birthday. + {% elif states.sensor.birthday_kat.state | int > 1 and states.sensor.birthday_kat.state | int < 15 %} + Katherine's Birthday is in {{ states.sensor.birthday_kat.state }} days! + {% else %} {% endif %}

@@ -19,7 +51,7 @@ '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 %} + {% elif states.sensor.halloween_countdown.state | int < 30 and states.sensor.halloween_countdown.state | int > 1 %} There are only {{states.sensor.halloween_countdown.state}} days {{ [ 'until Halloween.', 'until Halloween. It might not be enough time. ', @@ -31,7 +63,7 @@ {% endif %} {% if states.sensor.christmas_countdown.state | int == 1 %} Tomorrow is Christmas. It is practically here! Santa is coming tonight! Do not forget the cookies! - {% elif states.sensor.christmas_countdown.state | int < 31 %} + {% elif states.sensor.christmas_countdown.state | int < 31 and states.sensor.christmas_countdown.state | int > 1 %} 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.', diff --git a/config/templates/speech/morning_briefing.yaml b/config/templates/speech/morning_briefing.yaml index 7ccac81..24b0bd8 100755 --- a/config/templates/speech/morning_briefing.yaml +++ b/config/templates/speech/morning_briefing.yaml @@ -39,7 +39,7 @@ {{states.sensor.today_is.state }}.

- It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch.state|round}} degrees in Grayson. + It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch_temperature.state|round}} degrees in Grayson.

{% if states.sensor.nws_alerts.state | int > 0 %} @@ -99,7 +99,7 @@ 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. + 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%} @@ -112,22 +112,6 @@ 'Everyday can be a holiday. So today is ' ]|random }} {{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}. - {{ [ - 'We should celebrate.', - 'I will leave the party planning up to you.', - 'I bet you are glad I told you.', - 'Wait. Really. That cannot be a Real holiday.', - 'Wait. That is a Real holiday?', - 'Umm. Okay. You cannot make this stuff up.', - 'But, that just sounds silly.', - 'You did not know did you? But, now you do.' - ]|random }} - {{ [ - 'Anyway. ', - 'Moving On. ', - 'Back to the morning announcements. ', - 'Right. Well. ' - ]|random }} {%- endif -%}

diff --git a/config/templates/speech/morning_wakeup_report.yaml b/config/templates/speech/morning_wakeup_report.yaml index 9435b31..cf6701c 100755 --- a/config/templates/speech/morning_wakeup_report.yaml +++ b/config/templates/speech/morning_wakeup_report.yaml @@ -39,7 +39,7 @@ {{states.sensor.today_is.state }}.

- It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch.state|round}} degrees in Grayson. + It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch_temperature.state|round}} degrees in Grayson.

{% if is_state('sensor.clothing_forecast', 'Freezing') %} diff --git a/config/templates/speech/nightly_briefing.yaml b/config/templates/speech/nightly_briefing.yaml index fb3f3d3..6081df8 100755 --- a/config/templates/speech/nightly_briefing.yaml +++ b/config/templates/speech/nightly_briefing.yaml @@ -1,157 +1,62 @@ > - {# Nightky Report #} + {# Nightly Report #} {%- macro getReport() -%} -

- {% 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 %} -

- {{ [ - '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.' - ]|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 }} - {% elif is_state('binary_sensor.side_door', 'on') %} - {{ [ 'The side door is ajar. ', - 'The side door is open. ', - 'Someone forgot to close the side door.' - ] | random }} - {% 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. Someone might want to bring the lemon tree in. ', - '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 you.', - '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.' - ] | random }} - {% endif %} -

- - {% if is_state('sensor.today_is', 'Tuesday') %} - {% if now().strftime('%H')|int > 17 %} - {{ [ 'Do not forget to bring in the trash cans. ', - 'The trash cans will feel lonely if you leave them out all night. ', - 'The HOA will get mad if you leave those trash cans out on the street.' - ] | random }} - {% endif %} - {% endif %} -

-

{% 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 }} + 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 }} - + 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. It is practically here! Santa is coming tonight! Do not forget the cookies! + Tomorrow is Christmas. It is practically here! 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 }} + 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. + 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. + 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 %} + {% 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. + 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/security_report.yaml b/config/templates/speech/security_report.yaml index 4dd34ba..e469beb 100755 --- a/config/templates/speech/security_report.yaml +++ b/config/templates/speech/security_report.yaml @@ -7,34 +7,35 @@ 'Sentry Mode is enabled.', 'Sentry mode is currently active.', 'Barn Door Protocol is currently in effect.', - 'My security system is currently armed.' + '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.' + '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 secured. + All external doors are currently secured. {% else %} - The following doors are open, - {%- if states.binary_sensor.front_door.state == 'on' %} - Front Door. - {% endif %} - {%- if states.binary_sensor.back_door.state == 'on' %} - Back Door. - {% endif %} - {%- if states.binary_sensor.laundry_room_door.state == 'on' %} - Laundry Room Door. - {% endif %} - {%- if states.binary_sensor.garage_door.state == 'on' %} - Garage Door. - {% endif %} - {%- if states.binary_sensor.side_door.state == 'on' %} - Side Door. + {% 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 -%} diff --git a/config/templates/speech/skylar_nightly_briefing.yaml b/config/templates/speech/skylar_nightly_briefing.yaml index 4943e97..03a6943 100755 --- a/config/templates/speech/skylar_nightly_briefing.yaml +++ b/config/templates/speech/skylar_nightly_briefing.yaml @@ -1,6 +1,57 @@ > {# 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 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. It is practically here! 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 %} +

Skyler, {{ [ 'It is time to get in the bath. ', diff --git a/config/templates/speech/sundown_briefing.yaml b/config/templates/speech/sundown_briefing.yaml new file mode 100755 index 0000000..a6ac19d --- /dev/null +++ b/config/templates/speech/sundown_briefing.yaml @@ -0,0 +1,174 @@ +> + {# Nightky Report #} + {%- macro getReport() -%} +

+ {% 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 %} +

+

+ {{ [ + '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.' + ]|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 }} + {% elif is_state('binary_sensor.side_door', 'on') %} + {{ [ 'The side door is ajar. ', + 'The side door is open. ', + 'Someone forgot to close the side door.' + ] | random }} + {% 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. Someone might want to bring the lemon tree in. ', + '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 you.', + '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.' + ] | random }} + {% endif %} +

+ {% if is_state('sensor.today_is', 'Tuesday') %} + {% if now().strftime('%H')|int > 17 %} + {{ [ 'Do not forget to bring in the trash cans. ', + 'The trash cans will feel lonely if you leave them out all night. ', + 'The HOA will get mad if you leave those trash cans out on the street.' + ] | random }} + {% endif %} + {% endif %} +

+

+ {% 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. It is practically here! 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 %} +

+ {%- 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