Skip to content

Instantly share code, notes, and snippets.

@herrfrei
Forked from fr3nd/TS0041.yaml
Last active May 22, 2025 08:47
Show Gist options
  • Save herrfrei/db40a6f4ccd99158354d83f0c9c3fb36 to your computer and use it in GitHub Desktop.
Save herrfrei/db40a6f4ccd99158354d83f0c9c3fb36 to your computer and use it in GitHub Desktop.
Zigbee2MQTT Event - 1-button Scene Switch
blueprint:
name: Zigbee2MQTT Event - 1-Button Switch
description: Automate your 1-Button Switch via Zigbee2MQTT 2.0.
domain: automation
input:
switch:
name: 1-Button Switch
description: 1-Button Switch to use
selector:
entity:
integration: mqtt
domain:
- event
multiple: false
button_one_short_press:
name: Single Press - Button
description: Action to run on button single press
default: []
selector:
action: {}
button_one_double_press:
name: Double Press - Button
description: Action to run on button double press
default: []
selector:
action: {}
button_one_long_press:
name: Long Press - Button
description: Action to run on button long press
default: []
selector:
action: {}
source_url: https://gist.github.com/herrfrei/db40a6f4ccd99158354d83f0c9c3fb36
mode: queued
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input switch
not_from: unavailable
not_to:
- unavailable
- unknown
# Do not put any To or From or Attribute lines in trigger.
# If you do, you cannot push same button twice. Very important
action:
- variables:
command: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- conditions:
- '{{ command == ''single'' }}'
sequence: !input button_one_short_press
- conditions:
- '{{ command == ''double'' }}'
sequence: !input button_one_double_press
- conditions:
- '{{ command == ''hold'' }}'
sequence: !input button_one_long_press
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment