WXKG12LM - Aqara Wireless Mini Switch

I was right, it seems to take any event as part of the attribute event_type as only changing when it’s anything other than the original button type you press. For example, if you single press the button, it won’t change until you do something like a double press, then a single press. I’ve changed the script to only remove the attribute and suddenly it’s working again. Not sure what it was about the version back from September that broke this, but I’m very happy to get this working again.

blueprint:
  name: Matter - Aqara Wireless Mini Switch
  description: Automate your Aqara Wireless Mini Switch when run via Matter (with long/short press differentiation)
  author: EFH52 (enhanced by AI)
  domain: automation
  input:
    target_switch:
      name: Aqara Wireless Mini Switch
      description: Target Aqara Wireless Mini Switch to monitor
      selector:
        entity:
          integration: matter
          domain: event
          device_class: button

    short_press_action:
      name: Short Press Action
      description: Action to take on a short press
      default: []
      selector:
        action: {}

    long_press_action:
      name: Long Press Action
      description: Action to take on a long press
      default: []
      selector:
        action: {}

    double_press_action:
      name: Double Press Action
      description: Action to take on a double press
      default: []
      selector:
        action: {}

    triple_press_action:
      name: Triple Press Action
      description: Action to take on a triple press
      default: []
      selector:
        action: {}

    quadruple_press_action:
      name: Quadruple Press Action
      description: Action to take on a quadruple press
      default: []
      selector:
        action: {}

mode: single
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input target_switch

action:
  - service: persistent_notification.create
    data:
      title: "Aqara Mini Switch Debug"
      message: "Event triggered:  event_type={{ trigger.to_state.attributes.event_type }}"

  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'multi_press_1' }}"
        sequence: !input short_press_action

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'long_press' }}"
        sequence: !input long_press_action

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'multi_press_2' and trigger.to_state.attributes.totalNumberOfPressesCounted == 2 }}"
        sequence: !input double_press_action

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'multi_press_2' and trigger.to_state.attributes.totalNumberOfPressesCounted == 3 }}"
        sequence: !input triple_press_action

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'multi_press_2' and trigger.to_state.attributes.totalNumberOfPressesCounted == 4 }}"
        sequence: !input quadruple_press_action

EDIT: I also realized that Aqara I think changed the events to something else. So, I also changed the names to properly reflect the button event names.

EDIT2: Here’s an easy button that’s stored on github:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Edit 3: I couldn’t get the triple and quadruples to work. So, I removed them in the import. I left them in this comment though since maybe someone else can figure out how to modify it for it to work.