Zigbee2MQTT - LoraTap (Tuya) 6-Button Scene Switch

Blueprint for LoraTap (Tuya) 6-Button Scene Switch (Zigbee2MQTT)

For the 6 button version: https://nl.aliexpress.com/item/1005004988714663.html?spm=a2g0o.order_list.order_list_main.10.258f79d2W3QAbR&gatewayAdapt=glo2nld

3 options per button (short, double, long (5 sec))

blueprint:
  name: Zigbee2MQTT - LoraTap (Tuya) 6-Button Scene Switch
  description: Automate your LoraTap (Tuya) 6-Button Scene Switch via Zigbee2MQTT.
  domain: automation
  input:
    switch:
      name: LoraTap (Tuya) 6-Button Scene Switch
      description: LoraTap (Tuya) 6-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 (upper-left) single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 (upper-left) double press
      default: []
      selector:
        action: {}
    button_one_long_press:
      name: Long Press - Button 1
      description: Action to run on button 1 (upper-left) long press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 (upper-right) single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 (upper-right) double press
      default: []
      selector:
        action: {}
    button_two_long_press:
      name: Long Press - Button 2
      description: Action to run on button 2 (upper-right) long press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 (middle-left) single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 (middle-left) double press
      default: []
      selector:
        action: {}
    button_three_long_press:
      name: Long Press - Button 3
      description: Action to run on button 3 (middle-left) long press
      default: []
      selector:
        action: {}
    button_four_short_press:
      name: Single Press - Button 4
      description: Action to run on button 4 (middle-right) single press
      default: []
      selector:
        action: {}
    button_four_double_press:
      name: Double Press - Button 4
      description: Action to run on button 4 (middle-right) double press
      default: []
      selector:
        action: {}
    button_four_long_press:
      name: Long Press - Button 4
      description: Action to run on button 4 (middle-right) long press
      default: []
      selector:
        action: {}
    button_five_short_press:
      name: Single Press - Button 5
      description: Action to run on button 5 (lower-left) single press
      default: []
      selector:
        action: {}
    button_five_double_press:
      name: Double Press - Button 5
      description: Action to run on button 5 (lower-left) double press
      default: []
      selector:
        action: {}
    button_five_long_press:
      name: Long Press - Button 5
      description: Action to run on button 5 (lower-left) long press
      default: []
      selector:
        action: {}
    button_six_short_press:
      name: Single Press - Button 6
      description: Action to run on button 6 (lower-right) single press
      default: []
      selector:
        action: {}
    button_six_double_press:
      name: Double Press - Button 6
      description: Action to run on button 6 (lower-right) double press
      default: []
      selector:
        action: {}
    button_six_long_press:
      name: Long Press - Button 6
      description: Action to run on button 6 (lower-right) long press
      default: []
      selector:
        action: {}
  source_url: https://github.com/enipos/ha-blueprint/blob/main/blueprints/tuya/loratap_(tuya)_6button_scene_switch_z2m.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input "switch"
  attribute: action
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 == '5_single' }}"
    sequence: !input "button_five_short_press"
  - conditions: 
    - "{{ command == '6_single' }}"
    sequence: !input "button_six_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 == '5_double' }}"
    sequence: !input "button_five_double_press"
  - conditions: 
    - "{{ command == '6_double' }}"
    sequence: !input "button_six_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"
  - conditions: 
    - "{{ command == '5_hold' }}"
    sequence: !input "button_five_long_press"
  - conditions: 
    - "{{ command == '6_hold' }}"
    sequence: !input "button_six_long_press"
1 Like

Hello, I’m trying to use your blueprint but i have trouble in making it work.
The state change is very fast using the button and I think the automation does not fire
image
I know you posted a while ago, but do you remember if you made some changes to your entity to make it work?

For anyone struggling with this, this worked for me:

I flagged the “home assistant legacy entity attributes” and the blueprint started working properly