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/94ea5c40a30b64748b4534bb9858fc61 to your computer and use it in GitHub Desktop.
Save farridav/94ea5c40a30b64748b4534bb9858fc61 to your computer and use it in GitHub Desktop.
simple_scene_switcher.yaml
mode: parallel
max_exceeded: silent
trigger:
- platform: state
entity_id: !input switch
blueprint:
name: Scene Switcher [Simple] (Z2M)
description: Scene switcher [Simple] (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:
name: Button 1
description: Action to run on button 1
default: []
selector:
action: {}
button_two:
name: Button 2
description: Action to run on button 2
default: []
selector:
action: {}
button_three:
name: Button 3
description: Action to run on button 3
default: []
selector:
action: {}
button_four:
name: Button 4
description: Action to run on button 4
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.startswith('1') }}"
sequence: !input button_one
- conditions: "{{ command.startswith('2') }}"
sequence: !input button_two
- conditions: "{{ command.startswith('3') }}"
sequence: !input button_three
- conditions: "{{ command.startswith('4') }}"
sequence: !input button_four
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment