I wanna share my configuration for the TS0046 but with zigbee2mqtt integration. I had to troubleshoot this one a long while and this is the one that finally worked for me. Hope it helps someone.
blueprint:
name: Zigbee2MQTT - Tuya 6-Button Scene Switch Topics
description: Automate your Tuya 6-Button Scene Switch via Zigbee2MQTT Topics.
domain: automation
input:
switch:
name: Tuya 6-Button Scene Switch
description: Tuya 6-Button Scene Switch to use
selector:
entity:
integration: mqtt
domain:
- sensor
multiple: false
button_one_short_press:
name: Single Press - Button 1
description: Action to run on button 1 (upper-left) single press
default: []
selector:
action: null
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 (middle-left) single press
default: []
selector:
action: {}
button_three_double_press:
name: Double Press - Button 3
description: Action to run on button 3 (middle-left) double press
default: []
selector:
action: {}
button_three_long_press:
name: Long Press - Button 3
description: Action to run on button 3 (middle-left) long press
default: []
selector:
action: {}
button_four_short_press:
name: Single Press - Button 4
description: Action to run on button 4 (middle-right) single press
default: []
selector:
action: {}
button_four_double_press:
name: Double Press - Button 4
description: Action to run on button 4 (middle-right) double press
default: []
selector:
action: {}
button_four_long_press:
name: Long Press - Button 4
description: Action to run on button 4 (middle-right) long press
default: []
selector:
action: {}
button_five_short_press:
name: Single Press - Button 5
description: Action to run on button 5 (lower-left) single press
default: []
selector:
action: {}
button_five_double_press:
name: Double Press - Button 5
description: Action to run on button 5 (lower-left) double press
default: []
selector:
action: {}
button_five_long_press:
name: Long Press - Button 5
description: Action to run on button 5 (lower-left) long press
default: []
selector:
action: {}
button_six_short_press:
name: Single Press - Button 6
description: Action to run on button 6 (lower-right) single press
default: []
selector:
action: {}
button_six_double_press:
name: Double Press - Button 6
description: Action to run on button 6 (lower-right) double press
default: []
selector:
action: {}
button_six_long_press:
name: Long Press - Button 6
description: Action to run on button 6 (lower-right) long press
default: []
selector:
action: {}
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 == '3_single' }}"
sequence: !input button_three_short_press
- conditions:
- "{{ command == '4_single' }}"
sequence: !input button_four_short_press
- conditions:
- "{{ command == '5_single' }}"
sequence: !input button_five_short_press
- conditions:
- "{{ command == '6_single' }}"
sequence: !input button_six_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 == '5_double' }}"
sequence: !input button_five_double_press
- conditions:
- "{{ command == '6_double' }}"
sequence: !input button_six_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
- conditions:
- "{{ command == '5_hold' }}"
sequence: !input button_five_long_press
- conditions:
- "{{ command == '6_hold' }}"
sequence: !input button_six_long_press
thanks for your blueprint - worked perfectly for me. attached please find my version for the TS0046 now also integrating commands for long press of all six buttons.
(ir’s my first-ever sharing of a blueprint, I hope I’ve done everything right…)
blueprint:
name: ZHA - Tuya TS0046 6 button remote
description: Automate your Tuya TS0046 6 button remote using ZHA events.
domain: automation
input:
tuya_ts0046:
name: Tuya TS0046 6 button remote
description: Tuya TS0046 6 button remote to use
selector:
device:
integration: zha
manufacturer: _TZ3000_iszegwpd
model: TS0046
multiple: false
button_one_single_press:
name: Button 1 (single press)
description: Action to run on button 1 single press
default: []
selector:
action: {}
button_one_double_press:
name: Button 1 (double press)
description: Action to run on button 1 double press
default: []
selector:
action: {}
button_one_long_press:
name: Button 1 (long press)
description: Action to run on button 1 long press
default: []
selector:
action: {}
button_two_single_press:
name: Button 2 (single press)
description: Action to run on button 2 single press
default: []
selector:
action: {}
button_two_double_press:
name: Button 2 (double press)
description: Action to run on button 2 double press
default: []
selector:
action: {}
button_two_long_press:
name: Button 2 (long press)
description: Action to run on button 2 long press
default: []
selector:
action: {}
button_three_single_press:
name: Button 3 (single press)
description: Action to run on button 3 single press
default: []
selector:
action: {}
button_three_double_press:
name: Button 3 (double press)
description: Action to run on button 3 double press
default: []
selector:
action: {}
button_three_long_press:
name: Button 3 (long press)
description: Action to run on button 3 long press
default: []
selector:
action: {}
button_four_single_press:
name: Button 4 (single press)
description: Action to run on button 4 single press
default: []
selector:
action: {}
button_four_double_press:
name: Button 4 (double press)
description: Action to run on button 4 double press
default: []
selector:
action: {}
button_four_long_press:
name: Button 4 (long press)
description: Action to run on button 4 long press
default: []
selector:
action: {}
button_five_single_press:
name: Button 5 (single press)
description: Action to run on button 5 single press
default: []
selector:
action: {}
button_five_double_press:
name: Button 5 (double press)
description: Action to run on button 5 double press
default: []
selector:
action: {}
button_five_long_press:
name: Button 5 (long press)
description: Action to run on button 5 long press
default: []
selector:
action: {}
button_six_single_press:
name: Button 6 (single press)
description: Action to run on button 6 single press
default: []
selector:
action: {}
button_six_double_press:
name: Button 6 (double press)
description: Action to run on button 6 double press
default: []
selector:
action: {}
button_six_long_press:
name: Button 6 (long press)
description: Action to run on button 6 long press
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zha-tuya-ts0043-3-button-remote/260589
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input tuya_ts0046
action:
- variables:
command: '{{ trigger.event.data.command }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
- choose:
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 1 }}'
sequence: !input button_one_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 1 }}'
sequence: !input button_one_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 1 }}'
sequence: !input button_one_long_press
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 2 }}'
sequence: !input button_two_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 2 }}'
sequence: !input button_two_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 2 }}'
sequence: !input button_two_long_press
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 3 }}'
sequence: !input button_three_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 3 }}'
sequence: !input button_three_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 3 }}'
sequence: !input button_three_long_press
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 4 }}'
sequence: !input button_four_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 4 }}'
sequence: !input button_four_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 4 }}'
sequence: !input button_four_long_press
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 5 }}'
sequence: !input button_five_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 5 }}'
sequence: !input button_five_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 5 }}'
sequence: !input button_five_long_press
- conditions:
- '{{ command == ''remote_button_short_press'' and endpoint_id == 6 }}'
sequence: !input button_six_single_press
- conditions:
- '{{ command == ''remote_button_double_press'' and endpoint_id == 6 }}'
sequence: !input button_six_double_press
- conditions:
- '{{ command == ''remote_button_long_press'' and endpoint_id == 6 }}'
sequence: !input button_six_long_press```