From b74b421a9ddeff4151b55aa1200c592ee7d5ca72 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Fri, 17 Jun 2022 15:01:36 -0400 Subject: [PATCH] Finally making housewide TTS alerts a thing --- automations.yaml | 179 +------------------------------------------ packages/notify.yaml | 114 +++++++++++++++++---------- 2 files changed, 77 insertions(+), 216 deletions(-) diff --git a/automations.yaml b/automations.yaml index 51025c4..92d49f6 100644 --- a/automations.yaml +++ b/automations.yaml @@ -20,29 +20,23 @@ title: Tornado Warning - TAKE COVER! message: The National Weather Service has issued a Tornado Warning for our area. Take Cover NOW!!!! - - service: notify.alexa_media + - service: script.speech_engine data: - data: - method: all - type: announce + who: everywhere message: A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! - target: Living Room Echo Dot, Basement Echo Dot, Master Bedroom Echo Dot - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - - service: notify.alexa_media + - service: script.speech_engine data: - data: - method: all - type: announce + who: everywhere message: A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! - target: Living Room Echo Dot, Basement Echo Dot, Master Bedroom Echo Dot mode: single - id: '1640916845901' alias: Cast to Chromecast @@ -417,171 +411,6 @@ - automation.family_has_arrived - automation.family_has_left mode: queued -# - id: '1652215901673' -# alias: Master Bedroom Nighttime Protocol -# description: Management of the fan and air conditioner in the master bedroom -# trigger: -# - platform: time -# at: input_datetime.master_bedroom_cooling -# id: master-bedroom-cooling -# - platform: time -# at: input_datetime.master_bedroom_wakeup -# id: master-bedroom-wakeup -# - platform: time -# at: input_datetime.master_bedroom_fan -# id: master-bedroom-fan -# condition: -# - condition: state -# entity_id: input_boolean.vacation_mode -# state: 'off' -# - condition: numeric_state -# entity_id: sensor.tonights_low_temp -# above: '40' -# action: -# - choose: -# - conditions: -# - condition: trigger -# id: master-bedroom-cooling -# sequence: -# - if: -# - condition: numeric_state -# entity_id: sensor.current_forecast -# attribute: overnight_low -# above: '50' -# then: -# - service: climate.turn_on -# data: {} -# target: -# entity_id: climate.master_bedroom_aircon -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 10 -# milliseconds: 0 -# - service: climate.set_hvac_mode -# data: -# hvac_mode: cool -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 5 -# milliseconds: 0 -# - service: climate.set_temperature -# data: -# temperature: 72 -# target: -# entity_id: climate.master_bedroom_aircon -# - parallel: -# - service: script.text_notify_tony -# data: -# title: AC Schedule Activated -# message: '"Master bedroom AC temp has been set as scheduled based on -# tonight''s forecast low"' -# - service: script.text_notify_tina -# data: -# title: AC Schedule Activated -# message: '"Master bedroom AC temp has been set as scheduled based on -# tonight''s forecast low"' -# else: -# - service: climate.turn_on -# data: {} -# target: -# entity_id: climate.master_bedroom_aircon -# - service: climate.set_hvac_mode -# data: -# hvac_mode: fan_only -# target: -# entity_id: climate.master_bedroom_aircon -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 5 -# milliseconds: 0 -# - parallel: -# - service: script.text_notify_tony -# data: -# title: AC Schedule Skipped -# message: Too cold outside, AC running fan only -# - service: script.text_notify_tina -# data: -# title: AC Schedule Skipped -# message: Too cold outside, AC running fan only -# - conditions: -# - condition: trigger -# id: master-bedroom-fan -# sequence: -# - if: -# - condition: numeric_state -# entity_id: sensor.current_forecast -# attribute: overnight_low -# above: '40' -# then: -# - service: switch.turn_on -# data: {} -# target: -# entity_id: switch.master_bedroom_fan_socket_1 -# - parallel: -# - service: script.text_notify_tony -# data: -# title: Fan Schedule Activated -# message: '"Master bedroom fan has been activated, as scheduled based -# on tonight''s forecast low"' -# - service: script.text_notify_tina -# data: -# title: Fan Schedule Activated -# message: '"Master bedroom fan has been activated, as scheduled based -# on tonight''s forecast low"' -# - conditions: -# - condition: trigger -# id: master-bedroom-wakeup -# sequence: -# - service: switch.turn_off -# data: {} -# target: -# entity_id: -# - switch.master_bedroom_fan_socket_1 -# - switch.master_bedroom_echo_dot_do_not_disturb_switch -# - if: -# - condition: numeric_state -# entity_id: sensor.todays_high_temp -# above: '80' -# then: -# - service: climate.turn_on -# data: {} -# target: -# entity_id: climate.master_bedroom_aircon -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 10 -# milliseconds: 0 -# - service: climate.set_hvac_mode -# data: -# hvac_mode: cool -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 5 -# milliseconds: 0 -# - service: climate.set_temperature -# data: -# temperature: 75 -# target: -# entity_id: climate.master_bedroom_aircon -# else: -# - service: climate.set_hvac_mode -# data: -# hvac_mode: 'off' -# target: -# entity_id: climate.master_bedroom_aircon -# default: -# - service: script.text_notify_tony -# data: -# title: Master Bedroom Info -# message: '"Today''s wakeup time is set to {{ states(''input_datetime.master_bedroom_wakeup'') -# }} and tonight''s cooling is set to start at {{ states(''input_datetime.master_bedroom_cooling'') -# }}"' -# mode: queued - id: '1654547257475' alias: Battery Monitoring description: Monitor all battery-powered things for low battery states diff --git a/packages/notify.yaml b/packages/notify.yaml index df9593c..e54c892 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -133,7 +133,12 @@ notify: - name: "Tony Desktop HASS Agent" platform: hass_agent_notifier resource: http://192.168.1.2:5115/notify - + - name: alexa_everywhere + platform: group + services: + - service: alexa_media_living_room_echo_dot + - service: alexa_media_basement_echo_dot + - service: alexa_media_master_bedroom_echo_dot script: @@ -449,7 +454,7 @@ script: - condition: state entity_id: input_boolean.vacation_mode state: 'off' - - service: > + - service: >- {% if voice == 'nabu' %} script.nabu_voice {% elif who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room','Living Room Echo Dot'] %} @@ -464,6 +469,9 @@ script: {% elif who in ['basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot'] %} {% set who = 'basement_echo_dot' %} script.alexa_voice + {% elif who in ['Everywhere','everywhere'] %} + {% set who = 'everywhere' %} + script.alexa_voice {% else %} {% set who = 'living_room_echo_dot' %} script.alexa_voice @@ -472,6 +480,15 @@ script: who: '{{ who }}' message: > {{ message }} + - service: >- + {% if who in ['Everywhere','everywhere'] %} + {% set who = 'everywhere' %} + script.jarvis_voice + {% endif %} + data: + who: '{{ who }}' + message: > + {{ message }} @@ -538,43 +555,53 @@ script: # Called wheh notification needs to play on echos alexa_voice: sequence: - - service: media_player.turn_on - data_template: - entity_id: > - {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %} - notify.alexa_media_living_room_echo_dot - {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %} - notify.alexa_media_master_bedroom_echo_dot - {% elif who in ['basement','basement_echo_dot'] %} - notify.alexa_media_basement_echo_dot - {% else %} - notify.alexa_media_living_room_echo_dot - {% endif %} - - service: media_player.volume_set - data_template: - entity_id: > - {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %} - notify.alexa_media_living_room_echo_dot - {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %} - notify.alexa_media_master_bedroom_echo_dot - {% elif who in ['basement','basement_echo_dot'] %} - notify.alexa_media_basement_echo_dot - {% else %} - notify.alexa_media_living_room_echo_dot - {% endif %} - volume_level: > - {% if is_state('input_boolean.audible_notifications.state','on') %} - .7 - {% else %} - .3 - {% endif %} - - service: > + # - service: media_player.turn_on + # data_template: + # entity_id: >- + # {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %} + # media_player.living_room_echo_dot + # {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %} + # media_player.master_bedroom_echo_dot + # {% elif who in ['basement','basement_echo_dot'] %} + # media_player.basement_echo_dot + # {% elif who in ['Everywhere','everywhere'] %} + # - media_player.basement_echo_dot + # - media_player.living_room_echo_dot + # - media_player.master_bedroom_echo_dot + # {% else %} + # media_player.living_room_echo_dot + # {% endif %} + # - service: media_player.volume_set + # data_template: + # entity_id: >- + # {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %} + # media_player.living_room_echo_dot + # {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %} + # media_player.master_bedroom_echo_dot + # {% elif who in ['basement','basement_echo_dot'] %} + # media_player.basement_echo_dot + # {% elif who in ['Everywhere','everywhere'] %} + # - media_player.basement_echo_dot + # - media_player.living_room_echo_dot + # - media_player.master_bedroom_echo_dot + # {% else %} + # media_player.living_room_echo_dot + # {% endif %} + # volume_level: >- + # {% if is_state('input_boolean.audible_notifications.state','on') %} + # .7 + # {% else %} + # .3 + # {% endif %} + - service: >- {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %} notify.alexa_media_living_room_echo_dot {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %} notify.alexa_media_master_bedroom_echo_dot {% elif who in ['basement','basement_echo_dot'] %} notify.alexa_media_basement_echo_dot + {% elif who in ['Everywhere','everywhere'] %} + notify.alexa_everywhere {% else %} notify.alexa_media_living_room_echo_dot {% endif %} @@ -589,8 +616,10 @@ script: sequence: - service: media_player.turn_on data_template: - entity_id: > - {% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} + entity_id: >- + {% if who in ['Everywhere','everywhere'] %} + media_player.kallen_bedroom_speaker + {% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} media_player.kallen_bedroom_speaker {% else %} {% if states.input_boolean.audible_notifications.state == 'on' %} @@ -601,8 +630,10 @@ script: {% endif %} - service: media_player.volume_set data_template: - entity_id: > - {% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} + entity_id: >- + {% if who in ['Everywhere','everywhere'] %} + media_player.kallen_bedroom_speaker + {% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} media_player.kallen_bedroom_speaker {% else %} {% if states.input_boolean.audible_notifications.state == 'on' %} @@ -611,7 +642,7 @@ script: media_player.living_room_tv {% endif %} {% endif %} - volume_level: > + volume_level: >- {% if states.input_boolean.audible_notifications.state == 'on' %} .7 {% else %} @@ -619,8 +650,10 @@ script: {% endif %} - service: tts.amazon_polly_say data_template: - entity_id: > - {% if who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} + entity_id: >- + {% if who in ['Everywhere','everywhere'] %} + media_player.kallen_bedroom_speaker + {% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} media_player.kallen_bedroom_speaker {% else %} {% if states.input_boolean.audible_notifications.state == 'on' %} @@ -631,7 +664,6 @@ script: {% endif %} message: >- - {{ message }} cache: true