Hello,
This is a blueprint for Tuya 4-button switch TS004F edition, for those using ZHA, in oposition to the blueprint proposed by @edememinov for Zigbee2MQTT here (Z2M - TS004F Tuya 4-Gang Switch blueprint).
All credits to @khvej8 who published this blueprint in the comments of the above blueprint for Z2M (https://community.home-assistant.io/t/z2m-ts004f-tuya-4-gang-switch-blueprint/314233/27).
Please note that currently in ZHA, it detect less events than the Z2M version (see the whole discussion here: https://github.com/zigpy/zha-device-handlers/pull/969).
Keep in mind that Iām by no means a TS004F or blueprint specialist. Iām creating this as an attempt to to import it straight as a blueprint.
blueprint:
name: ZHA - Tuya 4-Button Dimmer Switch
description: Automate your Tuya 4-Button Dimmer using ZHA events.
domain: automation
input:
tuya_4button_dimmer_switch:
name: Tuya 4-Button Dimmer Switch
description: Tuya 4-Button Dimmer Switch to use
selector:
device:
integration: zha
manufacturer: _TZ3000_xabckq1v
model: TS004F
button_one_short_press:
name: Single Press On
description: Action to run on button upper-left single press
default: []
selector:
action: {}
button_two_short_press:
name: Single Press Off
description: Action to run on button lower-left single press
default: []
selector:
action: {}
button_three_short_press:
name: Single Press Dim-up
description: Action to run on button upper-right single press
default: []
selector:
action: {}
button_four_short_press:
name: Single Press Dim-down
description: Action to run on button lower-right single press
default: []
selector:
action: {}
button_three_long_press:
name: Long Press Dim-up
description: Action to run on button upper-right long press
default: []
selector:
action: {}
button_four_long_press:
name: Long Press Dim-down
description: Action to run on button lower-right long press
default: []
selector:
action: {}
button_dim_stop:
name: Long Press Dim-down
description: Action to run when end/stop long press
default: []
selector:
action: {}
# source_url:
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'tuya_4button_dimmer_switch'
action:
- variables:
command: '{{ trigger.event.data.command }}'
args: '{{ trigger.event.data.args }}'
- choose:
- conditions: '{{ command == ''on'' }}'
sequence: !input 'button_one_short_press'
- conditions: '{{ command == ''off'' }}'
sequence: !input 'button_two_short_press'
- conditions: '{{ command == ''step'' }}'
sequence:
- choose:
- conditions: '{{ args == [ 0, 51, 10] }}'
sequence: !input 'button_three_short_press'
- conditions: '{{ args == [ 1, 51, 10 ] }}'
sequence: !input 'button_four_short_press'
- conditions: '{{ command == ''move'' }}'
sequence:
- choose:
- conditions: '{{ args == [ 0, 51] }}'
sequence: !input 'button_three_long_press'
- conditions: '{{ args == [ 1, 51 ] }}'
sequence: !input 'button_four_long_press'
- conditions: '{{ command == ''stop'' }}'
sequence: !input 'button_dim_stop'