Zigbee2MQTT - Tuya 4-button Scene Switch (TS0044)

Yes, it worked wonderfully! Thanks!

2 Likes

I updated Zigbee2Mqtt and Home Assistant Core and now only one click works. Is it just me?

1 Like

Does not work when using Input Select: Next to cycle through scenes. Normal operations on the a regular light bulb work for me. I’m able to cycle through the scene entities using a separate automation as shown below:

alias: test
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: some_device_ID
    type: action
    subtype: 3_single
    discovery_id: some_device_ID action_3_single
condition: []
action:
  - service: input_select.select_next
    target:
      entity_id: input_select.scene_entities
    data:
      cycle: true
  - service: scene.turn_on
    target:
      entity_id: "{{ states('input_select.scene_entities')}}"
mode: single

Edit: It doesn’t look like you can have more than a single action per press (i.e. you can’t call Light Bulb 1: Toggle and Light Bulb 2: Toggle. Only Light Bulb 1: Toggle will work)

Hi Guy,
I’m new in Home Assistant and I try to use a TS0044 button, my mqtt setup and Zigbee2MQTT setup seems to be ok because I successfully pairing my button and my roller.
Regarding my roller all is OK, but I have an issue with my button x4 TS0044
I can see in equipement event “button 1 single” “button 2 single” “button 1 double” but nothing is working in blueprint script.
When I excute manualy automation I was an error with :slight_smile:
command: ‘{{ trigger.to_state.state }}’
I changed it as I saw in forum by :
command: “{{ trigger.payload_json }}”
Now I don’t get error with manual execution but when I push a button nothing :frowning:
Can you help me?
I give you screenshots
Thank you so much for your help

I can only get single click to work as well.

hello,
what is that blueprint good for? as its natively supported by haas?

thanks!

Same problem here. Stopped working for some reason (not even sure when). I get the Z2M evens correctly (I checked the log file of the sensor entity and I see the events) but for some reason the automation itself does not execute.
Can anyone help ?

Solved.
The Entity ID includes the attribute. In my case the entity ID looked like that:
sensor.0x847127fffe27cc14_action
In the blue print the trigger was based on the entity ID and the attribute (“Action”).

I removed the attribute from the trigger (put a # in front of it) and it started to work:
trigger:

  • platform: state
    entity_id: !input switch

attribute: action

1 Like

Thank you so much. Worked.

Since these buttons report an empty state immediately after reporting the button state, I recommend adding a condition to the template so when the state is empty, the automation will not restart.

Add this right after the trigger:

condition:
  condition: template
  value_template: '{{ trigger.to_state.state in ( ''1_single'', ''2_single'',
    ''3_single'', ''4_single'', ''1_double'', ''2_double'',
    ''3_double'', ''4_double'', ''1_hold'', ''2_hold'',
    ''3_hold'', ''4_hold''
    ) }}'

(This code is from the Aqara Opple template: Aqara Opple 6 Button Remote 3 bands (WXCJKG13LM) via Zigbee2MQTT [Z2M] · GitHub)

Thanks to everybody for their continuing updates to this blueprint over the years. I was still running into troubles with all the variations, plugging away at what worked in some parts of the script but stopping working along the way in others with different platform updates. I think I got bit by the spaces in my friendly names, but I didn’t want to have to configure my MQTT server every time. So, combining all the different blueprints and some help from ChatGPT - I finangled another version. I’m publishing here if it helps anybody! Thanks to the community!

Currently running HA core: 2024.6.3, Zigbee2MQTT: 1.38.0 commit: fe048e6

7 Likes

Literally just took delivery of a couple of these yesterday and this is just what I needed. Thank you!

1 Like

You are the best !! Worked perfectly !
Thanks!

1 Like

Does this also work for the ts004f that many of us have?

I think so. I was confused about which one I had until I double-checked what showed up in MQTT. I’ll see if i can find some examples of any differences


Hello;

I have three of the TM-YKQ004 remotes that recently stopped working with the original blueprint. I cannot get them working at all now, even with the latest version of the blueprint offered by Lux4rd0.

Am I the only one that this remote no longer works for? Any suggestions or updates? I should mention I am running the latest beta of home assistant.

Thanks

Turns out a complicated blueprint is not the answer. A simple automation is working just perfectly.

alias: Remote
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.remote_action
    to: 1_single
    id: 1s
  - platform: state
    entity_id:
      - sensor.remote_action
    to: 2_single
    id: 2s
  - platform: state
    entity_id:
      - sensor.remote_action
    to: 3_single
    id: 3s
  - platform: state
    entity_id:
      - sensor.remote_action
    to: 4_single
    id: 4s
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - 1s
        sequence:
          - action: light.toggle
            target:
              entity_id: light.room_light
            data: {}
      - conditions:
          - condition: trigger
            id:
              - 2s
        sequence:
          - action: light.toggle
            data: {}
            target:
              entity_id: light.bird_light
      - conditions:
          - condition: trigger
            id:
              - 3s
        sequence:
          - action: light.toggle
            data: {}
            target:
              entity_id: light.fish_light
      - conditions:
          - condition: trigger
            id:
              - 4s
        sequence:
          - action: fan.toggle
            data: {}
            target:
              entity_id: fan.roomfan
mode: single

1 Like

I will start by saying that I am fairly new to HA but coming along. I purchased a 4 button scene switch and have it connected and appears operational as per the logbook entries. My confusion is in triggering the automations as none of the blueprints or @Wheemer script is working for me. I am fairly certain that it is related to a simple missing link but I am not sure what I should be looking for. I appreciate any help.