Zigbee2MQTT - Tuya 4-button Scene Switch (TS0044) - rdeangel

I am seeing the same behavior. There is just nothing at all in the dropdown.

This blueprint will list any “sensor.” entities which are listed with this template:
{{ integration_entities(‘mqtt’) }}

image

If you don’t have any, it won’t list anything.

At least single presses seems to work for me - haven’t tested more. Nothing worked in the un-modded blueprint

Thanks a lot, found this just before I started to fork Stringers blueprint for a “mode: single”, but this is even better!

After Zigbee2MQTT update to version 2.0.0 there are breaking changes regarding *_action entities.

All action sensors are now disabled by default (sensor.*_action entities). It’s recommended to use the MQTT device trigger instead.

https://github.com/Koenkk/zigbee2mqtt/discussions/24198

Are there any plans to update this blueprint to make it work again ?

Yes I’ve already changed a similar blueprint here to use MQQT topic triggers instead of devices sensors, which no longer exist. I’ll fix this in a few hours.

1 Like

Blueprint Updated.

Reimport and overwrite the blueprint from the top of the page or just press the below:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

You’ll need to edit your automations and select your zigbee device instead of the previous device sensor entity.

3 Likes

Here is a version which does not rely on receiving MQTT messages directly but instead uses the new event triggers. The thing I dislike about the current version with MQTT messages is that the automation triggers on ANY ‘action’ message and only afterwards filters it via a condition.
The changes to the 2024 version of this blueprint are minimal:

For the switch input I set

          domain:
            - event

and for the command variable

  - variables:
      command: >
        {% if trigger.to_state.attributes.button is defined %}
        {{ trigger.to_state.attributes.button }}_{{trigger.to_state.attributes.event_type }}
        {% else %}
        {{ trigger.to_state.attributes.event_type }}
        {% endif %}

This is a bit more complicated than necessary because currently the event reporting from Z2M is inconsistent. Short and double presses are reported as event_type: 1_single while for long presses the payload is split into parts:

event_type: hold
button: '1'

I did not copy the button descriptions from the 2025 version, because they are wrong for my devices. Perhaps there are two versions with different button layouts.

blueprint:
  name: Zigbee2MQTT - Tuya 4-Button Scene Switch (rdeangel_mod, events)
  description: Automate your Tuya 4-Button Scene Switch via Zigbee2MQTT. This requires Settings -> Home Assistant integration -> Home Assistant experimental event entities to be enabled in Zigbee2MQTT.
  domain: automation
  input:
    mode:
      name: Automation Modes
      description: https://www.home-assistant.io/docs/automation/modes/
      default: parallel
      selector:
        select:
          mode: dropdown
          options:
            - single
            - restart
            - queued
            - parallel
          multiple: false
          sort: false
          custom_value: false
    switch:
      name: Tuya 4-Button Scene Switch
      description: Tuya 4-Button Scene Switch to use
      selector:
        entity:
          integration: mqtt
          domain:
            - event
          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: {}
    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://community.home-assistant.io/t/zigbee2mqtt-tuya-4-button-scene-switch-ts0044-rdeangel-mod/663302
mode: !input mode
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input switch
action:
  - variables:
      command: >
        {% if trigger.to_state.attributes.button is defined %}
        {{ trigger.to_state.attributes.button }}_{{trigger.to_state.attributes.event_type }}
        {% else %}
        {{ trigger.to_state.attributes.event_type }}
        {% endif %}
  - 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

Thank you, my automations based on this blueprint are now working again with the zigbee update

I did have to manually delete the old switch from the automation yaml to stop it coming up in my watchman report

@rdeangel : thanks for the update, it works again :+1:

Totally right, I was hesitant posting it to start with for this very same reason, but I thought let me get something out there for now.
I had to right my wrong so I’m posting a new one which follows the official way of doing things and it’s pretty much what Panopilian posted in the original post.

Zigbee2MQTT - Tuya 4-Button Switch (MQTT Device Trigger) - rdeangel
SROLL UP :point_up: TO IMPORT BLUEPRINT
I suggest anyone using my last automation to use this one instead
This one uses the MQTT device trigger instead and will only trigger for manually defined device mqtt actions, which is much better.
What I dislike about this one is the manual definition of all the triggers (very long) but there is no way around that (from what I can tell) as the triggers are loaded when the blueprints loads (not when the automation loads) so they need to be manually defined within the blueprint (at least for now).

What I still couldn’t resolve, is to efficiently allow for multiple devices of the same type to be controlled by a single automation.
For this purpose I’m reposting the same automation I originally posted before with multiple inputs (which again has the issue of getting triggered with any mqtt device actions). You can use it if you don’t mind the trigger happy behaviour.
PLEASE DON’T USE THIS ONE IF YOU JUST NEED THE AUTOMATION TO BE TRIGGERED BY A SINGLE DEVICE, USE THE ONE ABOVE:
Zigbee2MQTT - Tuya 4-Button Switch (MQTT Subscribe Any - Filters Multiple Devices)
SROLL UP :point_up:TO IMPORT BLUEPRINT

I’ll also update the links at the top of the post in a minute.

FYI, these new blueprints have a different filename, but instead of redifining your automations manually (which get wiped when you switch the blueprint in your automation) you can just import the blueprint, then go to your automation, click edit yaml at the top right and change:

use_blueprint:
  path: rdeangel/zigbee2mqtt-tuya-4-button-scene-switch-ts0044-rdeangel-mod.yaml

to

use_blueprint:
  path: rdeangel/zigbee2mqtt-tuya-4-button-switch-mqtt-device-trigger_rdeangel.yaml

and save.

1 Like

Thank you, thank you,
I was struggling the whole day already with this. You made my day.
I used it for a TS0042 - 2 button Tuya swirch

1 Like

Just to be sure before i Update Z2M to → 2.0.0

I now have 1.42.0-2 working and happy with your Blueprint! :white_heart:

I have 6 buttons all the same device “TS0044 / TS0044_1” which all use the same blueprint.

Can’t really seem to figure out which blueprint to use? :frowning:

“PLEASE DON’T USE THIS ONE IF YOU JUST NEED THE AUTOMATION TO BE TRIGGERED BY A SINGLE DEVICE, USE THE ONE ABOVE:”

Is this if I have one device which controls more than one device in an action?

If each of the 6 device have its own different automation, (so you have 6 different automation and different actions) use the first import/blueprint at the very top.

The alternate automation isn’t ideal and won’t work in all cases, but it can be used if you have multiple devices that have identical automation and actions, so you could control them all in a single automation by selecting multiple devide within the single automation (rare use case)

1 Like

This tip saves me a ton of time. Thank you and thanks for the update!

1 Like

Thanks!
Just to let you know it works as well with the following switch:
Tuya SH-SC07 (round switch)
(Zigbee2MQTT, Current version: 2.0.0-2)
(Core 2025.1.2)

odd it shouldn’t with that unless you changed the blueprint.

EItherway this would have just worked with that button:

I get this warning when trying to import the blueprint

image

Does the link appear in the blueprint address box? If not try to copy and paste this link manually:

@rdeangel got it thanks.