Zigbee2MQTT - 1-button Scene Switch TS0041

blueprint:

  name: Zigbee2MQTT - Tuya 1-Button Scene Switch

  description: Automate your Tuya 1-Button Scene Switch via Zigbee2MQTT.

  domain: automation

  input:

    switch:

      name: Tuya 1-Button Scene Switch

      description: Tuya 1-Button Scene Switch to use

      selector:

        entity:

          integration: mqtt

          domain: sensor

          multiple: false

    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: {}

mode: restart

max_exceeded: silent

trigger:

- platform: state

  entity_id: !input switch

  attribute: action

action:

- variables:

    command: '{{ trigger.to_state.state }}'

- choose:

  - conditions:

    - '{{ command == ''single'' }}'

    sequence: !input button_one_short_press

  - conditions:

    - '{{ command == ''double'' }}'

    sequence: !input button_one_double_press

  - conditions:

    - '{{ command == ''hold'' }}'

    sequence: !input button_one_long_press

Bleuprint doesn’t work. The line ‘attribute: action’ should be removed.

1 Like

blueprint:
name: Zigbee2MQTT - Tuya 1-Button Scene Switch V01.2025
description: Automate your Tuya 1-Button Scene Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Tuya 1-Button Scene Switch
description: Tuya 1-Button Scene Switch to use
selector:
device:
integration: mqtt

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: {}

trigger:

  • platform: device
    device_id: !input switch
    domain: mqtt
    type: action
    subtype: single
  • platform: device
    device_id: !input switch
    domain: mqtt
    type: action
    subtype: double
  • platform: device
    device_id: !input switch
    domain: mqtt
    type: action
    subtype: hold

action:

  • variables:
    command: ‘{{ trigger.payload }}’
  • choose:
    • conditions:
      • ‘{{ command == ‘‘single’’ }}’
        sequence: !input button_one_short_press
    • conditions:
      • ‘{{ command == ‘‘double’’ }}’
        sequence: !input button_one_double_press
    • conditions:
      • ‘{{ command == ‘‘hold’’ }}’
        sequence: !input button_one_long_press