Originally looked at this automation, but it only supported buttons setup using ZHA, not Z2M. So here we are! This blueprint gives you an automation template to select any* button exposed as an event entity with an event_type attribute. Theoretically works outside of Z2M as well, but I haven’t been able to test other buttons that work in a similar fashion.
As stated on the aforementioned blueprint post, “this blueprint fires from the single , double , and hold events”. Here’s the yaml for your perusal:
blueprint:
name: Third Reality Button - Multi-Action
description: >
Trigger three configurable actions from a single button entity based on
single press, double press, and hold event types. Originally designed for
Third Reality button model 3RSB22BZ set up in Zigbee2MQTT.
Should work for buttons exposing event entities with event_type attributes.
domain: automation
input:
button_entity:
name: Button Entity
description: The event entity for your button.
selector:
entity:
domain: event
action_single:
name: Single Press Action
description: Action(s) to run when the button is pressed once.
default: []
selector:
action: {}
action_double:
name: Double Press Action
description: Action(s) to run when the button is pressed twice.
default: []
selector:
action: {}
action_hold:
name: Hold Action
description: Action(s) to run when the button is held down.
default: []
selector:
action: {}
mode: single
triggers:
- trigger: state
entity_id: !input button_entity
from: null
conditions: []
actions:
- choose:
- conditions:
- condition: state
entity_id: !input button_entity
attribute: event_type
state: single
sequence: !input action_single
- conditions:
- condition: state
entity_id: !input button_entity
attribute: event_type
state: double
sequence: !input action_double
- conditions:
- condition: state
entity_id: !input button_entity
attribute: event_type
state: hold
sequence: !input action_hold
Hope this works for other buttons out there! Open to suggestions so feel free to scream at me below. ![]()
*: only tested and verified with the above listed button configured via Zigbee2MQTT