From d5191c9ab8423642784aadae72dedc092f1d7542 Mon Sep 17 00:00:00 2001 From: Jeffrey Stone Date: Wed, 2 Dec 2020 22:55:11 -0500 Subject: [PATCH] Major audible notification overhual. It was hard to maintain. This will be easier. Maybe --- config/automations.yaml | 48 +- config/groups.yaml | 4 + config/input_boolean.yaml | 7 +- config/input_datetime.yaml | 5 + config/packages/announcements.yaml | 269 ++-- config/packages/appliances.yaml | 17 +- config/packages/audio.yaml | 24 + config/packages/daily.yaml | 8 +- config/packages/events.yaml | 23 +- config/packages/jarvis.yaml | 26 +- config/packages/notify.yaml | 1388 ++--------------- config/packages/presence.yaml | 139 +- config/packages/security.yaml | 136 +- config/packages/space.yaml | 22 +- config/packages/twitter.yaml | 68 +- config/packages/usps.yaml | 22 +- config/packages/weather.yaml | 63 +- config/templates/speech/event_briefing.yaml | 79 + config/templates/speech/morning_briefing.yaml | 164 ++ .../speech/morning_wakeup_report.yaml | 147 ++ config/templates/speech/nightly_briefing.yaml | 170 ++ config/templates/speech/security_report.yaml | 55 + .../speech/skylar_morning_briefing.yaml | 137 ++ .../speech/skylar_nightly_briefing.yaml | 80 + 24 files changed, 1537 insertions(+), 1564 deletions(-) create mode 100755 config/templates/speech/event_briefing.yaml create mode 100755 config/templates/speech/morning_briefing.yaml create mode 100755 config/templates/speech/morning_wakeup_report.yaml create mode 100755 config/templates/speech/nightly_briefing.yaml create mode 100755 config/templates/speech/security_report.yaml create mode 100755 config/templates/speech/skylar_morning_briefing.yaml create mode 100755 config/templates/speech/skylar_nightly_briefing.yaml diff --git a/config/automations.yaml b/config/automations.yaml index ecb16e6..cc15b8c 100644 --- a/config/automations.yaml +++ b/config/automations.yaml @@ -254,48 +254,14 @@ entity_id: binary_sensor.front_door state: 'off' action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: '{{ [ "I have detected motion at the ", "Someone may be at the - ", "There is movement at the ", "My sensors are picking up motion at the ", - "We appear to have a visitor at the " ] | random }} {{ trigger.to_state.attributes.friendly_name - }}. - - ' - call_snark_door_motion: 1 + who: '{{ states.sensor.room_audio.state }}' + message: '{{ [ "I have detected motion at the ", "Someone may be at the + ", "There is movement at the ", "My sensors are picking up motion at the ", + "We appear to have a visitor at the " ] | random }} {{ trigger.to_state.attributes.friendly_name + }}.' - delay: 00:02:00 mode: single initial_state: true -- id: improved_welcome_home - alias: Improved Welcome Home - mode: queued - max: 4 - trigger: - - platform: state - entity_id: - - person.jeffrey - - person.katherine - - person.uncle_matt - - person.papa - from: not_home - to: home - condition: - - condition: state - entity_id: sensor.family_status - state: Home - action: - - service: script.family_is_home - - delay: 00:02:00 - - service: script.ah_report - data_template: - call_interuption: 1 - welcome_home: "{% set person = trigger.to_state.attributes.friendly_name %}\ - \ {%- macro greeting_sentence(person) -%} {{ [\n person + \" has arrived.\"\ - ,\n person + \" is in the neighborhood.\",\n person + \" is arriving.\"\ - ,\n \"My sensors are picking up the presence of additional humans. \" ~ person\ - \ +\" has been identified as home.\",\n \"Welcome back home \" ~ person,\n\ - \ \"Guess who is home?\" ~ person +\" is!\",\n \"I am sensing a disturbance\ - \ in the force. \" ~ person +\" must be home!\",\n person + \" is now in\ - \ the house.\",\n person ~ \"! You are home!\",\n \"I know a secret! \"\ - \ ~ person +\" is home!\",\n person + \" has finally made it home.\"\n \ - \ ] | random }}\n{%- endmacro -%} {{greeting_sentence(person)}}\n" + diff --git a/config/groups.yaml b/config/groups.yaml index f08539e..b9d9fab 100755 --- a/config/groups.yaml +++ b/config/groups.yaml @@ -7,6 +7,10 @@ Family: - person.jeffrey - person.katherine +arriving: + name: Arriving + entities: [] + House Conditions: - climate.first_floor diff --git a/config/input_boolean.yaml b/config/input_boolean.yaml index 0ae2aaa..2c1bcc4 100755 --- a/config/input_boolean.yaml +++ b/config/input_boolean.yaml @@ -83,4 +83,9 @@ skylar_school: name: Skylar at School shuffle_spotify: name: Spotify Shuffle - +good_morning_report: + name: Good Morning Report +master_bedroom_alarm: + name: Master Bedroom Alarm +skylar_awake: + name: Skylar Awake diff --git a/config/input_datetime.yaml b/config/input_datetime.yaml index f90675d..2dead7e 100755 --- a/config/input_datetime.yaml +++ b/config/input_datetime.yaml @@ -46,4 +46,9 @@ nightly_lockdown: morning_standby: name: Morning Standby has_date: false + has_time: true + +skylar_awake_at: + name: Skylar Awake At + has_date: false has_time: true \ No newline at end of file diff --git a/config/packages/announcements.yaml b/config/packages/announcements.yaml index 4e5936c..a262f2c 100755 --- a/config/packages/announcements.yaml +++ b/config/packages/announcements.yaml @@ -18,6 +18,10 @@ input_datetime: name: Nightly Report has_date: false has_time: true + daily_report: + name: Daily Report + has_date: false + has_time: true skylar_morning_report: name: Skylar Dressed Announcement has_date: false @@ -60,32 +64,6 @@ automation: action: - service: script.turn_on_ha_speaker - - id: turn_on_ha_receiver - alias: Turn on HA Receiver - initial_state: true - trigger: - - platform: time - at: '06:45:00' - action: - - service: media_player.turn_on - data: - entity_id: media_player.tsr_6750_a3ed2f - - service: media_player.volume_set - data_template: - entity_id: media_player.tsr_6750_a3ed2f - volume_level: .80 - - - id: turn_off_ha_receiver - alias: Turn off HA Receiver - initial_state: true - trigger: - - platform: time - at: '23:30:00' - action: - - service: media_player.turn_off - data: - entity_id: media_player.tsr_6750_a3ed2f - - id: set_audible_time_off_guest alias: set audible time off guest @@ -104,25 +82,6 @@ automation: 20:30 {% endif %} - - id: set_audible_time_off_normal - alias: set audible time off normal - trigger: - - platform: state - entity_id: input_boolean.guest_mode - to: 'off' - - platform: state - entity_id: binary_sensor.school_tomorrow - 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:45 - {% endif %} - - id: prebed_routine initial_state: true @@ -131,9 +90,7 @@ automation: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - - service: script.ah_report - data: - call_prebed_routine: 1 + - service: script.skylar_nightly_briefing - id: nightly_report initial_state: true @@ -142,45 +99,26 @@ automation: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - - service: script.ah_report - data: - call_greeting: 1 - call_evening_greeting: 1 - call_weather_alerts: 1 - call_overnight_forecast: 1 - call_freeze_warning: 1 - call_future_forecast: 1 - call_upcoming_holidays: 1 - call_upcoming_events: 1 - call_reminders: 1 - call_chores: 1 - call_full_moon: 1 + - service: script.nightly_briefing_report - id: good_morning_report alias: Good Morning Report initial_state: true trigger: - platform: template - value_template: "{{ states('sensor.time') == (state_attr('input_datetime.morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" + # platform: template + # value_template: "{{ states('sensor.time') == (state_attr('input_datetime.morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" + - platform: state + entity_id: binary_sensor.kitchen_occupancy + to: 'on' + condition: + - condition: time + after: '07:00:00' + before: '08:30:00' + - condition: state + entity_id: input_boolean.good_morning_report + state: 'on' action: - - service: script.ah_report - data: - call_greeting: 1 - call_morning_greeting: 1 - call_time_annc: 1 - call_weather_alerts: 1 - call_skylar_dressed: 1 - call_school_today: 1 - call_skylar_events: 1 - call_todays_events: 1 - call_current_conditions_outside: 1 - call_clothes_suggestion: 1 - call_current_conditions_inside: 1 - call_daily_forecast: 1 - call_upcoming_birthdays: 1 - call_upcoming_events: 1 - call_reminders: 1 - call_chores: 1 + - service: script.morning_briefing - service: script.twitter_notify data: message: >- @@ -193,34 +131,27 @@ automation: "#Homeassistant gives me the ability to make daily announcements like the one I just did using #Amazon Polly.", "Each day at this time I provide the residents of this house an update that includes everything they need to know about the upcoming day. But with more snark." ] | random }} - - service: switch.turn_off - entity_id: switch.0xf0d1b80000052281_switch + - service: input_boolean.turn_on + entity_id: input_boolean.good_morning_report - # - id: skylar_morning_greeting - # alias: Skylar Morning Greeting - # initial_state: true - # trigger: - # platform: template - # value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" - # # condition: - # # - condition: time - # # weekday: - # # - mon - # # - tue - # # - wed - # # - thu - # # - fri - # action: - # - service: script.ah_report - # data: - # call_interuption: 1 - # call_skylar_dressed: 1 - # call_school_today: 1 - # call_skylar_events: 1 - # call_clothes_suggestion: 1 - # - service: switch.turn_off - # entity_id: switch.0xf0d1b80000052281_switch + - id: master_bedroom_report + alias: Master Bedroom Report + initial_state: true + trigger: + platform: template + value_template: "{{ states('sensor.time') == (state_attr('input_datetime.daily_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" + condition: + - condition: time + weekday: + - mon + - tue + - wed + - thu + - fri + action: + - service: script.morning_wakeup_report + - id: skylar_morning_alarm_announcement alias: skylar morning alarm announcement trigger: @@ -232,18 +163,20 @@ automation: action: - service: scene.turn_on entity_id: scene.skylar_room_morning - - service: notify.alexa_media_skylar_s_bedroom - data: - message: Good Morning Skylar. Time to Rise and Shine. - data: - type: tts - - delay: - seconds: 30 - - service: notify.alexa_media_skylar_s_bedroom - data: - message: Good Morning Skylar. You have school today. Time to get up. - data: - type: tts + - service: script.skylar_morning_briefing + # - service: notify.alexa_media_skylar_s_bedroom + # data: + # message: Good Morning Skylar. Time to Rise and Shine. + # data: + # type: tts + # - delay: + # seconds: 30 + # - service: notify.alexa_media_skylar_s_bedroom + # data: + # message: Good Morning Skylar. You have school today. Time to get up. + # data: + # type: tts + - id: set_skylar_morning_report_time alias: set skylar morning report time @@ -261,19 +194,87 @@ automation: 07:15 {% endif %} - - id: set_morning_report_time - alias: set morning report time - trigger: - - platform: time - at: '05:50:30' - action: - - service: input_datetime.set_datetime - entity_id: input_datetime.morning_report - data_template: - time: > - {% if states.calendar.skylar_school.attributes.offset_reached == True %} - 07:10 - {% else %} - 08:00 - {% endif %} + # - id: set_morning_report_time + # alias: set morning report time + # trigger: + # - platform: time + # at: '05:50:30' + # action: + # - service: input_datetime.set_datetime + # entity_id: input_datetime.morning_report + # data_template: + # time: > + # {% if states.calendar.skylar_school.attributes.offset_reached == True %} + # 07:10 + # {% else %} + # 08:00 + # {% endif %} + + +script: + reset_annc_switches: + sequence: + - service: input_boolean.turn_off + entity_id: input_boolean.good_morning_report + + security_briefing: + sequence: + - service: script.jarvis_voice + data_template: + who: kitchen + message: !include ../templates/speech/security_report.yaml + + event_briefing: + sequence: + - service: script.jarvis_voice + data_template: + who: kitchen + message: !include ../templates/speech/event_briefing.yaml + + skylar_morning_briefing: + sequence: + - service: > + {%- if is_state('binary_sensor.theater_occupancy', 'on') and is_state('media_player.theater_tv', 'on') %} + script.jarvis_voice + {% else %} + notify.alexa_media_skylar_s_bedroom + {%- endif %} + data: > + {%- if is_state('binary_sensor.theater_occupancy', 'on') and is_state('media_player.theater_tv', 'on') %} + who: main + message: !include ../templates/speech/skylar_morning_briefing.yaml + {% else %} + message: !include ../templates/speech/skylar_morning_briefing.yaml + data: + type: tts + {%- endif %} + + skylar_nightly_briefing: + sequence: + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: !include ../templates/speech/skylar_nightly_briefing.yaml + + nightly_briefing_report: + sequence: + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: !include ../templates/speech/nightly_briefing.yaml + + morning_briefing: + sequence: + - service: script.jarvis_voice + data_template: + who: kitchen + message: !include ../templates/speech/morning_briefing.yaml + + morning_wakeup_report: + sequence: + - service: script.jarvis_voice + data_template: + who: master_bedroom + message: !include ../templates/speech/morning_wakeup_report.yaml + \ No newline at end of file diff --git a/config/packages/appliances.yaml b/config/packages/appliances.yaml index 368ffe2..c5e75a5 100755 --- a/config/packages/appliances.yaml +++ b/config/packages/appliances.yaml @@ -149,9 +149,20 @@ script: - condition: state entity_id: sensor.washer_status state: complete - - service: script.ah_report - data: - call_washer_needs_emptying: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: > +

+ {{ [ + 'Just a reminder. Washing machine needs to be emptied.', + 'I am sure you have more inportant things to do, but do not forget to empty the washer.', + 'Looks like the washing machine has completed it is cycle. You know what to do. I hope.', + 'Do not forget to move the clothes to the dryer.', + "Someone forgot to move the clothes to the dryer. I am not going to name any names. But there is a camera in there. ", + "Do you like when your clothes smell like mildew? Because that is what is happeneing. Right now. " + ] | random }} +

washer_idle: diff --git a/config/packages/audio.yaml b/config/packages/audio.yaml index 53ffb80..1291c7e 100755 --- a/config/packages/audio.yaml +++ b/config/packages/audio.yaml @@ -106,3 +106,27 @@ script: media_content_type: video/youtube media_content_id: > {{ media }} + +sensor: + - platform: template + 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 + {% elif is_state('binary_sensor.kitchen_occupancy', 'on') %} + kitchen + {% elif is_state('binary_sensor.living_room_occupancy', 'on') and is_state('input_boolean.audible_notifications', 'on') %} + main + {% elif is_state('binary_sensor.croft_occupancy', 'on') %} + croft + {% elif is_state('binary_sensor.master_bedroom_occupancy', 'on') %} + master_bedroom + {% else %} + all_google + {%- 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 831b683..040d3b5 100755 --- a/config/packages/daily.yaml +++ b/config/packages/daily.yaml @@ -165,6 +165,7 @@ automation: data: entity_id: light.kitchen_cabinets - service: script.good_night_loft + - service: script.reset_annc_switches - service: script.twitter_notify_image data_template: tweet: >- @@ -222,10 +223,7 @@ automation: data: entity_id: alarm_control_panel.aarlo_ah_base_station mode: 'Armed' - - service: script.ah_report - data: - call_dark_outside: 1 - call_garage_door_status: 1 + - service: script.nightly_briefing_report - id: outside_lights_off_sunrise alias: Outside Lights off at Sunrise @@ -384,7 +382,7 @@ automation: data_template: time: > {% if states.sensor.school_tomorrow.state == 'on' %} - 20:00 + 19:45 {% else %} 20:15 {% endif %} diff --git a/config/packages/events.yaml b/config/packages/events.yaml index 40a3e93..86a3b29 100755 --- a/config/packages/events.yaml +++ b/config/packages/events.yaml @@ -185,10 +185,10 @@ automation: value_template: '{{ states.calendar.skylar_school.state == "Off" }}' action: - wait_template: "{{ not is_state('media_player.ha_speaker', 'playing') }}" - - service: script.ah_report - data: - call_interuption: 1 - speech_message: "Blackout time has started." + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: "Blackout time has started." - service: input_boolean.turn_on entity_id: input_boolean.blackout_time @@ -204,10 +204,10 @@ automation: state: 'on' action: - wait_template: "{{ not is_state('media_player.ha_speaker', 'playing') }}" - - service: script.ah_report - data: - call_interuption: 1 - speech_message: "Blackout time has ended" + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: "Blackout time has ended" - service: input_boolean.turn_off entity_id: input_boolean.blackout_time @@ -272,9 +272,10 @@ script: - condition: state entity_id: sensor.family_status state: Home - - service: script.ah_report - data: - speech_message: "Skylar, digital learning will begin in about thirty minutes. I have turned on the lighting around your desk. I will be disabling audible notifications during school hours." + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: "Skylar, digital learning will begin in about thirty minutes. I have turned on the lighting around your desk. I will be disabling audible notifications during school hours." - delay: minutes: 5 - service: input_boolean.turn_off diff --git a/config/packages/jarvis.yaml b/config/packages/jarvis.yaml index 2d25adc..eae3aa6 100755 --- a/config/packages/jarvis.yaml +++ b/config/packages/jarvis.yaml @@ -20,10 +20,17 @@ automation: action: - service: homeassistant.turn_on entity_id: group.incense - - service: script.ah_report + - service: script.jarvis_voice data_template: - call_confirmation: 1 - call_house_party_protocol_enabled: 1 + who: '{{ states.sensor.room_audio.state }}' + message: > +

+ {{ [ + 'Anchorage House has been configured for a House Party.', + 'Incense has been turned on.', + 'I have enabled house party protocol.' + ] | random }} +

- id: house_party_protocol_off alias: Turn Off House Party Protocol @@ -35,7 +42,14 @@ automation: action: - service: homeassistant.turn_off entity_id: group.incense - - service: script.ah_report + - service: script.jarvis_voice data_template: - call_confirmation: 1 - call_house_party_protocol_disabled: 1 + who: '{{ states.sensor.room_audio.state }}' + message: > +

+ {{ [ + 'The House Party has been canceled.', + 'Incense has been turned off.', + 'I have disabled house party protocol.' + ] | random }} +

diff --git a/config/packages/notify.yaml b/config/packages/notify.yaml index 488e9be..378d52a 100755 --- a/config/packages/notify.yaml +++ b/config/packages/notify.yaml @@ -264,13 +264,6 @@ script: topic: 'house/polly/lastmsg' payload: 'This message is from {{ now().strftime("%-I") }}:{{ now().strftime("%M") }} {{ now().strftime("%p") }}. {{ message | truncate(220)}}' retain: true - - service: media_player.turn_on - data: - entity_id: media_player.tsr_6750_a3ed2f - - service: media_player.volume_set - data_template: - entity_id: media_player.tsr_6750_a3ed2f - volume_level: .99 - service: media_player.turn_on data_template: entity_id: > @@ -335,7 +328,6 @@ script: .99 {% endif %} {% endif %} - # media_player.googlehome0715, media_player.googlehomehub3492, media_player.upstairs_speaker - service: tts.amazon_polly_say data_template: entity_id: > @@ -367,6 +359,8 @@ script: cache: true + + ############################################################################### # Voice Notify # Conditions: @@ -384,11 +378,6 @@ script: - condition: state entity_id: input_boolean.vacation_mode state: 'off' - # - service: switch.turn_on - # entity_id: switch.ha_speaker - # - condition: state - # entity_id: media_player.guest_tv - # state: 'idle' - service: tts.google_translate_say data_template: entity_id: media_player.guest_tv @@ -406,1205 +395,95 @@ script: retain: true - condition: template value_template: '{{ states.binary_sensor.quiet_time.state == "off" }}' - # - condition: state - # entity_id: binary_sensor.vlc_player - # state: 'off' - condition: state - entity_id: sensor.family_status - state: 'Home' + entity_id: group.family + state: 'home' - condition: state entity_id: input_boolean.vacation_mode state: 'off' - # - service: switch.turn_on - # entity_id: switch.ha_speaker - service: media_player.turn_on - entity_id: media_player.ha_speaker - - service: media_player.volume_set data_template: - entity_id: media_player.ha_speaker - volume_level: > - {% if states.input_boolean.audible_notifications.state == 'on' %} - .65 + entity_id: > + {% if who == 'kitchen' %} + media_player.kitchen_display + {% elif who == 'croft' %} + media_player.upstairs_speaker + {% elif who == 'master_bedroom' %} + media_player.master_bedroom_speaker + {% elif who == 'theater' %} + media_player.theater + {% elif who == 'all_google' %} + media_player.house + {% elif who == 'main' %} + media_player.ha_speaker {% else %} - .4 + {% if states.input_boolean.audible_notifications.state == 'on' %} + media_player.ha_speaker + {% else %} + media_player.house + {% endif %} {% endif %} - service: media_player.volume_set data_template: - entity_id: media_player.googlehome0715 - volume_level: > - {% if states.input_boolean.audible_notifications.state == 'on' %} - .65 + entity_id: > + {% if who == 'kitchen' %} + media_player.kitchen_display + {% elif who == 'croft' %} + media_player.upstairs_speaker + {% elif who == 'master_bedroom' %} + media_player.master_bedroom_speaker + {% elif who == 'theater' %} + media_player.theater + {% elif who == 'all_google' %} + media_player.house + {% elif who == 'main' %} + media_player.ha_speaker {% else %} - .4 + {% if states.input_boolean.audible_notifications.state == 'on' %} + media_player.ha_speaker + {% else %} + media_player.house + {% endif %} {% endif %} - - service: media_player.volume_set - data_template: - entity_id: media_player.googlehomehub3492 volume_level: > - {% if states.input_boolean.audible_notifications.state == 'on' %} - .65 - {% else %} - .4 - {% endif %} - - service: media_player.volume_set - data_template: - entity_id: media_player.upstairs_speaker - volume_level: > - {% if states.input_boolean.audible_notifications.state == 'on' %} - .65 - {% else %} - .4 - {% endif %} - # media_player.googlehome0715, media_player.googlehomehub3492, media_player.upstairs_speaker + {% if states.input_boolean.audible_notifications.state == 'on' %} + .6 + {% else %} + .4 + {% endif %} - service: tts.amazon_polly_say data_template: entity_id: > - {% if states.input_boolean.audible_notifications.state == 'on' and states.media_player.ha_speaker.state != 'playing' %} - media_player.ha_speaker + {% if who == 'kitchen' %} + media_player.kitchen_display + {% elif who == 'croft' %} + media_player.upstairs_speaker + {% elif who == 'master_bedroom' %} + media_player.master_bedroom_speaker + {% elif who == 'studio' %} + media_player.theater + {% elif who == 'all_google' %} + media_player.house + {% elif who == 'main' %} + media_player.ha_speaker {% else %} - media_player.house + {% if states.input_boolean.audible_notifications.state == 'on' %} + media_player.ha_speaker + {% else %} + media_player.house + {% endif %} {% endif %} message: >- - + {{ message }} cache: true - ah_report: - sequence: - - condition: or - conditions: - - condition: state - entity_id: sensor.family_status - state: 'Home' - - condition: state - entity_id: input_boolean.guest_mode - state: 'on' - - - service: script.jarvis_voice - data_template: - message: >- - - {% macro greeting() %} -

- {% 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 %} - {% endmacro %} - - {% macro confirmation() %} - {{ [ - 'Okay.', - 'If you insist.', - 'I am afraid I can not do that I am kidding,', - 'Leave it to me.', - 'As you wish.', - 'I am on it.', - 'No Problem.', - 'I think I can handle that.', - 'Working on it now.', - ' Oh, you were talking to me. Let me take care of that.' - 'Why not. It is not like I ever sleep.', - 'I am not even supposed to be here today. But whatever.', - 'You did not say the magic word. Oh forget it. I will take care of it.', - 'Funny, I was just about to do that.', - 'There are still terabytes of calculations required before I can. Oh, whatever.' - ] | random }} - {% endmacro %} - - {% macro interuption() %} - {{ [ - 'Pardon me,', - 'Excuse me,', - 'I do not mean to interupt, but,', - 'I hate to interrupt, but,', - 'I beg your pardon,', - 'I do not mean to intrude, but,', - 'I am sorry to interrupt, but,', - 'Just a quick heads up, ' - ] | random }} - {% endmacro %} - - {% macro issue() %} - {{ [ - 'I have detected an issue!', - 'We have a problem!' - ] | random }} - {% endmacro %} - - - - {% macro morning_greeting() %} - {{ [ 'Time to Rise and Shine. ', - 'Lets do this thing.', - 'I hope you got some rest.', - 'It is time to get the day started.', - 'Glad to see everyone made it.', - 'The early bird gets the worm.', - 'from the bridge.', - 'Hooray you live to drink another day.' - ] | random }} - {% if is_state('input_boolean.guest_mode', 'on') %} - {{ [ 'And a special welcome to our guests. ', - 'And good morning to our guests as well. ', - 'Hey look at that, someone came to visit Anchorage House. Hope everyone slept well.' - ] | random }} - {% endif %} -

- {% endmacro %} - - {% macro evening_greeting() %} - {{ [ - 'The day is almost over.', - 'Before things start to quiet down,', - 'Anchorage House.', - 'from the bridge.', - 'Pardom the interuption.', - 'I hope everyone got their chores done.', - 'Did everyone have a little fun today?' - ] | random }} -

- {% endmacro %} - - {% macro time_annc() %} -

- {% 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 %} - - {{ [ - 'Today is ', - 'If you have not been keeping track today is ', - 'Do you know what day of the week it is? Today is', - 'I hate to be the bearer of bad news, but today is ', - 'Oh look, once again it is ' - ]|random }} - {{states.sensor.today_is.state }}. -

- {% endmacro %} - - {% macro weather_alerts() %} -

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

- {% endmacro %} - - {% macro lightning_alert() %} -

- {{ [ - 'I have detected lightning withing 20 miles of Anchorage House.', - 'Did you see that flash? I did. Lightning is near.', - 'If you didnt hear the thunder you will soon. ' - ]|random }} - If anyone is outside they shoudld seek shelter inside. - {% if is_state('binary_sensor.garage_door', 'on') %} - {{ [ 'The garage door needs to be closed. ', - 'Can someone close the garage?. ', - 'If you do not want the contents of the garage to get wet, you might want to close it.' - ] | random }} - {% endif %} -

- {% endmacro %} - - {% macro lightning_clear() %} -

- {{ [ - 'Lightning threat appears to be over.', - 'No more lightning appears to be occuring.', - 'Lightning is gone.' - ]|random }} - It is safe to resume normal activities.

- {% endmacro %} - - {% macro todays_events() %} -

- {% if is_state('sensor.halloween_countdown','0') %} - Happy Halloween! - {% endif %} - {% if is_state('sensor.christmas_countdown','0') %} - Merry Christmas Everyone! - {% 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. - {% 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 ") }}. - {{ [ - '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 -%} -

- {% endmacro %} - - {%- macro dark_outside() -%} -

- {{ [ - '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.', - 'If you have not looked outside lately, the light of the day is almost gone.' - ]|random }} -

- {%- endmacro -%} - - {% macro current_conditions_outside() %} -

- {{ [ - 'According to the National Weather Service,', - 'Checking the weather,', - 'Looking outside,' - ]|random }} - It is currently {{states.weather.home_2.state}} and {{states.nws_current_temperature.state|round}} degrees in Grayson. - The back porch is {{states.sensor.back_porch.state|round}} degrees. -

- {% endmacro %} - - {% macro current_conditions_inside() %} -

- The inside temperature is currently {{states.climate.home.attributes.current_temperature|round}} degrees. - {% if is_state('climate.home', 'heat_cool') %} - {{ [ - 'The Climate is set to auto which should keep the internal temperature between ', - 'The internal climate should be between ', - 'The house is configured to keep the temperature between ' - ]|random }} - {{states.climate.home.attributes.target_temp_low}} and {{states.climate.home.attributes.target_temp_high}} degrees. - {% else %} - {{ [ - 'The Climate is currently set to ', - 'The air is currently set to ', - 'The internal climate system is set to ' - ]|random }} - {{states.climate.home.state}}. - {% endif %} -

- {% endmacro %} - - {% macro current_conditions_garage() %} -

- The garage is {{states.sensor.garage.state|round}} degrees with a humidity of {{states.sensor.garage.attributes.humidity|round}} percent. -

- {% endmacro %} - - {% macro daily_forecast() %} -

- {{ [ - 'The National Weather Service forecast says,', - 'According to the latest forecast,' - ]|random }} - The rest of the day should be {{ states.sensor.nws_current_forecast.state }} -

- {% endmacro %} - - {% macro overnight_forecast() %} -

- {{ [ - 'Tonight we can expect,', - 'According to tonights forecast we can expect,' - ]|random }} - {{ states.sensor.nws_overnight_forecast.state }} -

- {% endmacro %} - - {% macro future_forecast() %} -

- {{ [ 'Looking into the future plan for tomorrow to be, ', - ' According to tomorrows forecast we can expect it to be, ', - 'If you have not seen tomorrows forecast it is expected to be, ' - ] | random }} - {{states.sensor.nws_forecast_tomorrow.state}}. -

- {% endmacro %} - - {% macro freeze_warning() %} -

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

- {% endmacro %} - - {% macro upcoming_birthdays() %} -

- {% if states.sensor.birthday_skylar.state | int == 1 %} - Tomorrow is Skylar's Birthday. - {% endif %} - {% if states.sensor.birthday_jeff.state | int == 1 %} - Tomorrow is Jeff's Birthday. - {% endif %} - {% if states.sensor.birthday_kat.state | int == 1 %} - Tomorrow is Katherine's Birthday. -

- {% endif %} - - {% endmacro %} - - {% macro upcoming_holidays() %} -

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

- {% endmacro %} - - {% macro upcoming_events() %} -

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

- {% endmacro %} - - {% macro skylar_dressed() %} -

- Skylar, - {% if is_state('sensor.birthday_skylar', '0') %} - Even birthday boys have to get dressed. So get to it. - {% else %} - {{ [ 'It is time to get dressed. ', - '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.' - ] | random }} - {% endif %} -

- {% endmacro %} - - {% macro prebed_routine() %} -

- Skyler, - {{ [ 'It is time to get in the bath. ', - 'You only have thirty minutes until bedtime. That means you should be heading for the bathtub. Time to get clean.', - '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 strange smell. I am running diagnostics. But in the mean time, you should start a bath.', - 'I hate to say it but, it is time to get cleaned up.', - 'Did you ever hear the one about the kid who never took a bath? Yeah, me either. So we should keep it that way. Bath time now, sir.', - 'Tee Minus 30 minutes and counting until you should be off to sleep. Time to get cleaned up, and get your pajamas on.' - ] | random }} - {% if is_state('sensor.school_tomorrow', 'on') %} - {{ [ 'Because you have school tomorrow. ', - 'Because you have to get up early tomorrow for school.', - 'Because you want to be ready for school tomorrow.' - ] | random }} - {% else %} - {% set month=states("sensor.date").split('-')[1] | int %} - {%- if is_state('input_boolean.school_in_session', 'off') -%} - {{ [ 'Looks like tomorrow is another day of summer vacation. ', - 'You are still on summer break tomorrow. ', - 'Summer vacation does not last forever, but it is not over yet. ' - ] | random }} - {% else %} - Oh, and it appears you do not have school tomorrow - {% endif %} - {{ [ 'so you can sleep in late tomorrow. ', - ' so there is not a reason to get up early tomorrow. ', - 'so we can sleep in tomorrow. ' - ] | random }} - {% endif %} - {% if states.sensor.school_start_days2go.state | int < 10 and states.sensor.school_start_days2go.state | int > 1 -%} - {{ [ 'I hate to say it, but ', - 'Unforunately,', - 'All good things must come to an end.' - ] | random }} - There are only {{ states.sensor.school_start_days2go.state }} days - {{ [ 'left of summer vacation. ', - ' left of summer break.', - 'Until School starts again.' - ] | random }} - {% elif states.sensor.school_start_days2go.state | int == 1 -%} - Tomorrow is the first day of school. Are you ready? - {%- endif %} - {% if states.sensor.school_end_days2go.state | int < 10 and states.sensor.school_end_days2go.state | int > 0 -%} - {{ [ 'School is almost over for the year.', - 'You have made it to the end of the school year.', - 'You are almost done with school.' - ] | random }} - There are only {{ states.sensor.school_end_days2go.state }} days - {{ [ 'left in the school year ', - ' left of school.', - 'Until the last day of school.' - ] | random }} - {% elif states.sensor.school_end_days2go.state | int == 0 -%} - Tomorrow is the first day of summer. Are you ready? - {%- endif %} - {{ [ 'I have configured Skylers room for sleep prep. ', - 'The lighting in Skylers room has been adjusted in preparation for bed.', - 'I have executed the Pre bed routine for Skylers room.' - ] | random }} -

- {% endmacro %} - - - {% macro school_today() %} -

- {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} - Because you have school today! - {% if states.calendar.skylar_school.attributes.description == 'early-release' %} - And guess what? It is early release! - {% endif %} - {% if states.calendar.skylar_school.attributes.description == 'start_thanksgiving_break' %} - And One More Thing. Tomorrow is the first day of Thanksgiving Break. - {% endif %} - {% if states.calendar.skylar_school.attributes.description == 'start_winter_break' %} - And One More Thing. Tomorrow is the first day of Winter Break. - {% endif %} - {% if states.calendar.skylar_school.attributes.description == 'start_spring_break' %} - And One More Thing. Tomorrow is the first day of Spring Break. - {% endif %} - {% if states.calendar.skylar_school.attributes.description == 'start_fall_break' %} - And One More Thing. Tomorrow is the first day of Fall Break. - {% 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 }}. - {{ [ 'Guess today would be a good day to clean your room.', - 'You could always do some chores.', - 'Lets try to keep the TV off today, ok?', - 'Want to play a nice game of chess? Sorry. I meant, want to play Thermal Nuclear War.', - 'I hope you enjoy your day off. You deserve it.', - 'Today would be a good day to spend some time with mom and dad.' - ] | random }} - - {% endif %} - - {% endif %} -

- {% endmacro %} - - {% macro skylar_events() %} -

- {% if is_state('calendar.skylar_events', 'on') %} - You have {{ states.calendar.skylar_events.attributes.message }} today as well! - {% endif %} - - {% set month=states("sensor.date").split('-')[1] | int %} - {% if is_state('input_boolean.school_in_session', 'off') %} - {{ [ 'If you were not aware there are ', - 'You only have ', - 'You still have ' - ] | random }} - {{ states.sensor.school_start_days2go.state }} days left of summer break. - {% elif is_state('sensor.school_tomorrow', 'on') and is_state('input_boolean.school_in_session', 'off') and month == 8 %} - Tomorrow is the first day of school! Which means today is the last day of summer break. I hope you make it a good one. - {% endif %} -

- {% endmacro %} - - {% macro clothes_suggestion() %} -

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

- {% endmacro %} - - {% macro school_holiday() %} -

- {% 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 }}. - {{ [ 'Guess today would be a good day to clean your room.', - 'You could always do some chores.', - 'Lets try to keep the TV off today. okay?', - 'Want to play a nice game of chess? Sorry. I meant. want to play Thermal Nuclear War.', - 'I hope you enjoy your day off. You deserve it.', - 'Today would be a good day to spend some time with mom and dad.' - ] | random }} - {% endif %} -

- {% endmacro %} - - {% macro reminders() %} -

- {% if is_state('input_boolean.heartworm', 'on') %} - Today is the day Winston gets his heartworm medicine. - {% endif %} -

- {% endmacro %} - - {% macro chores() %} -

- {% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %} - {{ [ 'Do not forget to make your beds', - 'Be sure to make your bed ', - 'If you made your bed you are already off to a great start. ' - ] | random }} - {% 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 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 %} - -

- {% endmacro %} - - {% macro door_status() %} -

- {% if is_state('group.external_doors', 'on') %} - There are doors are open. - {% else %} - All doors are closed. - {% endif %} -

- {% endmacro %} - - {% macro garage_door_status() %} -

- {% 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 %} - {{ [ 'The garage doors are closed. ', - 'The cargo hold is sealed. ', - 'Looks like the garage has been secured.', - 'The pod bay doors are closed. ' - ] | random }} - {% endif %} -

- {% endmacro %} - - {% macro jeff_location() %} -

- {% if is_state('sensor.jeff_location', 'home') %} - {{ [ - 'I am not sure why you are asking me,', - 'You must be having vision problems.', - 'I do not want to alarm you, but' - ] | random }} - Jeff is already home! - {% else %} - {% if is_state('sensor.jeff_destination', 'na') %} - {%- if states.device_tracker.life360_jeffrey_stone.attributes.moving == True %} - Jeff is currenly moving, but - {{ [ - 'I am unable to determine his destination.', - 'I am having trouble tracking him.', - 'His destination is currently unknown.' - ] | random }} - At last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. - {%- elif states.device_tracker.life360_jeffrey_stone.attributes.driving == True %} - Jeff is currenly moving, but - {{ [ - 'I am unable to determine his destination.', - 'I am having trouble tracking him.', - 'His destination is currently unknown.' - ] | random }} - At last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. - {% else %} - {% if is_state('sensor.jeff_location', 'Lost') %} - Jeff is lost, but at last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. - {% else %} - Jeff is currently at {{ states.sensor.jeff_location.state }}. - {% endif %} - {% endif %} - {% elif is_state('sensor.jeff_destination', 'home') %} - Jeff is currenly heading home and will be here in {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes. - {% else %} - Jeff is heading to {{ states.sensor.jeff_destination.state }}. - {% endif %} - {% endif %} -

- {% endmacro %} - - {% macro kat_location() %} -

- {% if is_state('sensor.kat_location', 'home') %} - {{ [ - 'I am not sure why you are asking me,', - 'You must be having vision problems.', - 'I do not want to alarm you, but' - ] | random }} - Katherine is already home! - {% else %} - {% if is_state('input_boolean.kat_travel_monitor', 'on') %} - {%- if states.device_tracker.life360_kat_stone.attributes.moving == True %} - Katherine is currently heading home and will be here in {{states.sensor.kat_ett_home.attributes.duration | round}} minutes. - {%- elif states.device_tracker.life360_kat_stone.attributes.driving == True %} - Katherine is currently heading home and will be here in {{states.sensor.kat_ett_home.attributes.duration | round}} minutes. - {% else %} - {% if is_state('sensor.kat_location', 'Lost') %} - Katherine is lost, but at last check was {{states.sensor.kat_ett_home.attributes.duration | round}} minutes from home. - {% else %} - Katherine is currently at {{ states.sensor.kat_location.state }}. - {% endif %} - {% endif %} - {% else %} - {%- if states.device_tracker.life360_kat_stone.attributes.moving == True %} - Katherine is currenly moving, and - {{ [ - 'I am unable to determine her destination.', - 'I am having trouble tracking her.', - 'Her destination is currently unknown.' - ] | random }} - At last check was {{states.sensor.kat_ett_home.attributes.duration | round}} minutes from home. - {%- elif states.device_tracker.life360_kat_stone.attributes.driving == True %} - Katherine is currenly moving, and - {{ [ - 'I am unable to determine her destination.', - 'I am having trouble tracking her.', - 'Her destination is currently unknown.' - ] | random }} - At last check was {{states.sensor.kat_ett_home.attributes.duration | round}} minutes from home. - {% else %} - {% if is_state('sensor.kat_location', 'Lost') %} - Katherine is lost, but at last check was {{states.sensor.kat_ett_home.attributes.duration | round}} minutes from home. - {% else %} - I have located Katherine. She is at {{ states.sensor.kat_location.state }}, and - at last check was {{states.sensor.kat_ett_home.attributes.duration | round}} minutes from home. - {% endif %} - {% endif %} - {% endif %} - {% endif %} -

- {% endmacro %} - - {% macro jeff_headed_home() %} -

- 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. -

- {% endmacro %} - - {% macro kat_headed_home() %} -

- 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. -

- {% endmacro %} - - {% macro traffic_conditions() %} -

- - {%- 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. - - {%- if states.sensor.home_to_summit.state|round > 50 %} - Traffic to the Cox Automotive appears heavy than normnal. - {% else %} - Traffic to the Cox is normal. - {% endif %} - Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Cox Automotive. -

- - {% endmacro %} - - {% macro iss() %} - {{ [ - 'But the International Space Station is passing over. Wave.', - 'But The International Space Station just flew by.', - 'But if you were to look up right now, and it was dark outside, and you happened to be looking in the right place you would see the International Space Station go by. But, it has already passed.' - ] | random}} - {% endmacro %} - - {% macro full_moon() %} -

- - {{ [ - 'There is a Full Moon out tonight. and this time it is the actual moon. And not the neighbor. ', - 'Hey look, There is the full moon. ', - 'The moon is huge! And full. ', - 'If you want to see the full moon, tonight is the night.'] | random }} -

- - {% endmacro %} - - {% macro security_report() %} -

- - {%- 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.' - ] | random}} - {% else %} - {{ [ - 'Sentry Mode is disabled.', - 'Sentry mode is currently active.', - 'My security system is currently disarmed.' - ] | random}} - {% endif %} - {%- if states.group.external_doors.state == 'off' %} - All external doors are 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. - {% endif %} - {% endif %} -

- - {% endmacro %} - - {%- macro washer_needs_emptying() -%} -

- {{ [ - 'Just a reminder. Washing machine needs to be emptied.', - 'I am sure you have more inportant things to do, but the washing machine needs to be emptied.', - 'Looks like the washing machine has completed it is cycle.', - 'Do not forget to move the clothes to the dryer.' - ] | random }} -

- - {%- endmacro -%} - - {%- macro house_party_protocol_enabled() -%} -

- - {{ [ - 'Anchorage House has been configured for a House Party.', - 'Incense has been turned on.', - 'I have enabled house party protocol.' - ] | random }} -

- - {%- endmacro -%} - - {%- macro house_party_protocol_disabled() -%} -

- - {{ [ - 'The House Party has been canceled.', - 'Incense has been turned off.', - 'I have disabled house party protocol.' - ] | random }} -

- - {%- endmacro -%} - - {%- macro snark_door_motion() -%} -

- - {{ [ - 'Do you want me to send them away?', - 'I have armed the lasers. Just say the word.', - 'I was not informed there would be guests.', - 'They do not appear to have any gifts, so I suggest no opening the door.', - 'My sensors have detected a meat popsicle.', - 'I do not think they can hear me.' - ] | random }} -

- - {%- endmacro -%} - - {%- macro snark_door_open() -%} -

- - {{ [ - 'Would you like me to calulate how much air condition is being wasted? Spoiler Alert. You are not going to like the answer.', - 'I have detected a large number of insects entering the house.', - 'Can a human be so kind and close it?', - 'The air quality in this house has actually improved.', - 'Closing the door would improve the security of the house.', - 'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.' - ] | random }} -

- - {%- endmacro -%} - - {%- macro launch() -%} - {{ [ - 'I have detected a rather large rocket preparing to take off.' - ] | random }} - {%- endmacro -%} - - {# a macro that removes all newline characters, empty spaces, and returns formatted text. Also replaces all Underscores with Spaces #} - {%- macro cleanup(data) -%} - {%- for item in data.split("\n") if item | trim != "" -%} - {{ item | trim | replace("_", " ") }} {% endfor -%} - {%- endmacro -%} - - {# ********************************************* #} - {# ******** Start the Speech routines ******** #} - {# ********************************************* #} - {# a macro to call all macros :) #} - {%- macro mother_of_all_macros() -%} - {% if call_greeting == 1 %} - {{ greeting() }} - {% endif %} - - {% if call_confirmation == 1 %} - {{ confirmation() }} - {% endif %} - - {% if call_interuption == 1 %} - {{ interuption() }} - {% endif %} - - {% if call_issue == 1 %} - {{ issue() }} - {% endif %} - - {% if call_morning_greeting == 1 %} - {{ morning_greeting() }} - {% endif %} - - {% if call_evening_greeting == 1 %} - {{ evening_greeting() }} - {% endif %} - - {% if call_time_annc == 1 %} - {{ time_annc() }} - {% endif %} - - {% if states.sensor.nws_alerts.state | int > 0 and call_weather_alerts == 1 %} - {{ weather_alerts() }} - {% endif %} - - {% if call_lightning_alert == 1 %} - {{ lightning_alert() }} - {% endif %} - - {% if call_lightning_clear == 1 %} - {{ lightning_clear() }} - {% endif %} - - {% if call_todays_events == 1 %} - {{ todays_events() }} - {% endif %} - - {% if call_dark_outside == 1 %} - {{ dark_outside() }} - {% endif %} - - {% if call_current_conditions_outside == 1 %} - {{ current_conditions_outside() }} - {% endif %} - - {% if call_current_conditions_inside == 1 %} - {{ current_conditions_inside() }} - {% endif %} - - {% if call_current_conditions_garage == 1 %} - {{ current_conditions_garage() }} - {% endif %} - - {% if call_daily_forecast == 1 %} - {{ daily_forecast() }} - {% endif %} - - {% if call_overnight_forecast == 1 %} - {{ overnight_forecast() }} - {% endif %} - - {% if call_future_forecast == 1 %} - {{ future_forecast() }} - {% endif %} - - {% if call_freeze_warning == 1 %} - {{ freeze_warning() }} - {% endif %} - - {% if call_upcoming_birthdays == 1 %} - {{ upcoming_birthdays() }} - {% endif %} - - {% if call_upcoming_holidays == 1 %} - {{ upcoming_holidays() }} - {% endif %} - - {% if call_upcoming_events == 1 %} - {{ upcoming_events() }} - {% endif %} - - {% if call_skylar_dressed == 1 %} - {{ skylar_dressed() }} - {% endif %} - - {% if call_prebed_routine == 1 %} - {{ prebed_routine() }} - {% endif %} - - {% if call_school_today == 1 %} - {{ school_today() }} - {% endif %} - - {% if call_skylar_events == 1 %} - {{ skylar_events() }} - {% endif %} - - {% if call_clothes_suggestion == 1 %} - {{ clothes_suggestion() }} - {% endif %} - - {% if call_school_holiday == 1 %} - {{ school_holiday() }} - {% endif %} - - {% if call_reminders == 1 %} - {{ reminders() }} - {% endif %} - - {% if call_chores == 1 %} - {{ chores() }} - {% endif %} - - {% if call_door_status == 1 %} - {{ door_status() }} - {% endif %} - - {% if call_garage_door_status == 1 %} - {{ garage_door_status() }} - {% endif %} - - {% if call_jeff_location == 1 %} - {{ jeff_location() }} - {% endif %} - - {% if call_kat_location == 1 %} - {{ kat_location() }} - {% endif %} - - {% if call_jeff_headed_home == 1 %} - {{ jeff_headed_home() }} - {% endif %} - - {% if call_kat_headed_home == 1 %} - {{ kat_headed_home() }} - {% endif %} - - {% if call_traffic_conditions == 1 %} - {{ traffic_conditions() }} - {% endif %} - - {{ usps }} - - {% if call_iss == 1 %} - {{ iss() }} - {% endif %} - - {% if call_full_moon == 1 %} - {% if is_state('sensor.moon', 'full_moon') %} - {{ full_moon() }} - {% endif %} - {% endif %} - - {% if call_security_report == 1 %} - {{ security_report() }} - {% endif %} - - {% if call_washer_needs_emptying == 1 %} - {{ washer_needs_emptying() }} - {% endif %} - - {% if call_house_party_protocol_enabled == 1 %} - {{ house_party_protocol_enabled() }} - {% endif %} - - {% if call_house_party_protocol_disabled == 1 %} - {{ house_party_protocol_disabled() }} - {% endif %} - - {{ welcome_home }} - - {{ speech_message }} - - {% if call_snark_door_motion == 1 %} - {{ snark_door_motion() }} - {% endif %} - - {% if call_snark_door_open == 1 %} - {{ snark_door_open() }} - {% endif %} - - {% if call_launch == 1 %} - {{ launch() }} - {% endif %} - - - {%- endmacro -%} - - - {{- cleanup(mother_of_all_macros()) -}} - ############################################################################### # Twitter ############################################################################### @@ -1615,6 +494,8 @@ script: - service: > {% if who == 'thejeffreystone' %} notify.twitter_js + {% elif who == 'slackerlabs' %} + notify.twitter_sl {% else %} notify.twitter {% endif %} @@ -1630,6 +511,8 @@ script: - service: > {% if who == 'thejeffreystone' %} notify.twitter_js + {% elif who == 'slackerlabs' %} + notify.twitter_sl {% else %} notify.twitter {% endif %} @@ -1642,102 +525,121 @@ script: twitter_snark: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_snark.yaml twitter_stats: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_stats.yaml twitter_promos: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_promos.yaml + who: '{{ who }}' + + twitter_follow_me: + sequence: + - service: script.twitter_notify + data_template: + message: !include ../templates/twitter_follow_me.yaml + who: '{{ who }}' twitter_selfpromos: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_selfpromos.yaml + who: '{{ who }}' + + twitter_recent_content: + sequence: + - service: script.twitter_notify + data: + who: '{{ who }}' + message: !include ../templates/twitter_recent_content.yaml + twitter_great_content: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_great_content.yaml + who: '{{ who }}' twitter_new_ha: sequence: - - service: notify.twitter + - service: script.twitter_notify data_template: message: !include ../templates/twitter_new_ha.yaml + who: '{{ who }}' ############################################################################### # Weather Report ############################################################################### - weather_report: - sequence: - - service: script.ah_report - data: - call_weather_alerts: 1 - call_current_conditions_outside: 1 - call_current_conditions_inside: 1 - call_current_conditions_garage: 1 - call_daily_forecast: 1 - call_overnight_forecast: 1 - call_future_forecast: 1 +# weather_report: +# sequence: +# - service: script.ah_report +# data: +# call_weather_alerts: 1 +# call_current_conditions_outside: 1 +# call_current_conditions_inside: 1 +# call_current_conditions_garage: 1 +# call_daily_forecast: 1 +# call_overnight_forecast: 1 +# call_future_forecast: 1 -############################################################################### -# Traffic Report -############################################################################### - traffic_report: - sequence: - - service: script.ah_report - data: - call_traffic_conditions: 1 +# ############################################################################### +# # Traffic Report +# ############################################################################### +# traffic_report: +# sequence: +# - service: script.ah_report +# data: +# call_traffic_conditions: 1 -############################################################################### -# Security Report -############################################################################### - security_report: - sequence: - - service: script.ah_report - data: - call_security_report: 1 +# ############################################################################### +# # Security Report +# ############################################################################### +# security_report: +# sequence: +# - service: script.ah_report +# data: +# call_security_report: 1 -############################################################################### -# Jeff Traffic Reports -############################################################################### - jeff_eta_report: - sequence: - - service: script.ah_report - data: - call_jeff_location: 1 +# ############################################################################### +# # Jeff Traffic Reports +# ############################################################################### +# jeff_eta_report: +# sequence: +# - service: script.ah_report +# data: +# call_jeff_location: 1 - jeff_headed_home_annc: - sequence: - - service: script.ah_report - data: - call_jeff_headed_home: 1 +# jeff_headed_home_annc: +# sequence: +# - service: script.ah_report +# data: +# call_jeff_headed_home: 1 -############################################################################### -# Kat Traffic Reports -############################################################################### - kat_eta_report: - sequence: - - service: script.ah_report - data: - call_kat_location: 1 +# ############################################################################### +# # Kat Traffic Reports +# ############################################################################### +# kat_eta_report: +# sequence: +# - service: script.ah_report +# data: +# call_kat_location: 1 - kat_headed_home_annc: - sequence: - - service: script.ah_report - data: - call_kat_headed_home: 1 \ No newline at end of file +# kat_headed_home_annc: +# sequence: +# - service: script.ah_report +# data: +# call_kat_headed_home: 1 \ No newline at end of file diff --git a/config/packages/presence.yaml b/config/packages/presence.yaml index 46ff58e..6843221 100755 --- a/config/packages/presence.yaml +++ b/config/packages/presence.yaml @@ -161,6 +161,25 @@ sensor: or is_state('sensor.family_status', 'Home') }} automation: + - id: skylar_is_awake + alias: Skylar is Awake + initial_state: true + trigger: + - platform: state + entity_id: binary_sensor.skylar_room_occupancy + to: 'on' + condition: + - condition: time + after: '05:00:00' + before: '08:30:00' + action: + - service: input_datetime.set_datetime + entity_id: input_datetime.skylar_awake_at + data: + time: "{{ now().strftime('%H:%M') }}" + - service: input_boolean.turn_on + entity_id: input_boolean.skylar_awake + - id: kat_arrives_zoo alias: Kat Arrives at Zoo initial_state: true @@ -173,10 +192,10 @@ automation: - service: input_boolean.turn_off entity_id: input_boolean.kat_travel_monitor - wait_template: "{{ not is_state('media_player.ha_speaker', 'playing') }}" - - service: script.ah_report - data: - speech_message: 'Kat has arrived at work.' - call_interuption: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: 'Kat has arrived at work.' - id: kat_leaves_zoo alias: Kat Leaves Zoo Notification @@ -190,10 +209,10 @@ automation: - service: input_boolean.turn_on entity_id: input_boolean.kat_travel_monitor - wait_template: "{{ not is_state('media_player.ha_speaker', 'playing') }}" - - service: script.ah_report - data: - call_interuption: 1 - call_kat_headed_home: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: - id: '1550109528753' alias: Jeff Is Heading Home @@ -205,10 +224,10 @@ automation: action: - service: script.jeff_destination_home - wait_template: "{{ not is_state('media_player.ha_speaker', 'playing') }}" - - service: script.ah_report - data: - call_interurption: 1 - call_jeff_headed_home: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: - id: jeff_heading_to_work alias: Jeff Is Heading To Work @@ -399,12 +418,9 @@ automation: - service: input_boolean.turn_off entity_id: input_boolean.jeff_traffic_alert_home - - - id: welcome_home alias: Welcome Home - mode: queued - max: 4 + mode: restart trigger: - platform: state entity_id: @@ -412,38 +428,57 @@ automation: - person.katherine - person.uncle_matt - person.papa + - person.skylar from: 'not_home' to: 'home' - condition: - - condition: state - entity_id: sensor.family_status - state: Home action: - - service: script.family_is_home - # - wait_template: >- - # {{ states.binary_sensor.laundry_room_door.state == 'on' }} - - delay: 00:02:00 - - service: script.ah_report + - service: group.set + data: + object_id: "arriving" + add_entities: >- + {{ trigger.to_state.entity_id }} + - 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' + - service: script.jarvis_voice data_template: - call_interuption: 1 - welcome_home: > - {% set person = trigger.to_state.attributes.friendly_name %} - {%- macro greeting_sentence(person) -%} + who: main + message: > + {% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %} + {% set peoplecount = expand('group.arriving') | count %} + {% if peoplecount == 1 %} + {% set is_are = ' is ' %} + {% else %} + {% set is_are = ' are ' %} + {% endif %} + {%- macro greeting_sentence(person, is_are) -%} {{ [ person + " has arrived.", - person + " is in the neighborhood.", - person + " is arriving.", + person ~ is_are + " in the neighborhood.", + person ~ is_are + " arriving.", "My sensors are picking up the presence of additional humans. " ~ person +" has been identified as home.", "Welcome back home " ~ person, - "Guess who is home?" ~ person +" is!", + "Guess who is home?" ~ person ~ is_are, "I am sensing a disturbance in the force. " ~ person +" must be home!", - person + " is now in the house.", + person ~ is_are + "now in the house.", person ~ "! You are home!", - "I know a secret! " ~ person +" is home!", + person ~ is_are + " now here. Hash tag Welcome Home.", + person ~ is_are + " now here. Hash tag Home.", + person ~ is_are + " now here. Hash tag Smart Home.", + "I know a secret! " ~ person ~ is_are +" home!", + "Just a quick announcement. " ~ person +" has arrived!", + "Hey" ~ person + "! High Five! Glad you are finally home.", + "Just a quick announcement. " ~ person +" has arrived!", person + " has finally made it home." ] | random }} {%- endmacro -%} {{greeting_sentence(person)}} + - service: group.set + data: + object_id: "arriving" + entities: [] - id: guests_have_arrived @@ -483,33 +518,6 @@ automation: - service: input_boolean.turn_off entity_id: input_boolean.jeff_traffic_alert_home - # - id: '1550107919204' - # alias: Family Is Home - # trigger: - # - platform: webhook - # webhook_id: home_webhook - # - entity_id: group.family - # from: not_home - # platform: state - # to: home - # condition: [] - # action: - # - service: script.family_is_home - - # - id: '1550108034209' - # alias: Family Is Away - # trigger: - # - platform: webhook - # webhook_id: away_webhook - # - entity_id: group.family - # from: home - # platform: state - # to: not_home - # condition: [] - # action: - # - service: script.family_is_away - - script: family_is_home: sequence: @@ -594,3 +602,12 @@ script: topic: kat/driving/destination payload: na retain: true + reset_skylar_sensors: + sequence: + - delay: 02:00:00 + - service: input_datetime.set_datetime + entity_id: input_datetime.skylar_awake_at + data: + time: "00:00:00" + - service: input_boolean.turn_off + entity_id: input_boolean.skylar_awake diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 343d0cb..9a7aecc 100755 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -191,21 +191,32 @@ automation: entity_id: input_boolean.audible_notifications state: 'on' action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: > + who: '{{ states.sensor.room_audio.state }}' + message: > The {{ trigger.to_state.attributes.friendly_name }} {{ [ " is standing open.", " is open.", - " does not close on its own." + " does not close on its own.", + " was left standing open " ] | random }} - call_snark_door_open: 1 + {{ [ + 'Can we get any more moths in here?', + 'Can a human be so kind and close it?', + 'The air quality in this house has actually improved.', + 'Closing the door would improve the internal climate of the house.', + 'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.', + 'They always say when one door closes another one opens...that must of been waht happened', + 'And the automatic door closer appears to be broken. So...' + ] | random }} + initial_state: true - - id: motion_detected - alias: motion_detected + - id: motion_detected_sentry_mode + alias: motion_detected_sentry_mode trigger: - platform: state entity_id: @@ -225,9 +236,10 @@ automation: entity_id: input_boolean.sentry_mode state: 'on' action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: > + who: '{{ states.sensor.room_audio.state }}' + message: > {{ [ "I have detected motion at the ", "Someone may be at the ", @@ -236,7 +248,14 @@ automation: "We appear to have a visitor at the " ] | random }} {{ trigger.to_state.attributes.friendly_name }}. - call_snark_door_motion: 1 + {{ [ + 'Do you want me to send them away?', + 'I have armed the lasers. Just say the word.', + 'I was not informed there would be guests.', + 'They do not appear to have any gifts, so I suggest no opening the door.', + 'My sensors have detected a meat popsicle.', + 'I do not think they can hear me.' + ] | random }} - delay: minutes: 2 initial_state: true @@ -337,9 +356,10 @@ automation: from: 'off' to: 'on' action: - - service: script.ah_report - data_template: - speech_message: > + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: > {{ [ "Barn door protocol has been activated.", "Anchorage House has been secured! ", @@ -363,9 +383,10 @@ automation: to: 'off' action: - - service: script.ah_report - data_template: - speech_message: > + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: > {{ [ "Barn door protocol has been deactivated.", "I am no longer monitoring the access points. ", @@ -387,9 +408,10 @@ automation: from: 'off' to: 'on' action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: > + who: '{{ states.sensor.room_audio.state }}' + message: > {{ [ "Guest Mode has been enabled.", "I have switched to the system to guest mode.", @@ -749,9 +771,27 @@ script: activate_barn_door_protocol: sequence: - - service: script.ah_report - data: - call_confirmation: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: >- + {{ [ + 'Okay.', + 'If you insist.', + 'I am afraid I can not do that I am kidding,', + 'Leave it to me.', + 'As you wish.', + 'I am on it.', + 'No Problem.', + 'I think I can handle that.', + 'Working on it now.', + ' Oh, you were talking to me. Let me take care of that.' + 'Why not. It is not like I ever sleep.', + 'I am not even supposed to be here today. But whatever.', + 'You did not say the magic word. Oh forget it. I will take care of it.', + 'Funny, I was just about to do that.', + 'There are still terabytes of calculations required before I can. Oh, whatever.' + ] | random }} - delay: seconds: 2 - service: script.lockdown @@ -764,9 +804,27 @@ script: - condition: state entity_id: sensor.family_status state: "Home" - - service: script.ah_report - data: - call_confirmation: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: >- + {{ [ + 'Okay.', + 'If you insist.', + 'I am afraid I can not do that I am kidding,', + 'Leave it to me.', + 'As you wish.', + 'I am on it.', + 'No Problem.', + 'I think I can handle that.', + 'Working on it now.', + ' Oh, you were talking to me. Let me take care of that.' + 'Why not. It is not like I ever sleep.', + 'I am not even supposed to be here today. But whatever.', + 'You did not say the magic word. Oh forget it. I will take care of it.', + 'Funny, I was just about to do that.', + 'There are still terabytes of calculations required before I can. Oh, whatever.' + ] | random }} - delay: seconds: 2 - service: input_boolean.turn_off @@ -777,10 +835,10 @@ script: - condition: state entity_id: group.external_doors state: "on" - - service: script.ah_report - data: - call_issue: 1 - sspeech_message: > + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: > {{ [ "I was unable to activate barn door protocol due to an open door.", "You may want to check the external doors. I was unable to secure them all.", @@ -806,9 +864,27 @@ script: activate_guest_mode: sequence: - - service: script.ah_report - data: - call_confirmation: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: >- + {{ [ + 'Okay.', + 'If you insist.', + 'I am afraid I can not do that I am kidding,', + 'Leave it to me.', + 'As you wish.', + 'I am on it.', + 'No Problem.', + 'I think I can handle that.', + 'Working on it now.', + ' Oh, you were talking to me. Let me take care of that.' + 'Why not. It is not like I ever sleep.', + 'I am not even supposed to be here today. But whatever.', + 'You did not say the magic word. Oh forget it. I will take care of it.', + 'Funny, I was just about to do that.', + 'There are still terabytes of calculations required before I can. Oh, whatever.' + ] | random }} - delay: seconds: 2 - service: input_boolean.turn_on diff --git a/config/packages/space.yaml b/config/packages/space.yaml index 26e1268..4326197 100755 --- a/config/packages/space.yaml +++ b/config/packages/space.yaml @@ -116,11 +116,27 @@ automation: initial_state: true alias: 'Full Moon -Tweet' trigger: - - platform: state + - platform: sun + event: sunset + offset: -00:15:00 + condition: + - condition: state entity_id: sensor.moon - to: 'full_moon' + state: 'full_moon' action: - - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: > +

+ {{ [ + 'There is a Full Moon out tonight. and this time it is the actual moon. And not the neighbor. ', + 'Hey look, There is the full moon. ', + 'The moon is huge! And full. ', + 'If you went outside right now you might see the full moon. Of course if you wait long enough there will be one inside the house too. ', + 'If you want to see the full moon, tonight is the night.'] + | random }} +

- service: script.twitter_notify_image data_template: tweet: >- diff --git a/config/packages/twitter.yaml b/config/packages/twitter.yaml index 0f6fced..932fb4c 100755 --- a/config/packages/twitter.yaml +++ b/config/packages/twitter.yaml @@ -78,7 +78,41 @@ automation: at: '08:00:00' action: - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' - - service: script.twitter_promos + - service: script.twitter_selfpromos + data: + who: 'thejeffreystone' + + - id: tweet_recent_content_js + alias: Tweet Recent Content js + initial_state: true + trigger: + - platform: time + at: '13:00:00' + action: + - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + - service: script.twitter_recent_content + data: + who: 'thejeffreystone' + + - id: tweet_recent_content + alias: Tweet Recent Contents + initial_state: true + trigger: + - platform: time + at: '08:00:00' + action: + - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + - service: script.twitter_recent_content + + - id: tweet_follow_me + alias: Tweet Follow Me + initial_state: true + trigger: + - platform: time + at: '08:00:00' + action: + - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + - service: script.twitter_follow_me - id: tweet_some_promos2 alias: Tweet Some Promos2 @@ -90,6 +124,16 @@ automation: - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' - service: script.twitter_selfpromos + # - id: tweet_some_promos3 + # alias: Tweet Some Promos3 + # initial_state: true + # trigger: + # - platform: time + # at: '13:00:00' + # action: + # - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + # - service: script.twitter_selfpromos_sl + # The whole purpose of this automation is to tweet out some links to great Home Assistant content. This is not sponsored in any way. # I just wanted a way to give back to those I have borrowed from. Tweets ever Friday. - id: tweet_some_great_content @@ -150,6 +194,28 @@ automation: You can find my #homeassistant content at -> Blog: https://slacker-labs.com | Videos: https://www.youtube.com/channel/UCipZJ6748kd8TbelSxcvcVg | Config: https://github.com/thejeffreystone/home-assistant-configuration image: "/config/www/tweet_images/sl_logo.png" + - id: slackerlabs_info + alias: SlackerLabs Info + initial_state: true + trigger: + - platform: time + at: '10:00:00' + condition: + - condition: template + value_template: > + {% set day=states("sensor.date").split('-')[2] | int %} + {%- if day == 1 -%} + true + {%- endif -%} + action: + - delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00' + - service: script.twitter_notify_image + data_template: + who: 'slackerlabs' + tweet: >- + You can find my #homeassistant content at -> Blog: https://slacker-labs.com | Videos: https://www.youtube.com/channel/UCipZJ6748kd8TbelSxcvcVg | Config: https://github.com/thejeffreystone/home-assistant-configuration + image: "/config/www/tweet_images/sl_logo.png" + # - id: net_speed_report # initial_state: true # alias: Network Speed Report diff --git a/config/packages/usps.yaml b/config/packages/usps.yaml index 2214827..d601a10 100755 --- a/config/packages/usps.yaml +++ b/config/packages/usps.yaml @@ -126,9 +126,10 @@ automation: - condition: template value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}' action: - - service: script.ah_report - data_template: - usps: >- + - service: script.jarvis_voice + data: + who: '{{ states.sensor.room_audio.state }}' + message: >- {%- if states.sensor.usps_mail.state | int == 1 -%} {{ [ "USPS is delivering", @@ -182,9 +183,10 @@ automation: - condition: template value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}' action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - usps: > + who: '{{ states.sensor.room_audio.state }}' + message: > {%- if states.sensor.usps_packages.state | int == 1 -%} USPS is delivering {{ states.sensor.usps_packages.state }} package today. {%- else -%} @@ -214,9 +216,10 @@ automation: who: "jeff" title: "Delivering Today" message: "{{ states('sensor.mail_deliveries_message')}}" - - service: script.ah_report + - service: script.jarvis_voice data_template: - usps: >- + who: '{{ states.sensor.room_audio.state }}' + message: >- {%- if states.sensor.mail_usps_mail.state | int == 1 -%} {{ [ "USPS is delivering", @@ -257,8 +260,9 @@ automation: who: "jeff" title: "Package Delivered" message: "Fedex/UPS just made a delivery" - - service: script.ah_report + - service: script.jarvis_voice data_template: - usps: >- + who: '{{ states.sensor.room_audio.state }}' + message: >- A package was just left on the porch. call_interuption: 1 \ No newline at end of file diff --git a/config/packages/weather.yaml b/config/packages/weather.yaml index a91b612..e73cd52 100755 --- a/config/packages/weather.yaml +++ b/config/packages/weather.yaml @@ -428,9 +428,10 @@ automation: - condition: template value_template: "{{ (('Severe' in states.sensor.nws_alerts.attributes.title) or ('Thunderstorm' in states.sensor.nws_alerts.attributes.title)) and 'Warning' in states.sensor.nws_alerts.attributes.title }}" action: - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: > + who: '{{ states.sensor.room_audio.state }}' + message: > {% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %} The National Weather Service Has issued 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 %} @@ -446,16 +447,17 @@ automation: {% endif %} - service: script.twitter_notify_image data_template: - tweet: '{{ [ "Anchorage House is battening down the hatches. Servere Weather is imminent. ", - "The weather outside is getting intense, so I just made a weather announcement.", - "Anchorage House monitors the NWS for severe weather using #HomeAssistant just for these occasions. Thanks for the heads up @NWSAtlanta " ] | random }}' + tweet: '{{ [ "Anchorage House is battening down the hatches. Servere Weather is imminent. #homeassistant #weather ", + "The weather outside is getting intense, so I just made a weather announcement. #homeassistant #weather ", + "Anchorage House monitors the NWS for severe weather using #homeAssistant just for these occasions. Thanks for the heads up @NWSAtlanta #homeassistant #weather " ] | random }}' image: >- {{ [ "/config/www/tweet_images/lightning.jpg", "/config/www/tweet_images/lightning-bolt.jpg"] | random }} - delay: '00:00:15' - - service: script.ah_report + - service: script.jarvis_voice data_template: - speech_message: > + who: main + message: > {% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %} The National Weather Service Has issued 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 %} @@ -487,9 +489,9 @@ automation: message: "Attention!,,,Attention!,,,The National Weather Service Has issued a Tornado Warning for our area." - service: script.twitter_notify_image data_template: - tweet: '{{ [ "NWS is sounding the Tornado alarm, so I am too. Anchorage House is taking cover. ", - "Anchorage House is heading to the closet because the NWS just issued a tornado warning for our area.", - "I just activated the internal Tornado Alarm. Thanks for the heads up @NWSAtlanta " ] | random }}' + tweet: '{{ [ "NWS is sounding the Tornado alarm, so I am too. Anchorage House is taking cover. #homeassistant #weather ", + "Anchorage House is heading to the closet because the NWS just issued a tornado warning for our area. #homeassistant #weather ", + "I just activated the internal Tornado Alarm. Thanks for the heads up @NWSAtlanta #homeassistant #weather " ] | random }}' image: >- "/config/www/tweet_images/tornado.jpg" - delay: '00:00:15' @@ -503,6 +505,11 @@ automation: data_template: title: "Tornado Warning!" message: "The National Weather Service Has issued a Tornado Warning for our area." + - service: notify.alexa_media_skylar_s_bedroom + data: + message: A Tornado Warning has been issued for our area. Head to the closet. + data: + type: tts - alias: Lightning Detected trigger: @@ -675,18 +682,42 @@ script: image: >- {{ [ "/config/www/tweet_images/lightning.jpg", "/config/www/tweet_images/lightning-bolt.jpg"] | random }} - - service: script.ah_report - data: - call_lightning_alert: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: >- +

+ {{ [ + 'I have detected lightning withing 20 miles of Anchorage House.', + 'Did you see that flash? I did. Lightning is near.', + 'If you didnt hear the thunder you will soon. ' + ]|random }} + If anyone is outside they shoudld seek shelter inside. + {% if is_state('binary_sensor.garage_door', 'on') %} + {{ [ 'The garage door needs to be closed. ', + 'Can someone close the garage?. ', + 'If you do not want the contents of the garage to get wet, you might want to close it.' + ] | random }} + {% endif %} +

lightning_clear_audible: sequence: - condition: state entity_id: binary_sensor.day state: 'on' - - service: script.ah_report - data: - call_lightning_clear: 1 + - service: script.jarvis_voice + data_template: + who: '{{ states.sensor.room_audio.state }}' + message: >- +

+ {{ [ + 'Lightning threat appears to be over.', + 'No more lightning appears to be occuring.', + 'Lightning is gone.' + ]|random }} + It is safe to resume normal activities. +

refresh_weather_alert_sensors: sequence: diff --git a/config/templates/speech/event_briefing.yaml b/config/templates/speech/event_briefing.yaml new file mode 100755 index 0000000..7d56027 --- /dev/null +++ b/config/templates/speech/event_briefing.yaml @@ -0,0 +1,79 @@ +> + {# Event Report #} + {%- macro getReport() -%} +

+ {% if states.sensor.birthday_skylar.state | int == 1 %} + Tomorrow is Skylar's Birthday. + {% endif %} + {% if states.sensor.birthday_jeff.state | int == 1 %} + Tomorrow is Jeff's Birthday. + {% endif %} + {% if states.sensor.birthday_kat.state | int == 1 %} + Tomorrow is Katherine's Birthday. + {% 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 %} +

+ {%- 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/morning_briefing.yaml b/config/templates/speech/morning_briefing.yaml new file mode 100755 index 0000000..7ccac81 --- /dev/null +++ b/config/templates/speech/morning_briefing.yaml @@ -0,0 +1,164 @@ +> + {# Morning 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 %} +

+

+ {{ [ + 'Today is ', + 'If you have not been keeping track today is ', + 'Do you know what day of the week it is? Today is', + 'I hate to be the bearer of bad news, but today is ' + ]|random }} + {{states.sensor.today_is.state }}. +

+

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

+

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

+

+ {{ [ + 'The rest of the day should be,', + 'Todays forecast should be ,' + ]|random }} + {{ states.sensor.nws_current_forecast.state }} +

+

+ {% if is_state('input_boolean.heartworm', 'on') %} + Today is the day Winston gets his heartworm medicine. + {% 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.halloween_countdown','0') %} + Happy Halloween! + {% endif %} + {% if is_state('sensor.christmas_countdown','0') %} + Merry Christmas Everyone! + {% 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. + {% 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 ") }}. + {{ [ + '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 -%} +

+

+ + {%- 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. + + {%- if states.sensor.home_to_summit.state|round > 50 %} + Traffic to the Cox Automotive appears heavy than normnal. + {% else %} + Traffic to the Cox is normal. + {% endif %} + Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Cox Automotive. +

+ {%- 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/morning_wakeup_report.yaml b/config/templates/speech/morning_wakeup_report.yaml new file mode 100755 index 0000000..9435b31 --- /dev/null +++ b/config/templates/speech/morning_wakeup_report.yaml @@ -0,0 +1,147 @@ +> + {# Morning Wakeup 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 %} + + {{ [ + 'Today is ', + 'If you have not been keeping track today is ', + 'Do you know what day of the week it is? Today is', + 'I hate to be the bearer of bad news, but today is ', + 'Oh look, once again it is ' + ]|random }} + {{states.sensor.today_is.state }}. +

+

+ It is currently {{states.weather.home_2.state}} and {{states.sensor.back_porch.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 }} + today. 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') %} + {{ [ 'Skylar has school today.', + 'Skylar needs to head to school in about forty minutes. ', + 'Skylar should go to school today. ' + ] | random }} + {% if states.calendar.skylar_school.attributes.description == 'early-release' %} + But It is early release! + {% endif %} + {% endif %} +

+

+ {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} + Today for Lunch at school + {% if states.calendar.skylar_school.attributes.description == 'lunch-nuggets' %} + they are having Chicken Nuggets. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-gwinnettburger' %} + they are having Gwinnetts Best Burger. + {{ [ 'Which seems like an overstatement if you ask me.', + 'But is it really?', + 'If you like this, I know where to find Texas Best Barbeque.' + ] | random }} + {% elif states.calendar.skylar_school.attributes.description == 'lunch-pizza' %} + it is Pizza. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-minipups' %} + it is Mini Corn Pups. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-hotdogs' %} + it is Mini Corn Pups. + {% else %} + it might be a good day to take something. + {% endif %} + {% endif %} +

+

+ {% if is_state('input_boolean.skylar_is_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 + {% 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. + {% 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. +

+ {%- 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/nightly_briefing.yaml b/config/templates/speech/nightly_briefing.yaml new file mode 100755 index 0000000..fb3f3d3 --- /dev/null +++ b/config/templates/speech/nightly_briefing.yaml @@ -0,0 +1,170 @@ +> + {# 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 %} +

+ {%- 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/security_report.yaml b/config/templates/speech/security_report.yaml new file mode 100755 index 0000000..4dd34ba --- /dev/null +++ b/config/templates/speech/security_report.yaml @@ -0,0 +1,55 @@ +> + {# Security Report #} + {%- macro getReport() -%} +

+ {%- 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.' + ] | random}} + {% else %} + {{ [ + 'Sentry Mode is disabled.', + 'Sentry mode is currently inactive.', + 'My security system is currently disarmed.' + ] | random}} + {% endif %} + {%- if states.group.external_doors.state == 'off' %} + All external doors are 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. + {% endif %} + {% endif %} +

+ {%- endmacro -%} + + + {# a macro that removes all newline characters, empty spaces, and returns formatted text #} + {%- macro cleanup(data) -%} + {%- for item in data.split("\n") if item | trim != "" -%} + {{ item | trim }} {% endfor -%} + {%- endmacro -%} + + {# a macro to call all macros :) #} + {%- macro mother_of_all_macros() -%} + {{ getReport() }} + {%- endmacro -%} + + {# Call the macro #} + {{- cleanup(mother_of_all_macros()) -}} \ No newline at end of file diff --git a/config/templates/speech/skylar_morning_briefing.yaml b/config/templates/speech/skylar_morning_briefing.yaml new file mode 100755 index 0000000..6c9a261 --- /dev/null +++ b/config/templates/speech/skylar_morning_briefing.yaml @@ -0,0 +1,137 @@ +> + {# Skylar Morning Report #} + {%- macro getReport() -%} +

+ Skylar, + {% if is_state('sensor.birthday_skylar', '0') %} + Even birthday boys have to get dressed. So get to it. + {% else %} + {{ [ 'It is time to get dressed. ', + '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.' + ] | 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. + {% 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 }} + today. 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') %} + Because you have school today! + {% if states.calendar.skylar_school.attributes.description == 'early-release' %} + And guess what? It is early release! + {% endif %} + {% if states.calendar.skylar_school.attributes.description == 'start_thanksgiving_break' %} + And One More Thing. Tomorrow is the first day of Thanksgiving Break. + {% endif %} + {% if states.calendar.skylar_school.attributes.description == 'start_winter_break' %} + And One More Thing. Tomorrow is the first day of Winter Break. + {% endif %} + {% if states.calendar.skylar_school.attributes.description == 'start_spring_break' %} + And One More Thing. Tomorrow is the first day of Spring Break. + {% endif %} + {% if states.calendar.skylar_school.attributes.description == 'start_fall_break' %} + And One More Thing. Tomorrow is the first day of Fall Break. + {% 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 }}. + {{ [ 'Guess today would be a good day to clean your room.', + 'You could always do some chores.', + 'Lets try to keep the TV off today, ok?', + 'Want to play a nice game of chess? Sorry. I meant, want to play Thermal Nuclear War.', + 'I hope you enjoy your day off. You deserve it.', + 'Today would be a good day to spend some time with mom and dad.' + ] | random }} + + {% endif %} + + {% endif %} +

+

+ {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} + Today for Lunch at school + {% if states.calendar.skylar_school.attributes.description == 'lunch-nuggets' %} + they are having Chicken Nuggets. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-gwinnettburger' %} + they are having Gwinnetts Best Burger. + {{ [ 'Which seems like an overstatement if you ask me.', + 'But is it really?', + 'If you like this, I know where to find Texas Best Barbeque.' + ] | random }} + {% elif states.calendar.skylar_school.attributes.description == 'lunch-pizza' %} + it is Pizza. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-minipups' %} + it is Mini Corn Pups. + {% elif states.calendar.skylar_school.attributes.description == 'lunch-hotdogs' %} + it is Mini Corn Pups. + {% else %} + it might be a good day to take something. + {% endif %} + {% endif %} +

+

+ {% 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 }}. + {{ [ 'Guess today would be a good day to clean your room.', + 'You could always do some chores.', + 'Lets try to keep the TV off today. okay?', + 'Want to play a nice game of chess? Sorry. I meant. want to play Thermal Nuclear War.', + 'I hope you enjoy your day off. You deserve it.', + 'Today would be a good day to spend some time with mom and dad.' + ] | random }} + {% 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_nightly_briefing.yaml b/config/templates/speech/skylar_nightly_briefing.yaml new file mode 100755 index 0000000..4943e97 --- /dev/null +++ b/config/templates/speech/skylar_nightly_briefing.yaml @@ -0,0 +1,80 @@ +> + {# Skylar Nightly Report #} + {%- macro getReport() -%} +

+ Skyler, + {{ [ 'It is time to get in the bath. ', + 'It is almost bedtime. That means you should be heading for the bathtub. Time to get clean.', + '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 strange smell. I am running diagnostics. But in the mean time, you should start a bath.', + 'I hate to say it but, it is time to get cleaned up.', + 'Did you ever hear the one about the kid who never took a bath? Yeah, me either. So we should keep it that way. Bath time now, sir.', + 'The count down clock has started. Time to get cleaned up, and get your pajamas on.' + ] | random }} + {% if is_state('sensor.school_tomorrow', 'on') %} + {{ [ 'Because you have school tomorrow. ', + 'Because you have to get up early tomorrow for school.', + 'Because you want to be ready for school tomorrow.' + ] | random }} + {% else %} + {% set month=states("sensor.date").split('-')[1] | int %} + {%- if is_state('input_boolean.school_in_session', 'off') -%} + {{ [ 'Looks like tomorrow is another day of summer vacation. ', + 'You are still on summer break tomorrow. ', + 'Summer vacation does not last forever, but it is not over yet. ' + ] | random }} + {% else %} + Oh, and it appears you do not have school tomorrow + {% endif %} + {{ [ 'so you can sleep in late tomorrow. ', + ' so there is not a reason to get up early tomorrow. ', + 'so we can sleep in tomorrow. ' + ] | random }} + {% endif %} + {% if states.sensor.school_start_days2go.state | int < 10 and states.sensor.school_start_days2go.state | int > 1 -%} + {{ [ 'I hate to say it, but ', + 'Unforunately,', + 'All good things must come to an end.' + ] | random }} + There are only {{ states.sensor.school_start_days2go.state }} days + {{ [ 'left of summer vacation. ', + ' left of summer break.', + 'Until School starts again.' + ] | random }} + {% elif states.sensor.school_start_days2go.state | int == 1 -%} + Tomorrow is the first day of school. Are you ready? + {%- endif %} + {% if states.sensor.school_end_days2go.state | int < 10 and states.sensor.school_end_days2go.state | int > 0 -%} + {{ [ 'School is almost over for the year.', + 'You have made it to the end of the school year.', + 'You are almost done with school.' + ] | random }} + There are only {{ states.sensor.school_end_days2go.state }} days + {{ [ 'left in the school year ', + ' left of school.', + 'Until the last day of school.' + ] | random }} + {% elif states.sensor.school_end_days2go.state | int == 0 -%} + Tomorrow is the first day of summer. Are you ready? + {%- endif %} + {{ [ 'I have configured Skylers room for sleep prep. ', + 'The lighting in Skylers room has been adjusted in preparation for bed.', + 'I have executed the Pre bed routine for Skylers room.' + ] | 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