Tuya 4-Button Remote Switch (TS0044_1) Zigbee2MQTT

This Blueprint allows you define the actions to be taken when perform a single click, double click or hold on the Tuya 4-Button Remote Switch (TS0044_1). This blueprint works with Zigbee2MQTT only.
The remote can purchased here.

Zigbee2MQTT Version 2.0.x:

blueprint:
  name: Tuya Zigbee Z2M 4 button remote
  description: "Blueprint for use with Tuya Zigbee 4 button remote (TS0044_1) on Zigbee2MQTT"
  domain: automation
  input:
    device:
      name: Tuya Remote
      description: Tuya Remote to use.
      selector:
        device:
          filter:
            - manufacturer: Tuya
              model: Zigbee 4 button remote
          multiple: false
    button_1_short_press:
      name: Single Press - Button 1
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_1_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_1_hold:
      name: Hold - Button 1
      description: Action to run on button 1 long press
      default: []
      selector:
        action: {}
    button_2_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_2_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
    button_2_hold:
      name: Hold - Button 2
      description: Action to run on button 2 long press
      default: []
      selector:
        action: {}
    button_3_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 single press
      default: []
      selector:
        action: {}
    button_3_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 double press
      default: []
      selector:
        action: {}
    button_3_hold:
      name: Hold - Button 3
      description: Action to run on button 3 long press
      default: []
      selector:
        action: {}
    button_4_short_press:
      name: Single Press - Button 4
      description: Action to run on button 4 single press
      default: []
      selector:
        action: {}
    button_4_double_press:
      name: Double Press - Button 4
      description: Action to run on button 4 double press
      default: []
      selector:
        action: {}
    button_4_hold:
      name: Long Press - Button 4
      description: Action to run on button 4 long press
      default: []
      selector:
        action: {}
mode: queued
max_exceeded: silent
trigger:
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_hold
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 2_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 2_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 3_hold
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_hold
action:
  - choose:
      - conditions: "{{ trigger.payload == '1_single' }}"
        sequence: !input button_1_short_press
      - conditions: "{{ trigger.payload == '1_double' }}"
        sequence: !input button_1_double_press
      - conditions: "{{ trigger.payload == '1_hold' }}"
        sequence: !input button_1_hold
      - conditions: "{{ trigger.payload == '2_single' }}"
        sequence: !input button_2_short_press
      - conditions: "{{ trigger.payload == '2_double' }}"
        sequence: !input button_2_double_press
      - conditions: "{{ trigger.payload == '2_hold' }}"
        sequence: !input button_2_hold
      - conditions: "{{ trigger.payload == '3_single' }}"
        sequence: !input button_3_short_press
      - conditions: "{{ trigger.payload == '3_double' }}"
        sequence: !input button_3_double_press
      - conditions: "{{ trigger.payload == '3_hold' }}"
        sequence: !input button_3_hold
      - conditions: "{{ trigger.payload == '4_single' }}"
        sequence: !input button_4_short_press
      - conditions: "{{ trigger.payload == '4_double' }}"
        sequence: !input button_4_double_press
      - conditions: "{{ trigger.payload == '4_hold' }}"
        sequence: !input button_4_hold

Zigbee2MQTT Version 1.4.x:

blueprint:
  name: Tuya Zigbee 4 button remote
  description: "Blueprint for use with Tuya Zigbee 4 button remote (TS0044_1) on Zigbee2MQTT"
  domain: automation
  input:
    switch:
      name: Tuya Zigbee 4 button remote
      description: Tuya Zigbee 4 button remote to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_1_short_press:
      name: Single Press - Button 1
      description: Action to run on button 1 single press
      default: []
      selector:
        action: null
    button_1_hold:
      name: Hold - Button 1
      description: Action to run on button 1 long press
      default: []
      selector:
        action: null
    button_1_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 double press
      default: []
      selector:
        action: null
    button_2_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 single press
      default: []
      selector:
        action: null
    button_2_hold:
      name: Hold - Button 2
      description: Action to run on button 2 long press
      default: []
      selector:
        action: null
    button_2_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 double press
      default: []
      selector:
        action: null
    button_3_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 single press
      default: []
      selector:
        action: null
    button_3_hold:
      name: Hold - Button 3
      description: Action to run on button 3 long press
      default: []
      selector:
        action: null
    button_3_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 double press
      default: []
      selector:
        action: null
    button_4_short_press:
      name: Single Press - Button 4
      description: Action to run on button 4 single press
      default: []
      selector:
        action: null
    button_4_hold:
      name: Long Press - Button 4
      description: Action to run on button 4 long press
      default: []
      selector:
        action: null
    button_4_double_press:
      name: Double Press - Button 4
      description: Action to run on button 4 double press
      default: []
      selector:
        action: null

mode: queued

trigger:
  - platform: state
    entity_id: !input switch

condition:
  - "{{ trigger.to_state.state != '' }}"

action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == '1_single' }}"
        sequence: !input button_1_short_press
      - conditions:
          - "{{ command == '1_double' }}"
        sequence: !input button_1_double_press
      - conditions:
          - "{{ command == '1_hold' }}"
        sequence: !input button_1_hold
      - conditions:
          - "{{ command == '2_single' }}"
        sequence: !input button_2_short_press
      - conditions:
          - "{{ command == '2_double' }}"
        sequence: !input button_2_double_press
      - conditions:
          - "{{ command == '2_hold' }}"
        sequence: !input button_2_hold
      - conditions:
          - "{{ command == '3_single' }}"
        sequence: !input button_3_short_press
      - conditions:
          - "{{ command == '3_double' }}"
        sequence: !input button_3_double_press
      - conditions:
          - "{{ command == '3_hold' }}"
        sequence: !input button_3_hold
      - conditions:
          - "{{ command == '4_single' }}"
        sequence: !input button_4_short_press
      - conditions:
          - "{{ command == '4_double' }}"
        sequence: !input button_4_double_press
      - conditions:
          - "{{ command == '4_hold' }}"
        sequence: !input button_4_hold
5 Likes

Thanks for this blueprint! It is actually the only blueprint that has proven to work for my TS0044 4 gang switch.

1 Like

Can confirm it works with the old TS0044 remote.

I had to replace my old blueprint, as it strangely stopped working after an update.

This one works like a charm. Thanks!

1 Like

Danke Dafür
läuft super

1 Like

Hey there. I tinkered with your blueprint to make it work in zha. So far Im not able to make it do things… Im pretty new to blueprints. I made plenty of automations for the remote, but wanted to sum it all up in 1 automation, appearently thats only possible with a blue print… So, do someone know how to convert this blueprint to zha? Kind regads…

Thank you so much! It’s working fine with the TS0044

1 Like

Hi.
Hold takes too long, 7 seconds.
Is it possible to change somehow?

Hey, sorry i don’t think it’s possible, because you can only use the predifined Actions

Thanks it is very great!!!
I modified it slightly to convert it for SONOFF SNZB-01

blueprint:
  name: SonOFF Mobile button
  description: "Blueprint for use with SONOFF button remote (snzb-01) on Zigbee2MQTT"
  domain: automation
  input:
    switch:
      name: SONOFF snzb-01 button remote
      description: SONOFF button remote (snzb-01)
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_short_press:
      name: Single Press - Button
      description: Action to run on button single press
      default: []
      selector:
        action: null
    button_hold:
      name: Hold - Button
      description: Action to run on button long press
      default: []
      selector:
        action: null
    button_double_press:
      name: Double Press - Button
      description: Action to run on button double press
      default: []
      selector:
        action: null

mode: queued

trigger:
  - platform: state
    entity_id: !input switch

condition:
  - "{{ trigger.to_state.state != '' }}"

