Skip to content

Instantly share code, notes, and snippets.

@KevinPy
Created May 11, 2025 15:58
Show Gist options
  • Select an option

  • Save KevinPy/876c80da586b4d965999bc72b3212554 to your computer and use it in GitHub Desktop.

Select an option

Save KevinPy/876c80da586b4d965999bc72b3212554 to your computer and use it in GitHub Desktop.
Zigbee2MQTT - Tuya 2-Button Scene Switch Push_LO
blueprint:
name: Zigbee2MQTT - Tuya 2-Button Scene Switch Push_LO
description: Automate your Tuya 2-Button Scene Switch (Push_LO) via Zigbee2MQTT.
domain: automation
input:
switch:
name: Push_LO Switch
description: Tuya 2-Button Scene Switch to use
selector:
entity:
domain: sensor
integration: mqtt
button_one_short_press:
name: Single Press - Button 1
description: Action to run on button 1 (left) single press
default: []
selector:
action: null
button_one_hold:
name: Hold - Button 1
description: Action to run on button 1 (left) single press
default: []
selector:
action: null
button_one_double_press:
name: Double Press - Button 1
description: Action to run on button 1 (left) single press
default: []
selector:
action: null
button_two_hold:
name: Hold - Button 2
description: Action to run on button 2 (right) single press
default: []
selector:
action: null
button_two_double_press:
name: Double Press - Button 2
description: Action to run on button 2 (right) single press
default: []
selector:
action: null
button_two_short_press:
name: Single Press - Button 2
description: Action to run on button 2 (lower-right) single press
default: []
selector:
action: null
source_url: https://gist.github.com/KevinPy/876c80da586b4d965999bc72b3212554
mode: single
max_exceeded: silent
variables:
command: "{{ trigger.payload }}"
topic: "{{ trigger.topic }}"
switch_name: !input "switch"
deviceName: "{{ state_attr(switch_name, 'friendly_name') }}"
trigger:
- platform: mqtt
topic: zigbee2mqtt/+/action
action:
- choose:
- conditions:
- "{{ topic.split('/')[1].replace('/', '') == deviceName.split(' ')[0]
}}"
sequence:
- choose:
- conditions:
- "{{ command == '1_single' }}"
sequence: !input "button_one_short_press"
- conditions:
- "{{ command == '2_single' }}"
sequence: !input "button_two_short_press"
- conditions:
- "{{ command == '1_double' }}"
sequence: !input "button_one_double_press"
- conditions:
- "{{ command == '2_double' }}"
sequence: !input "button_two_double_press"
- conditions:
- "{{ command == '1_hold' }}"
sequence: !input "button_one_hold"
- conditions:
- "{{ command == '2_hold' }}"
sequence: !input "button_two_hold"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment