Skip to content

Instantly share code, notes, and snippets.

@farridav
Last active January 8, 2024 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farridav/42a045fad9b15b2e7257cbd2e6ca8b47 to your computer and use it in GitHub Desktop.
Save farridav/42a045fad9b15b2e7257cbd2e6ca8b47 to your computer and use it in GitHub Desktop.
scene switcher
mode: parallel
max_exceeded: silent
trigger:
- platform: state
entity_id: !input switch
blueprint:
name: Scene Switcher [Full] (Z2M)
description: Scene switcher [Full] (Z2M)
domain: automation
input:
switch:
name: Tuya 4-Button Scene Switcher
description: Tuya 4-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 single press
default: []
selector:
action: {}
button_one_long_press:
name: Long Press - Button 1
description: Action to run on button 1 long press
default: []
selector:
action: {}
button_one_double_press:
name: Double Press - Button 1
description: Action to run on button 1 double press
default: []
selector:
action: {}
button_two_short_press:
name: Single Press - Button 2
description: Action to run on button 2 single press
default: []
selector:
action: {}
button_two_long_press:
name: Long Press - Button 2
description: Action to run on button 2 long press
default: []
selector:
action: {}
button_two_double_press:
name: Double Press - Button 2
description: Action to run on button 2 double press
default: []
selector:
action: {}
button_three_short_press:
name: Single Press - Button 3
description: Action to run on button 3 single press
default: []
selector:
action: {}
button_three_long_press:
name: Long Press - Button 3
description: Action to run on button 3 long press
default: []
selector:
action: {}
button_three_double_press:
name: Double Press - Button 3
description: Action to run on button 3 double press
default: []
selector:
action: {}
button_four_short_press:
name: Single Press - Button 4
description: Action to run on button 4 single press
default: []
selector:
action: {}
button_four_long_press:
name: Long Press - Button 4
description: Action to run on button 4 long press
default: []
selector:
action: {}
button_four_double_press:
name: Double Press - Button 4
description: Action to run on button 4 double press
default: []
selector:
action: {}
default_action:
name: default action
description: default action
default: []
selector:
action: {}
condition:
- condition: template
value_template: '{{ trigger.from_state.state in ("1_single", "1_double", "1_hold", "2_single", "2_double", "2_hold", "3_single", "3_double", "3_hold", "4_single", "4_double", "4_hold") }}'
action:
- variables:
command: "{{ trigger.from_state.state }}"
- 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 == '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 == '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
default: !input default_action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment