Skip to content

Instantly share code, notes, and snippets.

@tjd-dev
Last active September 28, 2022 15:16
Show Gist options
  • Select an option

  • Save tjd-dev/5a6225684e8e63abc975477b1aaeb708 to your computer and use it in GitHub Desktop.

Select an option

Save tjd-dev/5a6225684e8e63abc975477b1aaeb708 to your computer and use it in GitHub Desktop.

Revisions

  1. Tim Dolan revised this gist Sep 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 4ButtonTuya.yaml
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ blueprint:
    selector:
    device:
    integration: zha
    manufacturer: _TZ3000_vp6clf9d
    manufacturer: _TZ3000_wkai4ga5
    model: TS0044
    button_one_short_press:
    name: Single Press
  2. Tim Dolan renamed this gist Sep 28, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. Tim Dolan created this gist Sep 28, 2022.
    130 changes: 130 additions & 0 deletions 4ButtonTuya.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,130 @@
    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
    manufacturer: _TZ3000_vp6clf9d
    model: TS0044
    button_one_short_press:
    name: Single Press
    description: Action to run on button 1 (lower-left) single press
    default: []
    selector:
    action: {}
    button_one_double_press:
    name: Double Press
    description: Action to run on button 1 (lower-left) double press
    default: []
    selector:
    action: {}
    button_one_long_press:
    name: Long Press
    description: Action to run on button 1 (lower-left) long 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_two_double_press:
    name: Double Press
    description: Action to run on button 2 (lower-right) double press
    default: []
    selector:
    action: {}
    button_two_long_press:
    name: Long Press
    description: Action to run on button 2 (lower-right) long 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_three_double_press:
    name: Double Press
    description: Action to run on button 3 (upper-right) double press
    default: []
    selector:
    action: {}
    button_three_long_press:
    name: Long Press
    description: Action to run on button 3 (upper-right) long 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: {}
    button_four_double_press:
    name: Double Press
    description: Action to run on button 4 (upper-left) double press
    default: []
    selector:
    action: {}
    button_four_long_press:
    name: Long Press
    description: Action to run on button 4 (upper-left) long 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 }}'
    endpoint_id: '{{ trigger.event.data.endpoint_id }}'
    - choose:
    - conditions: "{{ command == 'remote_button_short_press' }}"
    sequence:
    - choose:
    - conditions: '{{ endpoint_id == 1 }}'
    sequence: !input 'button_one_short_press'
    - conditions: '{{ endpoint_id == 2 }}'
    sequence: !input 'button_two_short_press'
    - conditions: '{{ endpoint_id == 3 }}'
    sequence: !input 'button_three_short_press'
    - conditions: '{{ endpoint_id == 4 }}'
    sequence: !input 'button_four_short_press'
    - conditions: "{{ command == 'remote_button_double_press' }}"
    sequence:
    - choose:
    - conditions: '{{ endpoint_id == 1 }}'
    sequence: !input 'button_one_double_press'
    - conditions: '{{ endpoint_id == 2 }}'
    sequence: !input 'button_two_double_press'
    - conditions: '{{ endpoint_id == 3 }}'
    sequence: !input 'button_three_double_press'
    - conditions: '{{ endpoint_id == 4 }}'
    sequence: !input 'button_four_double_press'
    - conditions: "{{ command == 'remote_button_long_press' }}"
    sequence:
    - choose:
    - conditions: '{{ endpoint_id == 1 }}'
    sequence: !input 'button_one_long_press'
    - conditions: '{{ endpoint_id == 2 }}'
    sequence: !input 'button_two_long_press'
    - conditions: '{{ endpoint_id == 3 }}'
    sequence: !input 'button_three_long_press'
    - conditions: '{{ endpoint_id == 4 }}'
    sequence: !input 'button_four_long_press'