diff --git a/automations/people/almost_bedtime.yaml b/automations/people/almost_bedtime.yaml index d83e21d..a0b839c 100644 --- a/automations/people/almost_bedtime.yaml +++ b/automations/people/almost_bedtime.yaml @@ -24,18 +24,25 @@ action: target: entity_id: input_boolean.kids_bedtime - - service: media_player.volume_set - data: - volume_level: 0.65 - target: - entity_id: - - media_player.bathroom_mini - - media_player.kitchen - - - service: script.make_clever_announcement - data: - media_content_id: media-source://media_source/local/Sounds/tts/almost_bedtime.mp3 - volume: 0.5 + - choose: + - conditions: + - condition: template + value_template: "{{states('media_player.announcements') == 'unknown' or states('media_player.announcements') == 'unavailable' }}" + sequence: + - service: script.make_clever_announcement + data: + entity_id: + - media_player.bathroom_mini + - media_player.kitchen + - media_player.utility_room_clock + media_content_id: media-source://media_source/local/Sounds/tts/almost_bedtime.mp3 + volume: 0.7 + default: + - service: script.make_clever_announcement + data: + entity_id: media_player.announcements + media_content_id: media-source://media_source/local/Sounds/tts/almost_bedtime.mp3 + volume: 0.7 # Because of how we're calling the script, the automation won't continue until the script is done, so we don't need a delay here #- delay: '00:00:10' diff --git a/automations/people/goodnight_kids.yaml b/automations/people/goodnight_kids.yaml index 78e1935..1bd4875 100644 --- a/automations/people/goodnight_kids.yaml +++ b/automations/people/goodnight_kids.yaml @@ -28,13 +28,14 @@ action: - choose: - conditions: - condition: template - value_template: "{{states('media_player.announcements') == 'unknown' }}" + value_template: "{{states('media_player.announcements') == 'unknown' or states('media_player.announcements') == 'unavailable' }}" sequence: - service: script.make_clever_announcement data: entity_id: - media_player.bathroom_mini - - media_player.computer_area_hub + - media_player.kitchen + - media_player.utility_room_clock media_content_id: >- {% if is_state('input_boolean.emmett_home', 'on') %} {% if is_state('input_boolean.bridget_home', 'on') %} @@ -57,7 +58,7 @@ action: {% elif is_state('input_boolean.ebin_home', 'on') %} media-source://media_source/local/Sounds/tts/goodnight_ebin.mp3 {% endif %} - volume: 0.5 + volume: 0.7 default: - service: script.make_clever_announcement data: @@ -84,7 +85,7 @@ action: {% elif is_state('input_boolean.ebin_home', 'on') %} media-source://media_source/local/Sounds/tts/goodnight_ebin.mp3 {% endif %} - volume: 0.5 + volume: 0.7 # Because of how we're calling the script, the automation won't continue until the script is done, so we don't need a delay here #- delay: '00:00:10' diff --git a/components/packages/clever_announcements.yaml b/components/packages/clever_announcements.yaml index 2b00414..e651ce6 100644 --- a/components/packages/clever_announcements.yaml +++ b/components/packages/clever_announcements.yaml @@ -81,11 +81,11 @@ script: data: volume_level: "{{volume}}" - - alias: "Wait another bit for the volume to be set" - delay: - hours: 0 - minutes: 0 - seconds: 2 + # - alias: "Wait another bit for the volume to be set" + # delay: + # hours: 0 + # minutes: 0 + # seconds: 2 - alias: "Play the announcement" service: media_player.play_media @@ -111,7 +111,8 @@ script: - alias: Wait for the specified media_player(s) to become idle wait_for_trigger: - platform: template - value_template: "{{ is_state(media_player, 'idle') or is_state(media_player, 'off')}}" + value_template: "{{ is_state(media_player, 'idle') or is_state(media_player, 'off') or is_state(media_player, 'unavailable')}}" + timeout: "00:00:30" - alias: "Give a second of dead air after the announcement" delay: