Skip to content

Instantly share code, notes, and snippets.

@qreeves
Created August 28, 2023 08:51
Show Gist options
  • Select an option

  • Save qreeves/44e5e23864c0f66de7c048a6457cc09d to your computer and use it in GitHub Desktop.

Select an option

Save qreeves/44e5e23864c0f66de7c048a6457cc09d to your computer and use it in GitHub Desktop.

Revisions

  1. qreeves created this gist Aug 28, 2023.
    82 changes: 82 additions & 0 deletions TZ3000_kt7obmnn.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,82 @@
    blueprint:
    name: Tuya 2-Button Scene Switch (TZ3000_kt7obmnn)
    description: Automate your Tuya 2-Button Scene Switch using ZHA events.
    domain: automation
    input:
    tuya_2button_scene_switch:
    name: Tuya 2-Button Scene Switch
    description: Tuya 2-Button Scene Switch to use
    selector:
    device:
    integration: zha
    manufacturer: _TZ3000_kt7obmnn
    model: TS0042
    button_one_short_press:
    name: Single Press
    description: Action to run on button 1 (left) single press
    default: []
    selector:
    action: {}
    button_one_double_press:
    name: Double Press
    description: Action to run on button 1 left) double press
    default: []
    selector:
    action: {}
    button_one_long_press:
    name: Long Press
    description: Action to run on button 1 (left) long press
    default: []
    selector:
    action: {}
    button_two_short_press:
    name: Single Press
    description: Action to run on button 2 (right) single press
    default: []
    selector:
    action: {}
    button_two_double_press:
    name: Double Press
    description: Action to run on button 2 (right) double press
    default: []
    selector:
    action: {}
    button_two_long_press:
    name: Long Press
    description: Action to run on button 2 (right) long press
    default: []
    selector:
    action: {}
    mode: restart
    max_exceeded: silent
    trigger:
    - platform: event
    event_type: zha_event
    event_data:
    device_id: !input 'tuya_2button_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: "{{ 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: "{{ 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'