Last active
February 20, 2025 10:55
-
-
Save Soulfly999/312df9b907333fbfa848eb09ed7fa0a8 to your computer and use it in GitHub Desktop.
Zigbee2MQTT v 2.0 - Tuya 4-Button Scene Switch blueprint for Homassistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Tuya Zigbee Z2M 4 button remote | |
description: "Blueprint for use with Tuya Zigbee 4 button remote (TS0044_1) on Zigbee2MQTT" | |
domain: automation | |
input: | |
device: # <-- Renamed from "switch" to "device" | |
name: Tuya Zigbee 4 button remote | |
description: Tuya Zigbee 2.x - 4 button remote to use | |
selector: | |
device: | |
integration: mqtt | |
multiple: false # Ensures only one remote is selected | |
button_1_short_press: | |
name: Single Press - Button 1 | |
description: Action to run on button 1 single press | |
default: [] | |
selector: | |
action: {} | |
button_1_double_press: | |
name: Double Press - Button 1 | |
description: Action to run on button 1 double press | |
default: [] | |
selector: | |
action: {} | |
button_1_hold: | |
name: Hold - Button 1 | |
description: Action to run on button 1 long press | |
default: [] | |
selector: | |
action: {} | |
button_2_short_press: | |
name: Single Press - Button 2 | |
description: Action to run on button 2 single press | |
default: [] | |
selector: | |
action: {} | |
button_2_double_press: | |
name: Double Press - Button 2 | |
description: Action to run on button 2 double press | |
default: [] | |
selector: | |
action: {} | |
button_2_hold: | |
name: Hold - Button 2 | |
description: Action to run on button 2 long press | |
default: [] | |
selector: | |
action: {} | |
button_3_short_press: | |
name: Single Press - Button 3 | |
description: Action to run on button 3 single press | |
default: [] | |
selector: | |
action: {} | |
button_3_double_press: | |
name: Double Press - Button 3 | |
description: Action to run on button 3 double press | |
default: [] | |
selector: | |
action: {} | |
button_3_hold: | |
name: Hold - Button 3 | |
description: Action to run on button 3 long press | |
default: [] | |
selector: | |
action: {} | |
button_4_short_press: | |
name: Single Press - Button 4 | |
description: Action to run on button 4 single press | |
default: [] | |
selector: | |
action: {} | |
button_4_double_press: | |
name: Double Press - Button 4 | |
description: Action to run on button 4 double press | |
default: [] | |
selector: | |
action: {} | |
button_4_hold: | |
name: Long Press - Button 4 | |
description: Action to run on button 4 long press | |
default: [] | |
selector: | |
action: {} | |
mode: queued | |
max_exceeded: silent | |
trigger: | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 1_single | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 1_double | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 1_hold | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 2_single | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 2_double | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 2_hold | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 3_single # <-- Added missing trigger | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 3_double # <-- Added missing trigger | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 3_hold | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 4_single | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 4_double | |
- platform: device | |
domain: mqtt | |
device_id: !input device | |
type: action | |
subtype: 4_hold | |
action: | |
- choose: | |
- conditions: "{{ trigger.subtype == '1_single' }}" # <-- Fixed condition | |
sequence: !input button_1_short_press | |
- conditions: "{{ trigger.subtype == '1_double' }}" | |
sequence: !input button_1_double_press | |
- conditions: "{{ trigger.subtype == '1_hold' }}" | |
sequence: !input button_1_hold | |
- conditions: "{{ trigger.subtype == '2_single' }}" | |
sequence: !input button_2_short_press | |
- conditions: "{{ trigger.subtype == '2_double' }}" | |
sequence: !input button_2_double_press | |
- conditions: "{{ trigger.subtype == '2_hold' }}" | |
sequence: !input button_2_hold | |
- conditions: "{{ trigger.subtype == '3_single' }}" | |
sequence: !input button_3_short_press | |
- conditions: "{{ trigger.subtype == '3_double' }}" | |
sequence: !input button_3_double_press | |
- conditions: "{{ trigger.subtype == '3_hold' }}" | |
sequence: !input button_3_hold | |
- conditions: "{{ trigger.subtype == '4_single' }}" | |
sequence: !input button_4_short_press | |
- conditions: "{{ trigger.subtype == '4_double' }}" | |
sequence: !input button_4_double_press | |
- conditions: "{{ trigger.subtype == '4_hold' }}" | |
sequence: !input button_4_hold |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment