10der
(Oleg Denisenko)
1
blueprint:
name: Zigbee2MQTT - Tuya 4-Button Scene Switch Fixed (2025.1.0)
description: Automate your Tuya 4-Button Scene Switch
domain: automation
input:
tuya_device:
name: Tuya 4-Button Scene Switch
description: Tuya 4-Button Scene Switch to use
selector:
device:
integration: mqtt
manufacturer: Tuya
model: Wireless switch with 4 buttons
button_one_short_press:
name: Single Press - Button 1
description: Action to run on button 1 (upper-left) single press
default: []
selector:
action: {}
button_one_double_press:
name: Double Press - Button 1
description: Action to run on button 1 (upper-left) double press
default: []
selector:
action: {}
button_one_long_press:
name: Long Press - Button 1
description: Action to run on button 1 (upper-left) long press
default: []
selector:
action: {}
button_two_short_press:
name: Single Press - Button 2
description: Action to run on button 2 (upper-right) single press
default: []
selector:
action: {}
button_two_double_press:
name: Double Press - Button 2
description: Action to run on button 2 (upper-right) double press
default: []
selector:
action: {}
button_two_long_press:
name: Long Press - Button 2
description: Action to run on button 2 (upper-right) long press
default: []
selector:
action: {}
button_three_short_press:
name: Single Press - Button 3
description: Action to run on button 3 (lower-right) single press
default: []
selector:
action: {}
button_three_double_press:
name: Double Press - Button 3
description: Action to run on button 3 (lower-right) double press
default: []
selector:
action: {}
button_three_long_press:
name: Long Press - Button 3
description: Action to run on button 3 (lower-right) long press
default: []
selector:
action: {}
button_four_short_press:
name: Single Press - Button 4
description: Action to run on button 4 (lower-left) single press
default: []
selector:
action: {}
button_four_double_press:
name: Double Press - Button 4
description: Action to run on button 4 (lower-left) double press
default: []
selector:
action: {}
button_four_long_press:
name: Long Press - Button 4
description: Action to run on button 4 (lower-left) long press
default: []
selector:
action: {}
mode: parallel
max_exceeded: silent
trigger:
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 1_single
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 2_single
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 3_single
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 4_single
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 1_double
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 2_double
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 3_double
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 4_double
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 1_hold
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 2_hold
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 3_hold
trigger: device
- domain: mqtt
device_id: !input tuya_device
type: action
subtype: 4_hold
trigger: device
action:
- variables:
command: "{{ trigger.payload }}"
- choose:
- conditions:
- "{{ command == '1_single' }}"
sequence: !input "button_one_short_press"
- conditions:
- "{{ command == '2_single' }}"
sequence: !input "button_two_short_press"
- conditions:
- "{{ command == '3_single' }}"
sequence: !input "button_three_short_press"
- conditions:
- "{{ command == '4_single' }}"
sequence: !input "button_four_short_press"
- conditions:
- "{{ command == '1_double' }}"
sequence: !input "button_one_double_press"
- conditions:
- "{{ command == '2_double' }}"
sequence: !input "button_two_double_press"
- conditions:
- "{{ command == '3_double' }}"
sequence: !input "button_three_double_press"
- conditions:
- "{{ command == '4_double' }}"
sequence: !input "button_four_double_press"
- conditions:
- "{{ command == '1_hold' }}"
sequence: !input "button_one_long_press"
- conditions:
- "{{ command == '2_hold' }}"
sequence: !input "button_two_long_press"
- conditions:
- "{{ command == '3_hold' }}"
sequence: !input "button_three_long_press"
- conditions:
- "{{ command == '4_hold' }}"
sequence: !input "button_four_long_press"