[solved] Automation w/ 3 actions (notification scripts): how to make them run in parallel?

I have an automation that runs 3 actions which are scripts.

  • The trigger is the doorbell
  • each action is a script that uses browser_mod to display the camera from the doorbell on a device (phone or tablet or pc)

For making the scripts work, I had to add some delays, apparently, and thus the next action is only executed when the current one is finished - which of course is not convenient.
I have changed the timings for test purposes.

Automation:

alias: "Access: Doorbell Alert"
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_button_state
    to: "on"
condition: []
action:
  - service: script.notification_tablet_screen_on_doorcam
    data: {}
  - service: script.notification_doorbell_phone
    data: {}
  - service: script.notification_doorbell_pc
    data: {}
mode: parallel
max: 10

Script for phone:

alias: "Notification: Doorbell => phone"
sequence:
  - service: notify.mobile_app_phone
    data:
      message: TTS
      data:
        ttl: 0
        priority: high
        media_stream: alarm_stream_max
        tts_text: Someone is at the door
    enabled: true
  - service: notify.mobile_app_phone
    data:
      message: command_screen_on
    enabled: true
  - service: notify.mobile_app_phone
    data:
      message: command_webview
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: browser_mod.popup
    data:
      size: fullscreen
      browser_id: 75e1bad0-5ccf9174
      content:
        type: vertical-stack
        cards:
          - square: false
            columns: 3
            type: grid
            cards:
              - type: custom:config-template-card
                entities:
                  - switch.gate1_status
                card:
                  type: button
                  tap_action:
                    action: none
                  hold_action:
                    action: call-service
                    service: script.switch_gate1
                    data: {}
                    target: {}
                  name: Gate 1
                  show_name: false
                  entity: switch.gate1_status
                  icon: >-
                    ${ states['switch.gate1_status'].state  === 'on' ?
                    'mdi:gate-alert' : 'mdi:gate-arrow-right' }
              - type: custom:config-template-card
                entities:
                  - switch.gate2_status
                card:
                  type: button
                  tap_action:
                    action: none
                  hold_action:
                    action: call-service
                    service: script.switch_gate2
                    data: {}
                    target: {}
                  name: Gate 2
                  show_name: false
                  entity: switch.gate2_status
                  icon: >-
                    ${ states['switch.gate2_status'].state  === 'on' ?
                    'mdi:gate-open' : 'mdi:gate' }
              - type: custom:config-template-card
                entities:
                  - switch.garagedoor_status
                card:
                  type: button
                  tap_action:
                    action: none
                  hold_action:
                    action: call-service
                    service: script.switch_garagedoor
                    data: {}
                    target: {}
                  name: Garagedoor
                  show_name: false
                  entity: switch.garagedoor_status
                  icon: >-
                    ${ states['switch.garagedoor_status'].state  === 'on' ?
                    'mdi:garage-open-variant' : 'mdi:garage-variant' }
          - camera_view: live
            type: picture-glance
            entities: []
            camera_image: camera.door
      dismissable: true
      autoclose: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: browser_mod.close_popup
    data:
      browser_id: 75e1bad0-5ccf9174
mode: single

Any suggestions are very welcome for a better approach!

Calling scripts directly vs. Using script.turn_on

1 Like

Ha, that simple: :bowing_man:
Thank you!