############################################################################### # @author : Jeffrey Stone # @date : 02/19/2019 # @package : Announcements # @description : Daily Announcements. ############################################################################### ############################### # input_datetime - So the time report automation fires can be set in the UI ############################### input_datetime: morning_report: name: Morning Report has_date: false has_time: true nightly_report: 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 has_time: true skylar_nightly_report: name: Skylar Bedtime Announcement has_date: false has_time: true audible_notification_on: name: Audible Notifications On has_date: false has_time: true audible_notification_off: name: Audible Notifications Off has_date: false has_time: true ################################ # Announcment Automation - fires at the time of the above input_datetimes ################################ automation: - id: turn_off_audible_notifications alias: Turn Off Audible Notifications initial_state: true trigger: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_off', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - service: input_boolean.turn_off entity_id: input_boolean.audible_notifications - id: turn_on_audible_notifications alias: Turn On Audible Notifications at 7am initial_state: true trigger: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_on', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - service: script.turn_on_ha_speaker - id: set_audible_time_off_guest alias: set audible time off guest trigger: - platform: state entity_id: input_boolean.guest_mode to: 'on' action: - service: input_datetime.set_datetime entity_id: input_datetime.audible_notification_off data_template: time: > {% if states.binary_sensor.school_tomorrow.state == 'on' %} 19:30 {% else %} 20:30 {% endif %} - id: prebed_routine initial_state: true alias: Skylar Nightly Announcements trigger: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - service: script.skylar_nightly_briefing - id: nightly_report initial_state: true alias: Nightly Report trigger: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.nightly_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" action: - service: script.nightly_briefing_report - id: 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: 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.morning_briefing - service: script.twitter_notify data: message: >- {{ [ "I just provided a morning briefing including weather, and traffic conditions, and other things that ensure the residents of Anchorage House know what to expect today.", "Time for the daily update. It was like that scene in Ironman where JARVIS gives the daily briefing but no one was listening. ", "I have prepared a safety briefing to present to my residents but they would just ignore it.", "Do you like to be prepared for the day? So do my residents. So I provided them with an update on whats happening today.", "Sometimes I just like to be snarky, but this morning I decided to just tell everyone what is going on in the world.", "#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: input_boolean.turn_on entity_id: input_boolean.good_morning_report - 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: platform: template value_template: "{{ states('sensor.time') == (state_attr('input_datetime.skylar_morning_report', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}" condition: condition: template value_template: '{{ states.calendar.skylar_school.attributes.offset_reached == True }}' action: - service: scene.turn_on entity_id: scene.skylar_room_morning - service: > {%- if is_state('binary_sensor.theater_occupancy', 'on') and is_state('media_player.theater_tv', 'on') %} script.skylar_morning_briefing_jarvis {% else %} script.skylar_morning_briefing_alexa {%- endif %} - id: set_skylar_morning_report_time alias: set skylar morning report time trigger: - platform: time at: '05:50:00' action: - service: input_datetime.set_datetime entity_id: input_datetime.skylar_morning_report data_template: time: > {% if states.calendar.skylar_school.attributes.offset_reached == True %} 06:15 {% else %} 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 %} 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_jarvis: sequence: - service: script.jarvis_voice data: who: main message: !include ../templates/speech/skylar_morning_briefing.yaml skylar_morning_briefing_alexa: sequence: - service: notify.alexa_media_skylar_s_bedroom data: message: !include ../templates/speech/skylar_morning_briefing.yaml data: type: tts 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