WXKG12LM - Aqara Wireless Mini Switch

I recently purchased Aqara Wireless Mini Switch [WXKG12LM].

When I add it to my homeassistant using Aqara Gateway Integration, it doesn’t give me the action types it is only showing On/Off and battery level change in automations. (as shown in the image below)

I tried looking for answers in the community and ran into this option of using blueprint. So I used the following blueprint Link

But when I go to automations and click on this print, it says no device found. Sharing a screenshot below:

Would be grateful if someone could kindly guide me in the right direction on how to get the missing entities/triggers for this mini switch.

Would appreciate if anyone who is using this model of Aqara Wireless Mini Switch could kindly share a fix. Thank you :slight_smile:

Hello, I’m working on a similar item and am currently drafting an blueprint to address a related issue. I to have this button hooked up through the Aqara gateway. I then have it published to HA through Matter.

The blueprint you are using is assuming you have it published to HA via ZHA. I am not sure that you can do that with the Aqara hub. This is what I feel is leading to the mismatch you show above.

I have gotten some data using the event monitor and have rigged up an automation by hand that fires.
The data from the Monitor:

event_type: state_changed
data:
  entity_id: event.steph_s_button
  old_state:
    entity_id: event.steph_s_button
    state: "2024-03-04T16:34:41.772+00:00"
    attributes:
      event_types:
        - initial_press
        - short_release
        - long_press
        - long_release
        - multi_press_ongoing
        - multi_press_complete
      event_type: initial_press
      newPosition: 1
      device_class: button
      friendly_name: Steph's Button
    last_changed: "2024-03-04T16:34:41.773034+00:00"
    last_updated: "2024-03-04T16:34:41.773034+00:00"
    context:
      id: 01HR552GZDH1GVJ6Y7RKDEXYQ9
      parent_id: null
      user_id: null
  new_state:
    entity_id: event.steph_s_button
    state: "2024-03-04T16:34:41.775+00:00"
    attributes:
      event_types:
        - initial_press
        - short_release
        - long_press
        - long_release
        - multi_press_ongoing
        - multi_press_complete
      event_type: short_release
      previousPosition: 1
      device_class: button
      friendly_name: Steph's Button
    last_changed: "2024-03-04T16:34:41.775231+00:00"
    last_updated: "2024-03-04T16:34:41.775231+00:00"
    context:
      id: 01HR552GZF9S9W4T8BQ4HS8Y1D
      parent_id: null
      user_id: null
origin: LOCAL
time_fired: "2024-03-04T16:34:41.775231+00:00"
context:
  id: 01HR552GZF9S9W4T8BQ4HS8Y1D
  parent_id: null
  user_id: null

I latched on the the event_type of multi_press_complete and the totalNumberOfPressesCounted to get responsed to both single and double presses. It isn’t pretty and is very much me stumbling around in the dark. Here is the automation:

- id: '1709081381187'
  alias: SButton
  description: ''
  trigger:
  - platform: state
    entity_id:
    - event.steph_s_button
    attribute: event_type
    to: multi_press_complete
  condition: []
  action:
  - choose:
    - conditions:
      - condition: numeric_state
        entity_id: event.steph_s_button
        attribute: totalNumberOfPressesCounted
        above: 0
        below: 2
      sequence:
      - service: switch.toggle
        metadata: {}
        data: {}
        target:
          entity_id: switch.readinglight
    - conditions:
      - condition: numeric_state
        entity_id: event.steph_s_button
        above: 1
        below: 3
        attribute: totalNumberOfPressesCounted
      sequence:
      - service: tts.speak
        metadata: {}
        data:
          cache: true
          media_player_entity_id: media_player.kitchen_group
          message: Two
        target:
          entity_id: tts.google_en_com

I am trying to shoehorn it into a blueprint that i’ll happily share for criticism and destruction hopefully soon.

1 Like

Thank you for the kind response.

I will try adding the button via ZHA and update you if my current blueprint works then.

Meanwhile will also be looking forward to your blueprint.

Here are things roughed in without any testing. I’m sure there are plenty of things to fix to make it work. I had hoped to at least rough out the structure and logic. Only accounts for completed sequences as it is based off the multi_press_complete state change.

First attempt sloggin thought this. Don’t laugh too loudly. Thank you!

blueprint:
  name: Matter - Aqara Wireless Mini Switch
  description: Automate your Aqara Wireless Mini Switch when run via Matter
  author: EFH52
  domain: automation
  input:
    target_switch:
      name: Aqara Wireless Mini Switch
      description: Target Aqara Wireless Mini Switch to monitor
      selector:
        entity:
          integration: matter
          model: Aqara Wireless Mini Switch
    short_release_action:
      name: Short Press Complete
      description: Action to take when Short Press is completed
      default: []
      selector:
        action: {}
    long_release_action:
      name: Long Press Complete
      description: Action to take when Long Press is completed
      default: []
      selector:
        action: {}
    two_release_action:
      name: Double Press Complete
      description: Action to take when Double Press is completed
      default: []
      selector:
        action: {}
    three_release_action:
      name: Triple Press Complete
      description: Action to take when Triple Press is completed
      default: []
      selector:
        action: {}
    four_release_action:
      name: Quadruple Press Complete
      description: Action to take when Quadruple Press is completed
      default: []
      selector:
        action: {}

mode: restart
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input target_switch

action:
  - variables:
      - command: "{{ trigger.to_state.attributes.event_type }}"
      - presses: "{{ trigger.to_state.attributes.totalNumberOfPressesCounted }}"
  - sequence:
      - condition: "{{ command == 'multi_press_complete' }}"
        sequence:
          - choose:
              - condition: "{{ presses == 1 }}"
                sequence:
                  - choose:
                      - condition: "{{ command == 'short_release' }}"
                        sequence: !input short_release_action
                      - condition: "{{ command == 'long_release' }}"
                        sequence: !input long_release_action
              - condition: "{{ presses == 2 }}"
                sequence: !input two_press
              - condition: "{{ presses == 3 }}"
                sequence: !input three_press
              - condition: "{{ presses == 4 }}"
                sequence: !input four_press