Feel free to test and use it
blueprint:
name: Zigbee2MQTT - TS004F
description: Scene Switch TS004F via Zigbee2MQTT.
domain: automation
input:
switch:
name: Tuya 4-Button Scene Switch TS004F
description: Tuya 4-Button Scene Switch to use
selector:
entity:
integration: mqtt
domain: sensor
button_one_single:
name: Single Press - Button 1
description: Action to run on button 1 (top-left) single press
default: []
selector:
action: {}
button_two_single:
name: Single Press - Button 2
description: Action to run on button 2 (top-right) single press
default: []
selector:
action: {}
button_three_single:
name: Single Press - Button 3
description: Action to run on button 3 (bottom-left) single press
default: []
selector:
action: {}
button_four_single:
name: Single Press - Button 4
description: Action to run on button 4 (bottom-left) single press
default: []
selector:
action: {}
button_one_double:
name: Double Press - Button 1
description: Action to run on button 1 (top-left) double press
default: []
selector:
action: {}
button_two_double:
name: Double Press - Button 2
description: Action to run on button 2 (top-right) double press
default: []
selector:
action: {}
button_three_double:
name: Double Press - Button 3
description: Action to run on button 3 (bottom-left) double press
default: []
selector:
action: {}
button_four_double:
name: Double Press - Button 4
description: Action to run on button 4 (bottom-right) double press
default: []
selector:
action: {}
button_one_hold:
name: Hold Press - Button 1
description: Action to run on button 1 (top-left) hold press
default: []
selector:
action: {}
button_two_hold:
name: Hold Press - Button 2
description: Action to run on button 2 (top-right) hold press
default: []
selector:
action: {}
button_three_hold:
name: Hold Press - Button 3
description: Action to run on button 3 (bottom-left) hold press
default: []
selector:
action: {}
button_four_hold:
name: Hold Press - Button 4
description: Action to run on button 4 (bottom-right) hold press
default: []
selector:
action: {}
mode: queued
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'switch'
attribute: action
action:
- variables:
command: '{{ trigger.to_state.state }}'
- choose:
- conditions:
- '{{ command == ''1_single'' }}'
sequence: !input 'button_one_single'
- conditions:
- '{{ command == ''2_single'' }}'
sequence: !input 'button_two_single'
- conditions:
- '{{ command == ''3_single'' }}'
sequence: !input 'button_three_single'
- conditions:
- '{{ command == ''4_single'' }}'
sequence: !input 'button_four_single'
- conditions:
- '{{ command == ''1_double'' }}'
sequence: !input 'button_one_double'
- conditions:
- '{{ command == ''2_double'' }}'
sequence: !input 'button_two_double'
- conditions:
- '{{ command == ''3_double'' }}'
sequence: !input 'button_three_double'
- conditions:
- '{{ command == ''4_double'' }}'
sequence: !input 'button_four_double'
- conditions:
- '{{ command == ''1_hold'' }}'
sequence: !input 'button_one_hold'
- conditions:
- '{{ command == ''2_hold'' }}'
sequence: !input 'button_two_hold'
- conditions:
- '{{ command == ''3_hold'' }}'
sequence: !input 'button_three_hold'
- conditions:
- '{{ command == ''4_hold'' }}'
sequence: !input 'button_four_hold'