Aqara Wireless Mini Switches - No Button Detection

Hey,

I’ve got a few Aqara Wireless Mini Switches and until recently (few weeks ago I think) they’ve been working fine. However, I no longer seem to be able to have an option to detect when the button is either pressed, double pressed or long pressed.

They appear in Homekit devices as they always did fine, but my automations no longer work when they are pressed now.

Did something update Home Assistant side recently that might have caused this? Or perhaps Aqara did something, not sure?

I wondered if anyone else had similar issues?

Many Thanks

I have 3 Aqara Wireless Mini Switches in the HomeKit device integration and do not have any issues. I’ve had them 18 months. I’m currently on Ha core 2024.1.6.

What kind of switches are they?
I have a buch of these Aqara WXKG11LM and have them working through Zigbee2MQTT, not Homekit, and they work fine.
Depite the fact that they have the same model number, though, some of the have single/double/triple/quadruple functions while others report single/double/hold/release.

They are the Aqara Wireless Mini Switch(WXKG11LM). They are connected to my Aqara Camera Hub G3 and connected to Home Assistant via Homekit.

The event is coming through to Home Assistant but I think something has changed stopping the automation from working. Here’s a log from “Listen to events” when pressing the button once:

event_type: state_changed
data:
  entity_id: event.button_3
  old_state:
    entity_id: event.button_3
    state: "2024-03-25T12:00:27.965+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Button
    last_changed: "2024-03-25T12:00:27.965855+00:00"
    last_updated: "2024-03-25T12:00:27.965855+00:00"
    context:
      id: [REDACTED]
      parent_id: null
      user_id: null
  new_state:
    entity_id: event.button_3
    state: "2024-03-25T13:51:57.185+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Button
    last_changed: "2024-03-25T13:51:57.185244+00:00"
    last_updated: "2024-03-25T13:51:57.185244+00:00"
    context:
      id: [REDACTED]
      parent_id: null
      user_id: null

The issue I believe I’m having is on an event e.g. “single_press” the state is changing to that event but then on the following same event is not changing because the device is already in that state. So having a simple automation to toggle a light on the button press doesn’t seem so simple.

Unless Im missing something.

Here is one of my automations for a single press. I usually use entities instead of devices in my automations, but the buttons are easier to use as devices.


alias: "Bedroom light toggle "
description: ""
trigger:
  - platform: device
    device_id: fa80ac0d8f557cde0f589666daa3fda8
    domain: homekit_controller
    type: button1
    subtype: single_press
condition: []
action:
  - service: light.toggle
    metadata: {}
    data: {}
    target:
      entity_id: light.bedroom_light_plug
mode: single

Humm it would seem the button I’m trying to work with isn’t providing me with the same options as my other buttons which I’ve only just noticed.

For example here is one button and it’s options:

Now here is the button I’m trying to use and you can see the single, double and long press triggers are missing:

Try looking at Developer Tools → Events, then look at the list of listeners to see if there is a listener for Zigbee2MQTT.

I’ve just restarted Home Assistant a few times and now suddenly they are there and all is working. I can select the device and the triggers short, long and double.

I’ve no idea why it is suddenly appearing but problem “solved” :slight_smile:

I had the same problem but actually physically doing a double click, hold and also release made the triggers automaticly show.

I have the same problem, especially after the last HA update, they disappear and come back all the time.

What would be causing this?

My issue was that the automation was only working when the state changed to something new (e.g. from long_release to multi_press_1). The automation wouldn’t trigger when there was a state change to itself (e.g from multi_press_1 to multi_press_1). I changed my trigger to this:

trigger:
  - platform: state
    entity_id: event.aqara_wireless_mini_switch
condition:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.event_type == 'multi_press_1' }}"

This was my old trigger that didn’t work:

trigger:
  - platform: state
    entity_id: event.aqara_wireless_mini_switch
    attribute: event_type
    to: multi_press_1

Key changes:

  1. Removed the attribute trigger and moved it to a condition instead
  2. The automation will now trigger on any state change of the entity
  3. Added a condition that checks if the event_type is ‘multi_press_1’

This way, the automation will:

  1. Trigger whenever the button entity’s state changes (which happens with every press)
  2. Only execute if the event_type is ‘multi_press_1’

This should now work consistently regardless of whether the previous event type was the same or different.