Multiple action after single trigger not working

Hi,

My current blueprint for aqara opple is working only for one single action i.e. if I want to trigger two actions (light 1 on + light 2 on) for middle right single click only first action is triggered.

https://github.com/capi92/z2m_opple/blob/159e2ab3ca766ac7806aa877dcaf08a62c6a4505/blueprint2.yml

  name: Zigbee2Mqtt Opple Cover Switch
  description:
    '"Full control of the 6 buttons of the Aqara Opple switch"
    '
  domain: automation
  input:
    action_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
    
    button_top_left_single_press:
      name: Top left button - Single press
      description: Action to run on a single press of the top left button
      default: []
      selector:
        action: {}

    button_top_left_double_press:
      name: Top left button - Double press
      description: Action to run on a double press of the top left button
      default: []
      selector:
        action: {}

    button_top_left_triple_press:
      name: Top left button - Triple press
      description: Action to run on a triple press of the top left button
      default: []
      selector:
        action: {}

    button_top_left_hold_release:
      name: Top left button - Hold release
      description: Action to run when top left button was held in and released
      default: []
      selector:
        action: {}

    button_top_left_hold_in:
      name: Top left button - Hold in
      description: Action to run when top left button is held in
      default: []
      selector:
        action: {}

    # ---------------------------- BUTTON TOP RIGHT ----------------------------
    button_top_right_single_press:
      name: Top right button - Single press
      description: Action to run on a single press of the top right button
      default: []
      selector:
        action: {}

    button_top_right_double_press:
      name: Top right button - Double press
      description: Action to run on a double press of the top right button
      default: []
      selector:
        action: {}

    button_top_right_triple_press:
      name: Top right button - Triple press
      description: Action to run on a triple press of the top right button
      default: []
      selector:
        action: {}

    button_top_right_hold_release:
      name: Top right button - Hold release
      description: Action to run when top right button was held in and released
      default: []
      selector:
        action: {}

    button_top_right_hold_in:
      name: Top right button - Hold in
      description: Action to run when top right button is held in
      default: []
      selector:
        action: {}

    # ---------------------------- BUTTON MIDDLE LEFT ----------------------------
    button_middle_left_single_press:
      name: Middle left button - Single press
      description: Action to run on a single press of the middle left button
      default: []
      selector:
        action: {}

    button_middle_left_double_press:
      name: Middle left button - Double press
      description: Action to run on a double press of the middle left button
      default: []
      selector:
        action: {}

    button_middle_left_triple_press:
      name: Middle left button - Triple press
      description: Action to run on a triple press of the middle left button
      default: []
      selector:
        action: {}

    button_middle_left_hold_release:
      name: Middle left button - Hold release
      description: Action to run when middle left button was held in and released
      default: []
      selector:
        action: {}

    button_middle_left_hold_in:
      name: Middle left button - Hold in
      description: Action to run when middle left button is held in
      default: []
      selector:
        action: {}

    # ---------------------------- BUTTON MIDDLE RIGHT ----------------------------
    button_middle_right_single_press:
      name: Middle right button Single press
      description: Action to run on a single press of the middle right button
      default: []
      selector:
        action: {}

    button_middle_right_double_press:
      name: Middle right button Double press
      description: Action to run on a double press of the middle right button
      default: []
      selector:
        action: {}

    button_middle_right_triple_press:
      name: Middle right button triple press
      description: Action to run on a triple press of the middle right button
      default: []
      selector:
        action: {}

    button_middle_right_hold_release:
      name: Middle right button Hold release
      description: Action to run when middle right button was held in and released
      default: []
      selector:
        action: {}

    button_middle_right_hold_in:
      name: Middle right button Hold in
      description: Action to run when middle right button is held in
      default: []
      selector:
        action: {}

    # ---------------------------- BUTTON BOTTOM LEFT ----------------------------
    button_bottom_left_single_press:
      name: Bottom left button - Single press
      description: Action to run on a single press of the bottom left button
      default: []
      selector:
        action: {}

    button_bottom_left_double_press:
      name: Bottom left button - Double press
      description: Action to run on a double press of the bottom left button
      default: []
      selector:
        action: {}

    button_bottom_left_triple_press:
      name: Bottom left button - Triple press
      description: Action to run on a triple press of the bottom left button
      default: []
      selector:
        action: {}

    button_bottom_left_hold_release:
      name: Bottom left button - Hold release
      description: Action to run when bottom left button was held in and released
      default: []
      selector:
        action: {}

    button_bottom_left_hold_in:
      name: Bottom left button - Hold in
      description: Action to run when bottom left button is held in
      default: []
      selector:
        action: {}

    # ---------------------------- BUTTON BOTTOM RIGHT ----------------------------
    button_bottom_right_single_press:
      name: Bottom right button - Single press
      description: Action to run on a single press of the bottom right button
      default: []
      selector:
        action: {}

    button_bottom_right_double_press:
      name: Bottom right button - Double press
      description: Action to run on a double press of the bottom right button
      default: []
      selector:
        action: {}

    button_bottom_right_triple_press:
      name: Bottom right button - Triple press
      description: Action to run on a triple press of the bottom right button
      default: []
      selector:
        action: {}

    button_bottom_right_hold_release:
      name: Bottom right button - Hold release
      description: Action to run when bottom right button was held in and released
      default: []
      selector:
        action: {}

    button_bottom_right_hold_in:
      name: Bottom right button - Hold in
      description: Action to run when bottom right button is held in
      default: []
      selector:
        action: {}

mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input "action_sensor"
    attribute: action

action:
  - variables:
      command: '{{ trigger.to_state.attributes.action if trigger.to_state.state == "" else trigger.to_state.state }}'
  - choose:

    - conditions: '{{ command == ''button_1_single'' }}'
      sequence: !input 'button_top_left_single_press'
    - conditions: '{{ command == ''button_1_double'' }}'
      sequence: !input 'button_top_left_double_press'
    - conditions: '{{ command == ''button_1_triple'' }}'
      sequence: !input 'button_top_left_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_1_hold'' }}'
      sequence: !input 'button_top_left_hold_in'
    - conditions: '{{ command == ''button_1_release'' }}'
      sequence: !input 'button_top_left_hold_release'

    - conditions: '{{ command == ''button_2_single'' }}'
      sequence: !input 'button_top_right_single_press'
    - conditions: '{{ command == ''button_2_double'' }}'
      sequence: !input 'button_top_right_double_press'
    - conditions: '{{ command == ''button_2_triple'' }}'
      sequence: !input 'button_top_right_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_2_hold'' }}'
      sequence: !input 'button_top_right_hold_in'
    - conditions: '{{ command == ''button_2_release'' }}'
      sequence: !input 'button_top_right_hold_release'

    - conditions: '{{ command == ''button_3_single'' }}'
      sequence: !input 'button_middle_left_single_press'
    - conditions: '{{ command == ''button_3_double'' }}'
      sequence: !input 'button_middle_left_double_press'
    - conditions: '{{ command == ''button_3_triple'' }}'
      sequence: !input 'button_middle_left_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_3_hold'' }}'
      sequence: !input 'button_middle_left_hold_in'
    - conditions: '{{ command == ''button_3_release'' }}'
      sequence: !input 'button_middle_left_hold_release'

    - conditions: '{{ command == ''button_4_single'' }}'
      sequence: !input 'button_middle_right_single_press'
    - conditions: '{{ command == ''button_4_double'' }}'
      sequence: !input 'button_middle_right_double_press'
    - conditions: '{{ command == ''button_4_triple'' }}'
      sequence: !input 'button_middle_right_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_4_hold'' }}'
      sequence: !input 'button_middle_right_hold_in'
    - conditions: '{{ command == ''button_4_release'' }}'
      sequence: !input 'button_middle_right_hold_release' 

    - conditions: '{{ command == ''button_5_single'' }}'
      sequence: !input 'button_bottom_left_single_press'
    - conditions: '{{ command == ''button_5_double'' }}'
      sequence: !input 'button_bottom_left_double_press'
    - conditions: '{{ command == ''button_5_triple'' }}'
      sequence: !input 'button_bottom_left_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_5_hold'' }}'
      sequence: !input 'button_bottom_left_hold_in'
    - conditions: '{{ command == ''button_5_release'' }}'
      sequence: !input 'button_bottom_left_hold_release'

    - conditions: '{{ command == ''button_6_single'' }}'
      sequence: !input 'button_bottom_right_single_press'
    - conditions: '{{ command == ''button_6_double'' }}'
      sequence: !input 'button_bottom_right_double_press'
    - conditions: '{{ command == ''button_6_triple'' }}'
      sequence: !input 'button_bottom_right_triple_press'
    #- conditions: '{{ command == ''quadruple'' }}'
    #  sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''button_6_hold'' }}'
      sequence: !input 'button_bottom_right_hold_in'
    - conditions: '{{ command == ''button_6_release'' }}'
      sequence: !input 'button_bottom_right_hold_release'      
