Skip to content

Instantly share code, notes, and snippets.

@itayavra
Last active June 4, 2025 22:40
Show Gist options
  • Select an option

  • Save itayavra/0439859f8d5f90b440dd3672efd29a6b to your computer and use it in GitHub Desktop.

Select an option

Save itayavra/0439859f8d5f90b440dd3672efd29a6b to your computer and use it in GitHub Desktop.
blueprint:
name: ZHA - Tuya button (TS0041)
description: Automate your Tuya button (TS0041).
domain: automation
input:
tuya_button:
name: Target Tuya button device
selector:
device:
integration: zha
model: TS0041
short_press:
name: Short (single) press
description: Actions to perform on a short press.
default: []
selector:
action: {}
double_press:
name: Double press
description: Actions to perform on a double press.
default: []
selector:
action: {}
long_press:
name: Long press
description: Actions to perform on a long press.
default: []
selector:
action: {}
mode: restart
trigger:
- platform: device
device_id: !input tuya_button
domain: zha
type: remote_button_short_press
subtype: button_1
id: "short_press_trigger"
domain: zha
- platform: device
device_id: !input tuya_button
domain: zha
type: remote_button_double_press
subtype: button_1
id: "double_press_trigger"
- platform: device
device_id: !input tuya_button
domain: zha
type: remote_button_long_press
subtype: button_1
id: "long_press_trigger"
action:
- choose:
- conditions: "{{ trigger.id == 'short_press_trigger' }}"
sequence: !input short_press
- conditions: "{{ trigger.id == 'double_press_trigger' }}"
sequence: !input double_press
- conditions: "{{ trigger.id == 'long_press_trigger' }}"
sequence: !input long_press
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment