Skip to content

Instantly share code, notes, and snippets.

@beauwilliams
Last active October 26, 2024 13:31
Show Gist options
  • Select an option

  • Save beauwilliams/5626bab038bbf45e173f02e26335056f to your computer and use it in GitHub Desktop.

Select an option

Save beauwilliams/5626bab038bbf45e173f02e26335056f to your computer and use it in GitHub Desktop.

Revisions

  1. beauwilliams revised this gist Jan 4, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tuya-mqtt-ha-blueprint-fixed.yaml
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    blueprint:
    name: Z2M - Tuya 4-Button Scene Switch
    name: Zigbee2MQTT - Tuya 4-Button Scene Switch Fixed
    description: Automate your Tuya 4-Button Scene Switch via Zigbee2MQTT.
    domain: automation
    input:
  2. beauwilliams revised this gist Jan 4, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tuya-mqtt-ha-blueprint-fixed.yaml
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    blueprint:
    name: Zigbee2MQTT - Tuya 4-Button Scene Switch
    name: Z2M - Tuya 4-Button Scene Switch
    description: Automate your Tuya 4-Button Scene Switch via Zigbee2MQTT.
    domain: automation
    input:
  3. beauwilliams revised this gist Jan 4, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tuya-mqtt-ha-blueprint-fixed.yaml
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,7 @@ blueprint:
    selector:
    action: {}
    source_url: https://github.com/AramidX/ha-blueprint/blob/4de1fb2c9fe1d96a58f09c28b1d4a7760e0e9d2b/blueprints/tuya/tuya_4button_scene_switch_z2m.yaml
    mode: restart
    mode: parallel
    max_exceeded: silent
    trigger:
    - platform: state
  4. beauwilliams renamed this gist Oct 27, 2022. 1 changed file with 0 additions and 0 deletions.
  5. beauwilliams created this gist Oct 27, 2022.
    130 changes: 130 additions & 0 deletions Zigbee2MQTT - Tuya 4-Button Scene Switch Blueprint
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,130 @@
    blueprint:
    name: Zigbee2MQTT - Tuya 4-Button Scene Switch
    description: Automate your Tuya 4-Button Scene Switch via Zigbee2MQTT.
    domain: automation
    input:
    switch:
    name: Tuya 4-Button Scene Switch
    description: Tuya 4-Button Scene Switch to use
    selector:
    entity:
    integration: mqtt
    domain: sensor
    button_one_short_press:
    name: Single Press - Button 1
    description: Action to run on button 1 (lower-left) single press
    default: []
    selector:
    action: {}
    button_one_double_press:
    name: Double Press - Button 1
    description: Action to run on button 1 (lower-left) double press
    default: []
    selector:
    action: {}
    button_one_long_press:
    name: Long Press - Button 1
    description: Action to run on button 1 (lower-left) long press
    default: []
    selector:
    action: {}
    button_two_short_press:
    name: Single Press - Button 2
    description: Action to run on button 2 (lower-right) single press
    default: []
    selector:
    action: {}
    button_two_double_press:
    name: Double Press - Button 2
    description: Action to run on button 2 (lower-right) double press
    default: []
    selector:
    action: {}
    button_two_long_press:
    name: Long Press - Button 2
    description: Action to run on button 2 (lower-right) long press
    default: []
    selector:
    action: {}
    button_three_short_press:
    name: Single Press - Button 3
    description: Action to run on button 3 (upper-right) single press
    default: []
    selector:
    action: {}
    button_three_double_press:
    name: Double Press - Button 3
    description: Action to run on button 3 (upper-right) double press
    default: []
    selector:
    action: {}
    button_three_long_press:
    name: Long Press - Button 3
    description: Action to run on button 3 (upper-right) long press
    default: []
    selector:
    action: {}
    button_four_short_press:
    name: Single Press - Button 4
    description: Action to run on button 4 (upper-left) single press
    default: []
    selector:
    action: {}
    button_four_double_press:
    name: Double Press - Button 4
    description: Action to run on button 4 (upper-left) double press
    default: []
    selector:
    action: {}
    button_four_long_press:
    name: Long Press - Button 4
    description: Action to run on button 4 (upper-left) long press
    default: []
    selector:
    action: {}
    source_url: https://github.com/AramidX/ha-blueprint/blob/4de1fb2c9fe1d96a58f09c28b1d4a7760e0e9d2b/blueprints/tuya/tuya_4button_scene_switch_z2m.yaml
    mode: restart
    max_exceeded: silent
    trigger:
    - platform: state
    entity_id: !input "switch"
    action:
    - variables:
    command: "{{ trigger.to_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_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"
    - 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"