action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'single' }}"
        sequence: !input button_short_press
      - conditions:
          - "{{ command == 'double' }}"
        sequence: !input button_double_press
      - conditions:
          - "{{ command == 'long' }}"
        sequence: !input button_hold

1 Like

Heads-up: This very useful blueprint is affected by the breaking changes of Z2M 2.0, and only works with the discouraged setting of legacy_action_sensors activated.
The recommendation is to migrate to MQTT device triggers. My naive attempts at doing so failed, unfortunately.

1 Like

Hi Bernhorst,

I have had a play and managed to modify to work with Z2m version 2. So far, so good for me. Although I am only just starting on my HA journey :slight_smile:

@Soulfly999 hope you don’t mind.

blueprint:
  name: Tuya Zigbee Z2M 4 button remote
  description: "Blueprint for use with Tuya Zigbee 4 button remote (TS0044_1) on Zigbee2MQTT"
  domain: automation
  input:
    device:
      name: Tuya Remote
      description: Tuya Remote to use.
      selector:
        device:
          filter:
            - manufacturer: Tuya
              model: Zigbee 4 button remote
          multiple: false
    button_1_short_press:
      name: Single Press - Button 1
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_1_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_1_hold:
      name: Hold - Button 1
      description: Action to run on button 1 long press
      default: []
      selector:
        action: {}
    button_2_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_2_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
    button_2_hold:
      name: Hold - Button 2
      description: Action to run on button 2 long press
      default: []
      selector:
        action: {}
    button_3_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 single press
      default: []
      selector:
        action: {}
    button_3_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 double press
      default: []
      selector:
        action: {}
    button_3_hold:
      name: Hold - Button 3
      description: Action to run on button 3 long press
      default: []
      selector:
        action: {}
    button_4_short_press:
      name: Single Press - Button 4
      description: Action to run on button 4 single press
      default: []
      selector:
        action: {}
    button_4_double_press:
      name: Double Press - Button 4
      description: Action to run on button 4 double press
      default: []
      selector:
        action: {}
    button_4_hold:
      name: Long Press - Button 4
      description: Action to run on button 4 long press
      default: []
      selector:
        action: {}
mode: queued
max_exceeded: silent
trigger:
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 1_hold
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 2_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 2_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 3_hold
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: 4_hold
action:
  - choose:
      - conditions: "{{ trigger.payload == '1_single' }}"
        sequence: !input button_1_short_press
      - conditions: "{{ trigger.payload == '1_double' }}"
        sequence: !input button_1_double_press
      - conditions: "{{ trigger.payload == '1_hold' }}"
        sequence: !input button_1_hold
      - conditions: "{{ trigger.payload == '2_single' }}"
        sequence: !input button_2_short_press
      - conditions: "{{ trigger.payload == '2_double' }}"
        sequence: !input button_2_double_press
      - conditions: "{{ trigger.payload == '2_hold' }}"
        sequence: !input button_2_hold
      - conditions: "{{ trigger.payload == '3_single' }}"
        sequence: !input button_3_short_press
      - conditions: "{{ trigger.payload == '3_double' }}"
        sequence: !input button_3_double_press
      - conditions: "{{ trigger.payload == '3_hold' }}"
        sequence: !input button_3_hold
      - conditions: "{{ trigger.payload == '4_single' }}"
        sequence: !input button_4_short_press
      - conditions: "{{ trigger.payload == '4_double' }}"
        sequence: !input button_4_double_press
      - conditions: "{{ trigger.payload == '4_hold' }}"
        sequence: !input button_4_hold
2 Likes

If you using Z2M with version 2.x just simple activate under Settings - Home Assistant Integration - Home Assistant legacy action sensors but in future it could be happens, that the legacy options are not supported any more

I used your modified script and it works, I did have to remove the input filter on the model though. For some reason it did not work on my device.

Also very similar to the above last posted you might want to try these which should work for this device too:

Added both Bluetooth Version 1.4.x and 2.x in the first post. Thank you @Crozzer