From 91462789aca0b58e460a693d80b2e8d2cc2b3550 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 31 Mar 2020 16:52:47 +0200 Subject: [PATCH] Added waitiging media_player available before play --- script/audio.yaml | 16 ++++++++++++++-- script/notify.yaml | 6 ++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/script/audio.yaml b/script/audio.yaml index bf6c1a5e..f4658f56 100644 --- a/script/audio.yaml +++ b/script/audio.yaml @@ -18,7 +18,13 @@ laura_voice: - condition: state entity_id: input_boolean.speech_notifications state: 'on' - + + - wait_template: >- + {% if media_player | length == 0 %} + {% set media_player = 'media_player.google_home' %} + {% endif %} + {{ not is_state(media_player, 'playing') }} + - service: script.volume_manager data_template: media_player: >- @@ -93,7 +99,13 @@ babu_voice: - condition: state entity_id: input_boolean.speech_notifications state: 'on' - + + - wait_template: >- + {% if media_player | length == 0 %} + {% set media_player = 'media_player.google_home' %} + {% endif %} + {{ not is_state(media_player, 'playing') }} + - service: script.volume_manager data_template: media_player: >- diff --git a/script/notify.yaml b/script/notify.yaml index 12a00a7b..5c7382c9 100644 --- a/script/notify.yaml +++ b/script/notify.yaml @@ -133,6 +133,12 @@ notify_voice: - condition: state entity_id: input_boolean.speech_notifications state: 'on' + + - wait_template: >- + {% if media_player | length == 0 %} + {% set media_player = 'media_player.google_home' %} + {% endif %} + {{ not is_state(media_player, 'playing') }} - service: script.volume_manager data_template: -- 2.47.3