From 7fcde2a6a886a927bbd0f2a8bcff6a989f725384 Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Sat, 25 Feb 2017 03:13:18 +0000 Subject: [PATCH] Check for things Playing and break through alerts. --- automation/System/CucKoo_Clock.yaml | 7 +++++++ script/voice_notify.yaml | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/automation/System/CucKoo_Clock.yaml b/automation/System/CucKoo_Clock.yaml index 13ad59d2..f08310b5 100755 --- a/automation/System/CucKoo_Clock.yaml +++ b/automation/System/CucKoo_Clock.yaml @@ -19,6 +19,13 @@ - condition: state entity_id: group.family state: 'home' + - condition: template + value_template: > + {% if is_state('media_player.livingroomCC', 'playing') %} + false + {% else %} + true + {% endif %} action: - service: media_player.turn_on diff --git a/script/voice_notify.yaml b/script/voice_notify.yaml index 48a7fe80..9b19af2a 100755 --- a/script/voice_notify.yaml +++ b/script/voice_notify.yaml @@ -29,16 +29,21 @@ voice_notify: - condition: state entity_id: input_boolean.alert_mode state: 'on' + - condition: or + conditions: + - condition: template + value_template: > + {% if is_state('media_player.livingroomCC', 'playing') %} + false + {% else %} + true + {% endif %} + - condition: state + entity_id: input_boolean.alert_mode + state: 'on' - condition: state entity_id: input_boolean.speech_notifications state: 'on' - - condition: template - value_template: > - {% if is_state('media_player.livingroomCC', 'playing') %} - false - {% else %} - true - {% endif %} - service: switch.turn_on entity_id: switch.living_room_amp - delay: '00:00:05' @@ -52,11 +57,11 @@ voice_notify: data_template: volume_level: > {% if now().strftime("%H")|int < 12 %} - 0.20 + 0.25 {% elif now().strftime("%H")|int < 18 %} 0.45 {% else %} - 0.25 + 0.20 {% endif %} - service: mqtt.publish @@ -80,6 +85,6 @@ voice_notify: cache: true - service: input_boolean.turn_off - entity_id: + entity_id: - input_boolean.last_message - input_boolean.alert_mode