Trigger an automation after another one finishes

I have an automation to alert me when someone is at the front door. The automation sets the volume on the Google’s and Alexa’s and then tells me “someone is at the frontdoor”. What I am looking to do is set the volume to a lower level once the automation finishes. Can a second automation be triggered following the completion of the first one ? Any suggestions ?

alias: Notifications - (Front door)
description: ''
trigger:
  - type: motion
    platform: device
    device_id: 2b408afb093451068becdc79dbe67227
    entity_id: binary_sensor.frontdoor_person_motion
    domain: binary_sensor
condition:
  - condition: time
    after: '09:30:00'
    before: '21:00:00'
action:
  - service: media_player.volume_set
    target:
      device_id:
        - 0a21f25eb5966e1450c98cbdb845fb7d
    data:
      volume_level: 0.6
  - service: media_player.volume_set
    target:
      device_id:
        - 4fdad7daa9d5fd6cd6bf31bb80d17dc8
    data:
      volume_level: 0.5
  - service: media_player.volume_set
    target:
      device_id:
        - e9e7744d176d355a8a731e38405114e1
    data:
      volume_level: 0.35
  - service: tts.google_translate_say
    data:
      entity_id: media_player.family_room_speaker
      language: it
      message: >-
        Someones at the front door
  - service: tts.google_translate_say
    data:
      entity_id: media_player.hub
      language: it
      message: >-
        Someones at the front door
  - service: notify.alexa_media_echo_dot_den
    data:
      target: alexa_media_echo_dot_den
      data:
        type: tts
      message: Someones at the front door
mode: single

keep it all in one, that’s what I will do…

alias: Notifications - (Front door)
description: ''
trigger:
  - type: motion
    platform: device
    device_id: 2b408afb093451068becdc79dbe67227
    entity_id: binary_sensor.frontdoor_person_motion
    domain: binary_sensor
condition:
  - condition: time
    after: '09:30:00'
    before: '21:00:00'
action:
  - service: media_player.volume_set
    target:
      device_id:
        - 0a21f25eb5966e1450c98cbdb845fb7d
    data:
      volume_level: 0.6
  - service: media_player.volume_set
    target:
      device_id:
        - 4fdad7daa9d5fd6cd6bf31bb80d17dc8
    data:
      volume_level: 0.5
  - service: media_player.volume_set
    target:
      device_id:
        - e9e7744d176d355a8a731e38405114e1
    data:
      volume_level: 0.35
  - service: tts.google_translate_say
    data:
      entity_id: media_player.family_room_speaker
      language: it
      message: >-
        Someones at the front door
  - service: tts.google_translate_say
    data:
      entity_id: media_player.hub
      language: it
      message: >-
        Someones at the front door
  - service: notify.alexa_media_echo_dot_den
    data:
      target: alexa_media_echo_dot_den
      data:
        type: tts
      message: Someones at the front door
  - delay: '00:00:04' #which is just a second longer, than your voice message to get enough time to play it
  - service: media_player.volume_set
    target:
      device_id:
        - 0a21f25eb5966e1450c98cbdb845fb7d
    data:
      volume_level: 0.5
  - service: media_player.volume_set
    target:
      device_id:
        - 4fdad7daa9d5fd6cd6bf31bb80d17dc8
    data:
      volume_level: 0.4
  - service: media_player.volume_set
    target:
      device_id:
        - e9e7744d176d355a8a731e38405114e1
    data:
      volume_level: 0.25
mode: single

Like @BebeMischa said, just include it in your automation.

However, to answer your question, yes. There is an automation.trigger service or you can set a input_boolean at the end of your first automation that is the trigger for the second.

If you just don’t like how long your automation is getting, consider creating three scripts: one for each series of actions (volume up, alert, volume down).

Another option could be to create a temp scene at the beginning of the automation so as to save the current volume of the devices, adjust the volume, make the tts and then restore the scene.

1 Like