Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pepitooo/a9d389c5e3b42c053460efb284d8f21e to your computer and use it in GitHub Desktop.
Save pepitooo/a9d389c5e3b42c053460efb284d8f21e to your computer and use it in GitHub Desktop.
Zigbee2MQTT - Tuya 6-Button Scene Switch
blueprint:
name: Zigbee2MQTT - Tuya 6-Button Scene Switch
description: Automate your Tuya 6-Button Scene Switch via Zigbee2MQTT.
domain: automation
input:
remote_device:
name: Tuya 6-Button Scene Switch
description: Tuya 6-Button Scene Switch to use
default: ''
selector:
device:
filter:
- integration: mqtt
manufacturer: Tuya
model: Wireless switch with 6 buttons
multiple: false
action_button_1_short_press:
name: Single Press - Button 1
description: Action to run on button 1 single press
default: []
selector:
action: {}
action_button_1_double_press:
name: Double Press - Button 1
description: Action to run on button 1 double press
default: []
selector:
action: {}
action_button_1_long_press:
name: Long Press - Button 1
description: Action to run on button 1 long press
default: []
selector:
action: {}
action_button_2_short_press:
name: Single Press - Button 2
description: Action to run on button 2 single press
default: []
selector:
action: {}
action_button_2_double_press:
name: Double Press - Button 2
description: Action to run on button 2 double press
default: []
selector:
action: {}
action_button_2_long_press:
name: Long Press - Button 2
description: Action to run on button 2 long press
default: []
selector:
action: {}
action_button_3_short_press:
name: Single Press - Button 3
description: Action to run on button 3 single press
default: []
selector:
action: {}
action_button_3_double_press:
name: Double Press - Button 3
description: Action to run on button 3 double press
default: []
selector:
action: {}
action_button_3_long_press:
name: Long Press - Button 3
description: Action to run on button 3 long press
default: []
selector:
action: {}
action_button_4_short_press:
name: Single Press - Button 4
description: Action to run on button 4 single press
default: []
selector:
action: {}
action_button_4_double_press:
name: Double Press - Button 4
description: Action to run on button 4 double press
default: []
selector:
action: {}
action_button_4_long_press:
name: Long Press - Button 4
description: Action to run on button 4 long press
default: []
selector:
action: {}
action_button_5_short_press:
name: Single Press - Button 5
description: Action to run on button 5 single press
default: []
selector:
action: {}
action_button_5_double_press:
name: Double Press - Button 5
description: Action to run on button 5 double press
default: []
selector:
action: {}
action_button_5_long_press:
name: Long Press - Button 5
description: Action to run on button 5 long press
default: []
selector:
action: {}
action_button_6_short_press:
name: Single Press - Button 6
description: Action to run on button 6 single press
default: []
selector:
action: {}
action_button_6_double_press:
name: Double Press - Button 6
description: Action to run on button 6 double press
default: []
selector:
action: {}
action_button_6_long_press:
name: Long Press - Button 6
description: Action to run on button 6 long press
default: []
selector:
action: {}
source_url: https://gist.githubusercontent.com/pepitooo/8f2c125b14d2368385271c3f9ba269f7/raw/zigbee2mqtt-tuya-4-button-scene-switch-ts0046.yaml
mode: single
triggers:
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 1_single
id: button_1_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 1_double
id: button_1_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 1_hold
id: button_1_long_press
trigger: device
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 2_single
id: button_2_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 2_double
id: button_2_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 2_hold
id: button_2_long_press
trigger: device
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 3_single
id: button_3_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 3_double
id: button_3_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 3_hold
id: button_3_long_press
trigger: device
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 4_single
id: button_4_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 4_double
id: button_4_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 4_hold
id: button_4_long_press
trigger: device
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 5_single
id: button_5_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 5_double
id: button_5_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 5_hold
id: button_5_long_press
trigger: device
- domain: mqtt
device_id: !input remote_device
type: action
trigger: device
subtype: 6_single
id: button_6_short_press
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 6_double
id: button_6_double_press
trigger: device
- domain: mqtt
type: action
device_id: !input remote_device
subtype: 6_hold
id: button_6_long_press
trigger: device
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- button_1_short_press
sequence: !input action_button_1_short_press
- conditions:
- condition: trigger
id:
- button_1_double_press
sequence: !input action_button_1_double_press
- conditions:
- condition: trigger
id:
- button_1_long_press
sequence: !input action_button_1_long_press
- conditions:
- condition: trigger
id:
- button_2_short_press
sequence: !input action_button_2_short_press
- conditions:
- condition: trigger
id:
- button_2_double_press
sequence: !input action_button_2_double_press
- conditions:
- condition: trigger
id:
- button_2_long_press
sequence: !input action_button_2_long_press
- conditions:
- condition: trigger
id:
- button_3_short_press
sequence: !input action_button_3_short_press
- conditions:
- condition: trigger
id:
- button_3_double_press
sequence: !input action_button_3_double_press
- conditions:
- condition: trigger
id:
- button_3_long_press
sequence: !input action_button_3_long_press
- conditions:
- condition: trigger
id:
- button_4_short_press
sequence: !input action_button_4_short_press
- conditions:
- condition: trigger
id:
- button_4_double_press
sequence: !input action_button_4_double_press
- conditions:
- condition: trigger
id:
- button_4_long_press
sequence: !input action_button_4_long_press
- conditions:
- condition: trigger
id:
- button_5_short_press
sequence: !input action_button_5_short_press
- conditions:
- condition: trigger
id:
- button_5_double_press
sequence: !input action_button_5_double_press
- conditions:
- condition: trigger
id:
- button_5_long_press
sequence: !input action_button_5_long_press
- conditions:
- condition: trigger
id:
- button_6_short_press
sequence: !input action_button_6_short_press
- conditions:
- condition: trigger
id:
- button_6_double_press
sequence: !input action_button_6_double_press
- conditions:
- condition: trigger
id:
- button_6_long_press
sequence: !input action_button_6_long_press
@pepitooo
Copy link
Author

pepitooo commented May 4, 2025

Works with zigbee2mqtt using MQTT device trigger (recommended)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment