Z2M - TS004F Tuya 4-Gang Switch blueprint

Sadly didn’t work for me too

Are you getting any errors?

I eventually got it to work but it was after a full factory reset of hassio on my raspberry pi. I think there was a problem with my original zigbee setup.
I fully reset hassio to the latest image, then setup zigbee using zigbee2mqtt and I got it to work through that using the blueprint.
So thank you for this! It’s working now

After did a full reinstall RPi4, it finally able to detected in zigbee2mqtt. It was also able to be selected in automation. But it was unresponsive to all the click. How do I check it ?

2 Likes


Any idea what i did wrong?

1 Like

I can’t use this model of buttons. No matter what I do I can’t see any log messages on Zigbee2MQTT when I press any button. You guys can see any log message? Due to this, unfortunately, I can’t put this blueprint to work.

Have you tried restarting home assistant and reconnecting the buttons (after deleting them first from HA)?
Another possibility is not renaming the entity IDs in HA (when renaming the buttons in Z2M not selecting “Update Home Assistant entity ID”)

Hello and thanks for the response.

Unfortunately that also doesn’t work. Maybe it has to do with the USB sniffer I’m using.
In my case I’m using Texas’s ttyACM0

Has anyone tried the latest update of [email protected] version. Does it work with this blueprint?

I am on version 1.21.0-1 and I had no troubles

Hi,
what do I do wrong?
It says it a not supported device:
Warning Received message from unsupported device with Zigbee model 'TS004F' and manufacturer name '_TZ3000_xabckq1v'
Warning Please see: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html.
But it is from the logs so if I touch a button it knows. But I can’t make an entity.
Thanks for your help!

When I make an automation using this blueprint, the automation gets triggered but no action is ever performed. Has anyone got an idea what I’m doing wrong? :slight_smile:

mode: single
max_exceeded: silent
variables:
  command: '{{ trigger.payload }}'
  topic: '{{ trigger.topic }}'
  switch_name: sensor.knop_eettafel_action
  deviceName: '{{ state_attr(switch_name, ''friendly_name'') }}'
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/+/action
action:
  - choose:
      - conditions:
          - >-
            {{ topic.split('/')[1].replace('/', '') == deviceName.split(' ')[0]
            }}
        sequence:
          - choose:
              - conditions:
                  - '{{ command == ''on'' }}'
                sequence:
                  - type: toggle
                    device_id: 729d43e6ba4ce328966706da09e344ce
                    entity_id: light.kantoor_links_2
                    domain: light
              - conditions:
                  - '{{ command == ''off'' }}'
                sequence:
                  - type: toggle
                    device_id: c8256b95e61b5282ce79326aa0b3c8d4
                    entity_id: light.kantoor_rechts_2
                    domain: light
              - conditions:
                  - '{{ command == ''brightness_step_up'' }}'
                sequence: []
              - conditions:
                  - '{{ command == ''brightness_step_down'' }}'
                sequence: []
              - conditions:
                  - '{{ command == ''brightness_move_up'' }}'
                sequence:
                  - device_id: 729d43e6ba4ce328966706da09e344ce
                    domain: light
                    entity_id: light.kantoor_links_2
                    type: brightness_increase
              - conditions:
                  - '{{ command == ''brightness_move_down'' }}'
                sequence:
                  - device_id: c8256b95e61b5282ce79326aa0b3c8d4
                    domain: light
                    entity_id: light.kantoor_rechts_2
                    type: brightness_decrease
id: '1630512617940'
alias: Zigbee2MQTT - Tuya 4-Button Scene Switch TS004F
description: ''

I see that the button is sending on, off, brightness_move_up etc. just as expected. But the automation still skips choosing a action to trigger? :thinking:

I had exactly the same issue. Rename your sensor that it does not contain any spaces.

eg. knop-eettafel will work, while knop eettafel won’t.

1 Like

I have the same issue and my switch name is sensor.wireless_switch_master_action so there’s no spaces here too. any solutions at your end?

That means your friendly name is ‘wireless switch master’, so that does contain spaces. Rename it to something like wireless-switch-master and it should work.

The only issue I have now is that the long presses don’t really seem to work.

For example:

Button 3, single press: brightness_increase ← works.

Button 3, long press: brightness_increase ← most of the time nothing happens. Once in a while my lamp goes up one step in brightness, like with a single press. But 95% of the time, there is no change in brightness at all.

:thinking:

Seems that i am not alone at getting any sort off response from my ts004f. Z2M reports the device is supported and binding suggests that I should be expecting battery status, link quality, and action. However, mqtt doesn’t deliver any messages to a debug node so i guess I’d be on a fool’s errand trying to get the blue print working. Like others, I’m using a TI usb concentrator, my version of Z2M is up to date. I wondered why some folk seem to get this device to respond while others fail to.

For me, it works after restarting zigbre2mqtt add on, no need to start home assistant.

Z2m generates empty action but after restarting z2m add on, it had fixed for me. i had this button 2 times in different times and this was the solution

For anyone who’s running into issues with this not working, I finally got mine to work so figured I’d share:

  • The choose condition seems to be the primary point where it gets “weird”
  • I had to replace a bunch of ‘’ (single quotes, doubled up) with ’ to get it to parse correctly
    • From the file perspective:
      '{{ topic.split('/')[1].replace('/', '') == deviceName.split(' ')[0] }}
    • From the tracing perspective:
      '{{ topic.split(''/'')[1].replace(''/'', '''') == deviceName.split('' '')[0] }}'
  • Once that’s done keep in mind that the deviceName lookup (a variable) is going to split the name on the space characters and take the first one. This is because the name is " action" and the " action" needs to get chopped off.
3 Likes

That’s really a great work! Thanks!
Is there any reason why long-press works only for button 3 and 4?

Thanks,
Claudio