type or paste code here

Would generate the following output


- id: '1645551139623'
  alias: Sonos SDB
  description: ''
  use_blueprint:
    path: opple/aqara_opple_6.yaml
    input:
      action_sensor: sensor.inter_sdb_sonos_action
      button_top_right_single_press:
      - service: media_player.select_source
        data:
          source: RTL
        target:
          entity_id: media_player.salle_de_bain
      button_middle_left_single_press:
      - service: media_player.volume_down
        data: {}
        target:
          entity_id: media_player.salle_de_bain
      button_middle_left_double_press:
      - service: media_player.volume_mute
        data:
          is_volume_muted: true
        target:
          entity_id: media_player.salle_de_bain
      button_middle_right_single_press:
      - service: media_player.volume_mute
        data:
          is_volume_muted: false
        target:
          entity_id: media_player.salle_de_bain
      - service: media_player.volume_up
        data: {}
        target:
          entity_id: media_player.salle_de_bain
      button_middle_right_double_press:
      - service: media_player.volume_mute
        data:
          is_volume_muted: false
        target:
          entity_id: media_player.salle_de_bain
      button_middle_left_triple_press:
      - service: media_player.volume_set
        data:
          volume_level: 0.1
        target:
          entity_id: media_player.salle_de_bain
      button_middle_right_triple_press:
      - service: media_player.volume_set
        data:
          volume_level: 0.3
        target:
          entity_id: media_player.salle_de_bain
      button_top_left_single_press:
      - service: media_player.media_play_pause
        data: {}
        target:
          entity_id: media_player.salle_de_bain
      button_top_right_double_press:
      - service: media_player.select_source
        data:
          source: NRJ
        target:
          entity_id: media_player.salle_de_bain
      button_top_right_triple_press:
      - service: media_player.select_source
        data:
          source: VOLTAGE
        target:
          entity_id: media_player.salle_de_bain
      button_bottom_left_single_press:
      - service: media_player.select_source
        data:
          source: Dalida By Ibrahim Maalouf
        target:
          entity_id: media_player.salle_de_bain
      button_bottom_right_single_press:
      - service: media_player.select_source
        data:
          source: Europe 1
        target:
          entity_id: media_player.salle_de_bain
      button_bottom_right_double_press:
      - service: media_player.select_source
        data:
          source: France Inter
        target:
          entity_id: media_player.salle_de_bain
      button_bottom_left_double_press:
      - service: media_player.select_source
        data: {}
        target:
          entity_id: media_player.salle_de_bain

button_middle_right_single_press only trigger first action

Thanks for your help
Regards

Any clue?

Appreciate your help.

Apparently you have the same problem as I have: Only first action in sequence gets executed

Waiting for a solution, I’m creating tailored scripts for each action requiring more than one action to be executed…

Actually creating scripts with multiple actions and executing them with the automation also doesn’t work. I had the impression it did but it doesn’t, I just tested it. Only the first action of the script gets executed. If I execute the script manually, it works fine.

I figured it out! You have to change “mode: restart” to “mode: parallel”. The problem was that the sequence was always immediately aborted by a new trigger. See here.

Now I’m wondering if we set the triggers wrong for it to be constantly triggered. Most likely we did. Anyway “mode: parallel” completely solves it.

Edit: likely the problem was that we didn’t specify the trigger with “to:” or “from:”. Because there’s two changes of states (one when the command appears, and one immediately after when it disappears) both acting as a trigger (and the 2nd one was aborting the sequence).

Thanks for your help !

Thanks, It worked, but there is a long delay between actions (about 5 seconds).
I have 3 actions, and it takes 15 seconds to turn lights on/off