Automation does not complete

I seem to have a problem with automations not completing… The below is an example. Two issues:

  1. The media player volume does not turn back down to 0.36
  2. The HA page cast to my google display remains - it never returns to the home screen

Thanks for any advice!

alias: TEST Automation
description: ""
trigger:
  - platform: template
    value_template: >


      {{  strptime(states('sensor.countdown_to_work_departure_time'),'%H:%M')
      <= 

      strptime('01:00','%H:%M')

      }}
condition: []
action:
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 1
    target:
      device_id: xyz
  - service: media_player.play_media
    target:
      entity_id: media_player.living_room_display
    data:
      media_content_id: >-
        media-source://tts/tts.home_assistant_cloud?message=Its+one+hour+before+work....+Time+to+get+up&language=en-NZ&voice=MollyNeural
      media_content_type: provider
    metadata:
      title: Its one hour before work.... Time to get up
      thumbnail: https://brands.home-assistant.io/_/tts/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: provider
          media_content_id: >-
            media-source://tts/tts.home_assistant_cloud?message=Its+one+hour+before+work....+Time+to+get+up&language=en-NZ&voice=MollyNeural
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.36
    target:
      device_id: xyz
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: media_player.play_media
    target:
      entity_id: media_player.living_room_display
    data:
      media_content_id: shed-wallbox
      media_content_type: lovelace
    metadata:
      title: Home
      thumbnail: https://brands.home-assistant.io/_/lovelace/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: lovelace
          media_content_id: ""
  - delay:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
  - service: media_player.media_stop
    metadata: {}
    data: {}
    target:
      device_id: xyz
mode: single

I have you checked Traces to see where it fails?

image

Thank you… was not aware of that… but no errors there or in the logs…. All look good… but seems noting happens after the annunciation…

Hummmm

media_player.stop was not teh correct command

The below works:

  - service: media_player.turn_off
    target:
      device_id: xyz

Rather than turn off the media player, this command returns it to its own home screen.

Think of it as turn off is stopping the cast to the Google Home