Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sesh/85770f4008004a8482cc854b1b3b6194 to your computer and use it in GitHub Desktop.

Select an option

Save sesh/85770f4008004a8482cc854b1b3b6194 to your computer and use it in GitHub Desktop.
ZHA - Tuya 4-button Scene Switch (TS004f)
blueprint:
name: ZHA - Tuya 4-Button Scene Switch
description: Automate your Tuya 4-Button Scene Switch using ZHA events
domain: automation
input:
tuya_4button_scene_switch:
name: Tuya 4-Button Scene Switch
description: Tuya 4-Button Scene Switch to use
selector:
device:
integration: zha
model: TS004F
button_one_short_press:
name: Single Press
description: Action to run on button 1 (lower-left) single press
default: []
selector:
action: {}
button_two_short_press:
name: Single Press
description: Action to run on button 2 (lower-right) single press
default: []
selector:
action: {}
button_three_short_press:
name: Single Press
description: Action to run on button 3 (upper-right) single press
default: []
selector:
action: {}
button_four_short_press:
name: Single Press
description: Action to run on button 4 (upper-left) single press
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'tuya_4button_scene_switch'
action:
- variables:
command: '{{ trigger.event.data.command }}'
step_mode: '{{ trigger.event.data.params.step_mode }}'
- choose:
- conditions: '{{ command == ''on'' }}'
sequence: !input 'button_one_short_press'
- conditions: '{{ command == ''off'' }}'
sequence: !input 'button_two_short_press'
- conditions: '{{ command == ''step'' and step_mode == ''StepMode.Up'' }}'
sequence: !input 'button_three_short_press'
- conditions: '{{ command == ''step'' and step_mode == ''StepMode.Down'' }}'
sequence: !input 'button_four_short_press'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment