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)
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:
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:
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
Not sure if it would be off topic but i have a quick question on your experience with Aqara mini switch.
Like you, I recently purchased it and linked it through matter.
When I click on the button, I get multiple events (2 to 3) and not just a single one.
Aqara app shows right amount of click.
I am trying to make an automation based on single/double click but this behavior prevents any correct interpretation of the action.
That link was for the Aqara app having fixed things. I’ve gotten it to work for single and double by tracking the multipress event.
Use event type for the trigger.
Choose your entity, choose event type as the attribute, choose to multipresscomplete. Then set the upper and lower limits either side the number of presses you each to trigger. It is messy, but it works.
Here is where I landed. I have function (debugging still shows in this blueprint), but it stops at the double press. In the Aqara app, it only shows single, double, and long as options. So i’m guessing things changes in the firmware.
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
attribute: event_type
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 == 'short_release' }}"
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_complete' 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_complete' 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_complete' and trigger.to_state.attributes.totalNumberOfPressesCounted == 4 }}"
sequence: !input quadruple_press_action