Hi all,
This is my 1st post.
I just would like to say, I read yesterday and applied the blueprint well.
However, it seems it is quite more simple to configure and use the swith recently.
This morning, I upgraded to HA 2022.4.3 and try to reconfigure the switch from scratch.
I removed the python file ts004f.py
, started a new configuration and I think I have a good functionning without the python file, the blueprint and with the new version of HA.
How I have proceeded :
- Do the normal procedure in order to pair the switch in HA (3rd butonn maintained during 10s),
- In automation for that switch, many more triggers are available with that version of HA, example <Button “2nd button” is clicked"> (my HA is in french language so maybe it is not exactly that expression),
→ but, anyway, the automation does not work… only previous available triggers (dimmer, …). - Change the configuration of the switch : maintain the 2nd (top right) and 4th (bottom right) buttons together during several seconds until the 3rd button blinks
→ the behavior of the switch is changed and is now similar to the TS0044
→ the automation works now for the 12th configurations (4 buttons, 1-click, 2-click, long-press).
Proposed blueprint: zha-ts004f-tuya-4-button-blueprint.yaml
blueprint:
name: ZHA - Tuya 4-Button Switch
description: Automate your Tuya 4-Button Switch using ZHA events.
domain: automation
input:
tuya_4button_switch:
name: Tuya 4-Button Switch
description: Tuya 4-Button Switch to use
selector:
device:
integration: zha
manufacturer: _TZ3000_xabckq1v
model: TS004F
button_1_click:
name: Button 1 click
description: Action to run on button upper-left single press
default: []
selector:
action: {}
button_1_double_click:
name: Button 1 double-click
description: Action to run on button upper-left double press
default: []
selector:
action: {}
button_1_long_press:
name: Button 1 long press
description: Action to run on button upper-left long press
default: []
selector:
action: {}
button_2_click:
name: Button 2 click
description: Action to run on button upper-right single press
default: []
selector:
action: {}
button_2_double_click:
name: Button 2 double-click
description: Action to run on button upper-right double press
default: []
selector:
action: {}
button_2_long_press:
name: Button 2 long press
description: Action to run on button upper-right long press
default: []
selector:
action: {}
button_3_click:
name: Button 3 click
description: Action to run on button lower-left single press
default: []
selector:
action: {}
button_3_double_click:
name: Button 3 double-click
description: Action to run on button lower-right double press
default: []
selector:
action: {}
button_3_long_press:
name: Button 3 long press
description: Action to run on button lower-left long press
default: []
selector:
action: {}
button_4_click:
name: Button 4 click
description: Action to run on button lower-right single press
default: []
selector:
action: {}
button_4_double_click:
name: Button 4 double-click
description: Action to run on button lower-right double press
default: []
selector:
action: {}
button_4_long_press:
name: Long Press Dim-down
description: Action to run on button lower-right long press
default: []
selector:
action: {}
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'tuya_4button_switch'
action:
- variables:
command: '{{ trigger.event.data.command }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
- choose:
- conditions: '{{ false }}'
sequence:
- service: notify.persistent_notification
data:
message: '{{ endpoint_id }}'
title: '{{ command }}'
- conditions: '{{ command == ''remote_button_short_press'' }}'
sequence:
- choose:
- conditions: '{{ endpoint_id == 1 }}'
sequence: !input 'button_1_click'
- conditions: '{{ endpoint_id == 2 }}'
sequence: !input 'button_2_click'
- conditions: '{{ endpoint_id == 3 }}'
sequence: !input 'button_3_click'
- conditions: '{{ endpoint_id == 4 }}'
sequence: !input 'button_4_click'
- conditions: '{{ command == ''remote_button_double_press'' }}'
sequence:
- choose:
- conditions: '{{ endpoint_id == 1 }}'
sequence: !input 'button_1_double_click'
- conditions: '{{ endpoint_id == 2 }}'
sequence: !input 'button_2_double_click'
- conditions: '{{ endpoint_id == 3 }}'
sequence: !input 'button_3_double_click'
- conditions: '{{ endpoint_id == 4 }}'
sequence: !input 'button_4_double_click'
- conditions: '{{ command == ''remote_button_long_press'' }}'
sequence:
- choose:
- conditions: '{{ endpoint_id == 1 }}'
sequence: !input 'button_1_long_press'
- conditions: '{{ endpoint_id == 2 }}'
sequence: !input 'button_2_long_press'
- conditions: '{{ endpoint_id == 3 }}'
sequence: !input 'button_3_long_press'
- conditions: '{{ endpoint_id == 4 }}'
sequence: !input 'button_4_long_press'