Help with Multi-Device Automation for Two Buttons with Three Press Types Each

I’m setting up a Home Assistant automation involving two physical buttons, each with three types of presses: single click, double click, and hold. The goal is to control different smart devices (like lights, TV, curtains, etc.) based on the type of press.Here’s what I want to achieve with the buttons:
Left Button (Button 1):Single click: Toggle light.lamp_1

Double click: Toggle light.lamp_2 or TV power

Hold: Toggle light.lamp_3 or open/close curtainsRight Button (Button 2):

Single click: Toggle light.lamp_4 or turn on/off sound system

Double click: Toggle light.lamp_5 or change TV input

Hold: Toggle light.lamp_6 or start/stop a fan

Here is the code what i have but i didn’t work in one code can someone help me withe this.

I can only get it to work when in make for every click make a different automation.
And i don’t want that because it became not organised in the automation folder.


description: Button actions for two buttons with three types of presses each
mode: single
trigger:
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 1_single
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 1_double
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 1_hold
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 2_single
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 2_double
  - platform: device
    domain: mqtt
    device_id: 99d8da150c20a73584e6878258462838
    type: action
    subtype: 2_hold
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: 1_single
        sequence:
          - service: light.toggle
            target:
              entity_id: light.lamp_1
      - conditions:
          - condition: trigger
            id: 1_double
        sequence:
          - service: light.toggle
            target:
              entity_id: light.lamp_2
      - conditions:
          - condition: trigger
            id: 1_hold
        sequence:
          - service: light.toggle
            target:
              entity_id: light.lamp_3
      - conditions:
          - condition: trigger
            id: 2_single
        sequence:
          - service: light.toggle
            target:
              entity_id: light.lamp_4
      - conditions:
          - condition: trigger
            id: 2_double
        sequence:
          - service: light.toggle
            target:
              entity_id: light.lamp_5
      - conditions:
          - condition: trigger
            id: 2_hold
        sequence:
          - service: light.toggle
            target:
              entity_id:

Please correct your post according to point 11 here:

I don’t know how to change it

Then post it again with the correct formatting.