Skip to content

Instantly share code, notes, and snippets.

@brodock
Last active February 22, 2026 00:07
Show Gist options
  • Select an option

  • Save brodock/bb0afe98695639ac20c691d5e50991c3 to your computer and use it in GitHub Desktop.

Select an option

Save brodock/bb0afe98695639ac20c691d5e50991c3 to your computer and use it in GitHub Desktop.
Trigger custom actions when the Aqara H2 virtual button is pressed via Matter in Home Assistant. Ignores triggers if the button entity's state is unavailable (for example during a restart)
blueprint:
name: Aqara H2 Button Custom Action
description: Trigger custom actions when the Aqara H2 virtual button is pressed via Matter in Home Assistant. Ignores triggers if the button entity's state is unavailable after the change.
domain: automation
homeassistant:
min_version: "2026.2.3"
source_url: https://gist.github.com/brodock/bb0afe98695639ac20c691d5e50991c3
input:
button_event:
name: Button Event Entity
description: The event entity for the button press (e.g., event.corredor_entrada_virtual)
selector:
entity:
integration: matter
domain: event
device_class: button
custom_actions:
name: Custom Actions
description: Actions to perform when the button is pressed
selector:
action: {}
trigger:
- platform: state
entity_id: !input button_event
condition:
condition: and
conditions:
- condition: template
value_template: "{{ trigger.from_state.state != 'unavailable' }}"
- condition: template
value_template: "{{ trigger.to_state.state != 'unavailable' }}"
- condition: template
value_template: "{{ trigger.to_state.attributes.event_type == 'initial_press' }}"
action: !input custom_actions
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment