Zigbee2MQTT [Z2M] Tuya/Moes 4-Button Switch TS0044 - DJF3

	Photo: Moes 4 button switch (numbers = button numbers)

Quick Import:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

WHAT IS IT?
My first blueprint! :slight_smile:
A blueprint that enables you to quickly configure switches. It also is a lot easier to look at compared to manual events in an automation.
It was inspired by sherlocks blueprint.
Updates:
→No MQTT topic needed
→Actions grouped per button (see screenshot below)
→The least amount of text possible. (well you could use less text)

SETUP

  1. Import blueprint - Click the button above.
  2. Open blueprint
  3. Select switch - listed in the switch dropdown
  4. Configure actions - for each button
  5. Save
  6. Test

REQUIREMENTS

  • Zigbee2MQTT
  • Supported switch

DEVICE INFO

  • Manufacturer: Tuya / Moes / Loratap / Nedis
  • Model: TS0044
  • Zigbee2MQTT: info
  • Buttons: 4
  • Supported actions:
    â—‹ single click
    â—‹ double click
    â—‹ long click

NOTES

  • Which switch? This works for the “fancy” switches like Moes as well as the ultra cheap, wobbely Tuya switches. There is a BIG difference between these switches.
  • Single switch: I have not enabled multiple switches in a single automation
  • Switch not visible? Open the switch device page. On the top left you should see (exactly) `Wireless switch with 4 buttons (TS0044) by Tuya’. If it doesn’t it may be a slightly different model.

TIP

  • Use a labelmaker to print labels with icons, numbers or text. Great for the WAF and KAF.
  • Mounting: I use very thin nano tape (see through / gel type) to put them on a wall. The factory default mounting tape often is impossible to take off.

BLUEPRINT YAML

blueprint:
  name: _Zigbee2MQTT [Z2M] Tuya 4-Button Switch TS0044 ULTRA by DJF3
  description: "Z2M blueprint for the <strong>Tuya 4-Button wireless remote switch TS0044</strong>.<br>
    \ No MQTT topic or Helper needed. version 0.96: simplification in blueprint text<br>
    \ Device info: [TS0044](https://www.zigbee2mqtt.io/devices/TS0044.html)
    \n
    \n       .---.---.    SUPPORTED:
    \n       | 1 | 2 |    - single click
    \n       |---|---|    - double click
    \n       | 3 | 4 |    - long click
    \n       '---'---'\n"
  author: DJ Uittenbogaard
  homeassistant:
    min_version: 2025.3.0
  domain: automation
  input:
    your_remote:
      name: "Select your Tuya 4-button remote"
      description: ""
      selector:
        device:
          filter:
            - integration: mqtt
              model: Wireless switch with 4 buttons
          multiple: false
    button1_section:
      name: BUTTON 1 (top-left)
      icon: mdi:numeric-1-box-outline
      collapsed: true
      input:
        input_button1_single:
          name: Button 1 - SINGLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button1_double:
          name: Button 1 - DOUBLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button1_long:
          name: Button 1 - LONG click
          description: ""
          default: []
          selector:
            action: {}
    button2_section:
      name: BUTTON 2 (top-right)
      icon: mdi:numeric-2-box-outline
      collapsed: true
      input:
        input_button2_single:
          name: Button 2 - SINGLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button2_double:
          name: Button 2 - DOUBLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button2_long:
          name: Button 2 - LONG click
          description: ""
          default: []
          selector:
            action: {}
    button3_section:
      name: BUTTON 3 (bottom-left)
      icon: mdi:numeric-3-box-outline
      collapsed: true
      input:
        input_button3_single:
          name: Button 3 - SINGLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button3_double:
          name: Button 3 - DOUBLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button3_long:
          name: Button 3 - LONG click
          description: ""
          default: []
          selector:
            action: {}
    button4_section:
      name: BUTTON 4 (bottom-right)
      icon: mdi:numeric-4-box-outline
      collapsed: true
      input:
        input_button4_single:
          name: Button 4 - SINGLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button4_double:
          name: Button 4 - DOUBLE click
          description: ""
          default: []
          selector:
            action: {}
        input_button4_long:
          name: Button 4 - LONG click
          description: ""
          default: []
          selector:
            action: {}
mode: single
trigger:
# ------- Button 1
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 1_single
  id: 1_single
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 1_double
  id: 1_double
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 1_hold
  id: 1_hold
  trigger: device
# ------- Button 2
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 2_single
  id: 2_single
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 2_double
  id: 2_double
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 2_hold
  id: 2_hold
  trigger: device
# ------- Button 3
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 3_single
  id: 3_single
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 3_double
  id: 3_double
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 3_hold
  id: 3_hold
  trigger: device
# ------- Button 4
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 4_single
  id: 4_single
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 4_double
  id: 4_double
  trigger: device
- domain: mqtt
  device_id: !input your_remote
  type: action
  subtype: 4_hold
  id: 4_hold
  trigger: device
conditions: []
actions:
- choose:
  # ------- Button 1
  - conditions:
    - condition: trigger
      id:
      - 1_single
    sequence: !input input_button1_single
  - conditions:
    - condition: trigger
      id:
      - 1_double
    sequence: !input input_button1_double
  - conditions:
    - condition: trigger
      id:
      - 1_hold
    sequence: !input input_button1_long
  # ------- Button 2
  - conditions:
    - condition: trigger
      id:
      - 2_single
    sequence: !input input_button2_single
  - conditions:
    - condition: trigger
      id:
      - 2_double
    sequence: !input input_button2_double
  - conditions:
    - condition: trigger
      id:
      - 2_hold
    sequence: !input input_button2_long
  # ------- Button 3
  - conditions:
    - condition: trigger
      id:
      - 3_single
    sequence: !input input_button3_single
  - conditions:
    - condition: trigger
      id:
      - 3_double
    sequence: !input input_button3_double
  - conditions:
    - condition: trigger
      id:
      - 3_hold
    sequence: !input input_button3_long
  # ------- Button 4
  - conditions:
    - condition: trigger
      id:
      - 4_single
    sequence: !input input_button4_single
  - conditions:
    - condition: trigger
      id:
      - 4_double
    sequence: !input input_button4_double
  - conditions:
    - condition: trigger
      id:
      - 4_hold
    sequence: !input input_button4_long

Other blueprints that I created:

Questions or comments? Let me know! :+1:

3 Likes

First I want to thank you for this blueprint that will make my life much easier ! Any chance you can help my to adapt this blueprint for TS0042 and TS0041 switchs ? They are basically the same with less buttons.
Thanks in advance !

Ok so I found how to do it by myself ! It was not very hard indeed :wink:
I replaced 4 by 2 in line 20 model: Wireless switch with 4 buttons
And then, I just made the adjustments in description.
You can find the files I made for TS0042 and TS0041 here : GitHub - cabatech/HA-things
Fell free to publish them here. You made the hard work ! Thanks again.

PS : I Change the order of the button in my files because mine are different. Keep that in mind if you want to publish them here

1 Like

Tu es un dieu :slight_smile:
Tellement plus simple que tout ce que l’on trouve ailleurs ( sans dénigrer le travail fait par les autres )
Au top !!!

1 Like

Thanx for the blueprints.

Unfortunately they seem stop working.

When paired via Zigbee2MQTT, my remote only exposes:
event.ts0042_action
sensor.ts0042_battery

not:
sensor.ts0042_action

Any Idea how to fix this or adapt your blueprint?

It has no “entity” (like sensor.ts0042_action) that Home Assistant can list.
It sends ZHA-style events (action = 1_single, 2_double, etc.) directly over MQTT.

Therefore, the blueprint UI dropdown will always show “No devices found.”

Hello @derpuma

Assuming you are talking about model TS0044 , not TS0042 ? The 0042 model is a “2 button” switch that should never have appeared in this blueprint because of its name.

Does your remote device page show this remote model?

When listing remotes that is what defines if the remote is shown in the dropdown. In the past I’ve seen remotes change name and suddenly disappearing from blueprints :slight_smile:

You could try a few things:

1 change device name

Go to the /config/blueprints/automation/DJ/ folder + copy the remote blueprint file + rename it so it can be easily identified.
In the copied file replace the model: Wireless switch.... with your model name. Don’t include things like “(TS0044) by Tuya”.

      selector:
        device:
          filter:
            - integration: mqtt
              model: YOUR_MODEL_NAME_HERE

Before saving the change, change the blueprint NAME at the top of the blueprint yaml to something like this:

name: _Zigbee2MQTT [Z2M] my 4button blueprint test

After that, go to developer tools / yaml and reload “Automations” to activate the updated blueprints.
And of course: test if your remote appears in the updated blueprint.

2 removing model requirement

ALTERNATIVELY you could even consider removing the
model: Wireless switch with 4 buttons
line completey. That would result in the blueprint showing ALL MQTT devices :slight_smile:

Anyway, let me know how things go.