Stream video when media playback complete?

I have a doorbell automation which plays an announcement on smart speakers and media players, then streams a video from the doorbell to a couple of Google smart displays. I am finding that the announcement, even though it is less than 3 seconds long, is being truncated by the commencement of the video stream on the same device.
Is there any way of queueing these actions so that the video stream only starts when the previous media item playback has completed? I could put in a delay, but I’d prefer it if the stream just commenced as soon as possible after the announcement.
This is the automation:

alias: Doorbell Pressed
description: ""
triggers:
  - entity_id:
      - binary_sensor.reolink_video_doorbell_wifi_visitor
    to: "on"
    trigger: state
conditions: []
actions:
  - variables:
      current_state: "{{ states('media_player.living_room') }}"
  - sequence:
      - data:
          media_content_id: https://mydomain/local/front-door.mp3
          media_content_type: music
        action: media_player.play_media
        target:
          entity_id:
            - media_player.lounge_display
      - action: camera.play_stream
        metadata: {}
        data:
          format: hls
          media_player: media_player.lounge_display
        target:
          entity_id: camera.unnamed_doorbell

Maybe add another action after the announcement which checks that the state of your media player went back to idle?

A wait for trigger should do it. Just to be safe, I’d add a timeout of 5s & set continue on timeout to true

1 Like

Thanks - I had never heard of wait for triggers. I’ll try it.

1 Like