From f321395ce6289cd48c01851aa3e8c43eb3c70feb Mon Sep 17 00:00:00 2001 From: Jeffrey Stone Date: Wed, 16 Jun 2021 21:11:07 -0400 Subject: [PATCH] Twweaking audible notifications for video coming out on 6-26-21 --- config/automations.yaml | 134 +++++++++++++++++++++++++++++++++++- config/packages/audio.yaml | 26 +++++++ config/packages/notify.yaml | 73 ++++---------------- 3 files changed, 172 insertions(+), 61 deletions(-) diff --git a/config/automations.yaml b/config/automations.yaml index dd4dabb..10a73f9 100644 --- a/config/automations.yaml +++ b/config/automations.yaml @@ -261,12 +261,18 @@ trigger: - platform: numeric_state entity_id: sensor.master_bath_humidity - above: '62' + above: '68' for: 00:03:00 condition: - condition: state entity_id: switch.master_bath_fan state: 'off' + - condition: state + entity_id: binary_sensor.quiet_time + state: 'off' + - condition: state + entity_id: group.family + state: 'home' action: - service: switch.turn_on data: {} @@ -278,7 +284,7 @@ trigger: - platform: numeric_state entity_id: sensor.master_bath_humidity - below: '62' + below: '69' condition: - condition: state entity_id: switch.master_bath_fan @@ -299,3 +305,127 @@ - event: test_complete event_data: {} mode: single +- id: '1622313738769' + alias: Room Presence Detection + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.master_bedroom_motion_occupancy + - binary_sensor.kitchen_motion_occupancy + - binary_sensor.living_room_motion_occupancy + - binary_sensor.skylar_bedroom_motion_occupancy + - binary_sensor.croft_occupancy + - binary_sensor.back_door_motion + from: 'off' + to: 'on' + - platform: state + entity_id: + - media_player.kitchen_echo + - media_player.living_room_echo + - media_player.skylar_s_bedroom + attribute: last_called + to: 'true' + - platform: state + entity_id: media_player.theater_tv + from: 'off' + to: 'on' + condition: [] + action: + - choose: + - conditions: + - condition: state + entity_id: media_player.theater_tv + state: 'on' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: theater + - conditions: + - condition: template + value_template: '{{ "Kitchen" in trigger.to_state.attributes.friendly_name + or "Back Door" in trigger.to_state.attributes.friendly_name }}' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: kitchen + - conditions: + - condition: template + value_template: '{{ "Living" in trigger.to_state.attributes.friendly_name }}' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: main + - conditions: + - condition: template + value_template: '{{ "Master" in trigger.to_state.attributes.friendly_name }}' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: master_bedroom + - conditions: + - condition: template + value_template: '{{ "Croft" in trigger.to_state.attributes.friendly_name }}' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: croft + - conditions: + - condition: template + value_template: '{{ "Skylar" in trigger.to_state.attributes.friendly_name }}' + sequence: + - service: input_text.set_value + data: + entity_id: input_text.room_presence + value: skylar_bedroom + default: [] + mode: restart +- id: '1622731659354' + alias: Tornado Alarm + description: Sound the Tornado Alarm! + trigger: + - platform: state + entity_id: input_boolean.tornado_alarm + condition: [] + action: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.tornado_alarm + state: 'on' + sequence: + - delay: + seconds: 15 + - service: media_player.volume_set + data: + entity_id: media_player.ha_speaker + volume_level: 0.99 + - service: media_player.play_media + target: + entity_id: media_player.ha_speaker + data: + media_content_id: /media/sounds/tornado_alarm.mp3 + media_content_type: music + - delay: + seconds: 110 + - service: media_player.play_media + target: + entity_id: media_player.ha_speaker + data: + media_content_id: /media/sounds/tornado_alarm.mp3 + media_content_type: music + - conditions: + - condition: state + entity_id: input_boolean.tornado_alarm + state: 'off' + sequence: + - service: media_player.media_stop + target: + entity_id: media_player.ha_speaker + default: [] + mode: restart diff --git a/config/packages/audio.yaml b/config/packages/audio.yaml index bad4e5f..9620940 100755 --- a/config/packages/audio.yaml +++ b/config/packages/audio.yaml @@ -131,6 +131,32 @@ automation: attribute: last_called to: True action: + - service: input_text.set_value + data_template: + entity_id: input_text.room_presence + value: > + {% set room = trigger.to_state.attributes.friendly_name %} + {% if room == 'Kitchen Echo' %} + kitchen + {% elif room == 'Living Room Echo' %} + main + {% elif room == 'Skylar\'s Bedroom' %} + skylar_bedroom + {%- elif is_state('media_player.theater_tv', 'on') %} + theater + {% elif room == 'Kitchen Motion occupancy' or room == 'Back Door Motion'%} + kitchen + {% elif room == 'Master Bedroom Motion occupancy' %} + master_bedroom + {% elif room == 'Living Room Motion occupancy' or room == 'Living Room Echo' %} + main + {% elif room == 'Croft Occupancy' %} + croft + {% elif room == 'Skylar Bedroom Motion occupancy' or room == 'Skylar\'s Bedroom' %} + skylar_bedroom + {% else %} + main + {% endif %} - service: mqtt.publish data: topic: house/presence/current_room diff --git a/config/packages/notify.yaml b/config/packages/notify.yaml index c5be2c7..3acaa0c 100755 --- a/config/packages/notify.yaml +++ b/config/packages/notify.yaml @@ -149,51 +149,6 @@ notify: access_token_secret: !secret twitter3_access_secret - platform: alexa_media name: alexa_media - - -# automation: - -# - id: audio_isssue -# alias: Audio Issue -# initial_state: true -# trigger: -# - platform: state -# entity_id: media_player.ha_speaker -# to: 'unavailable' -# condition: -# - condition: state -# entity_id: binary_sensor.day -# state: 'on' -# action: -# - service: input_boolean.turn_off -# entity_id: input_boolean.audible_notifications -# - service: script.text_notify -# data_template: -# who: "jeff" -# title: "Audio Issue" -# message: "HA Audible Notifications turning off due to Chromecast Issue" - -# - id: audio_isssue_cleared -# alias: Audio Issue Cleared -# initial_state: true -# trigger: -# - platform: state -# entity_id: media_player.ha_speaker -# from: 'unavailable' -# to: 'off' -# condition: -# - condition: state -# entity_id: binary_sensor.day -# state: 'on' -# action: -# - service: script.text_notify -# data_template: -# who: "jeff" -# title: "Audio Issue Cleared" -# message: "Main hromecast is back on" -# - service: script.turn_on_ha_speaker - - script: @@ -381,7 +336,7 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker @@ -403,7 +358,7 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker @@ -626,11 +581,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house @@ -648,11 +603,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house @@ -680,11 +635,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house @@ -711,11 +666,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house @@ -733,11 +688,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house @@ -761,11 +716,11 @@ script: entity_id: > {% if who == 'kitchen' %} media_player.kitchen_display - {% elif who == 'croft' %} + {% elif who == 'theater' %} media_player.upstairs_speaker {% elif who == 'master_bedroom' %} media_player.master_bedroom_speaker - {% elif who == 'theater' %} + {% elif who == 'studio' %} media_player.theater {% elif who == 'all_google' %} media_player.house