Help adding a variation of Tuya TS0044, TS004F to ZHA

I’ve updated the post.
I also created a gist: TS004F custom quirk · GitHub

@koying Thanks for the quick response

I got the HA to load the custom quirk by installing the custom deps addon , after that added the ts004f.py in /usr/local/lib/python3.9/site-packages/zhaquirks/tuya reloaded the pycache

2021-07-17 15:14:58 DEBUG (MainThread) [zigpy.quirks.registry] Checking quirks for _TZ3000_xabckq1v TS004F (60:a4:23:ff:fe:95:22:d7)
2021-07-17 15:14:58 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class 'zhaquirks.tuya.ts004f.TuyaSmartRemote004F'>
2021-07-17 15:14:58 DEBUG (MainThread) [zigpy.quirks.registry] Found custom device replacement for 60:a4:23:ff:fe:95:22:d7: <class 'zhaquirks.tuya.ts004f.TuyaSmartRemote004F'>

it also showing up in device page now

but zha_event still not able to see any event by any button press.

A dedicated PR has been created for those willing to help getting this right

3 Likes

To pull all the information together and make sure there is something for new users to directly follow, I’ve added the post:

To this thread.

Thanks all or the help
Too bad all the functions advertised are not available, damn tuya…

Hi Chris and others with a TS004F,

I have 4 of the Tuya 4 button switch TS004F. They come from a vendor claiming they were model TS0044 (12 scene switch), however they were TS004F and behave the same as I can read on all the posts here.
I called the vendor, and they tell me the TS004F is a 12 scene switch if it is configured to be. This is done using the Tuya gateway and their app. On first discovery of the device, the app will ask asked about the “mode”, and set it on the switch. I have looked into this and it seem correct. Even mentioned on the description-paper slips.
I have looked around and this problem is well known on different platforms, and the solution seems quite straight forward.
On initial setup the switch need to be configured, by setting a switch to “1”. Like in this example from another platform
cmd += zigbee.writeAttribute(0x0006, 0x8004, 0x30, 0x01, dummy, delay=50)
Look in this link: https://raw.githubusercontent.com/kkossev/Hubitat/main/Drivers/Tuya%20TS004F/TS004F.groovy
where the 0x01 initiates a “12 buttom switch mode”

It is also mentioned on this link TS004F (instead of TS0044) buttons has only single tap · Discussion #7158 · Koenkk/zigbee2mqtt · GitHub. Search for “Enum8 = 1” and you will find the right article.

I do not have any clue how to use this information. How to send the “mode setting” to the switch during setup.

Anyone knows?

If someone needs a switch for testing, I will send you one. Your welcome to keep it if successful). I will be happy to help testing also.

3 Likes

I too thought I was getting a TS0044 but turned out to be a TS004F. So, I’m trying to get it to work with ZHA. In my research today, I see that the Zigbee2MQTT folks made some progress just today on it. As @khvej8 mentioned above, there’s a way to switch it to the 12 scene switch mode. I’m too new to any of this to know how that could be done in the quirks. Or if it even can. Maybe someone more knowledgeable could take a look her and see if it makes sense to them?

Found more info on how to change the switch mode.

image

https://www.zigbee2mqtt.io/devices/TS004F.html#device-modes

5 Likes

Can anyone confirm this is working?

1 Like

EL_Duderino, I can not make it work using ZHA. It shows up as a the dimmer version, not the 12scene.

Holding button 2+4 will make button 3 flash 3 times, as described. However adding the button to ZHA afterwards will ends with the dimmer version.

I’m using ZHA and not Z2M. When I put the switch in switch mode 2 by holding buttons 2+4, light 3 flashes once as described. After this I no longer receive any ZHA events at all. The same procedure puts the switch back into mode 1

1 Like

Agree, after holding button 2+4 the events will stop. I beleive it is because it changes to a “new device”. I tried to add it to ZHA again, it adds as a dimmer version. Can not make it add as a 12 scene button.

Yup, can confirm it. device doesn’t work in ZHA as the 12 scene button. ZHA quirk needs to be updated I guess. Z2M works with both device modes.

My device for some reason, now have this entity button.tz3000_xabckq1v_ts004f_5194fcfe_identify and it’s the only one that have an action. There is a PRESS text next to it so I can make a automation based on it, but only by the UI. No button works at all on the physical switch, no zha_event, not even repairing, pressing 2+4 buttons, etc. Should I return this device or it might work one day?

Should I return this device or it might work one day?

It sounds like it is technically possible to get these devices working, so maybe in another 6 months they will work without a ton of hacking. I’m probably going to return mine, and maybe re-order one later in the year if there is better support.

So, after reading through all the posts it seems that there is no easy way of getting the TS004F working with ZHA. Zigbee2MQTT seems to be the better solution, but can we run ZHA and Zigbee2MQTT together using one dongle. I don’t feel like adding all my ZHA devices to Zigbee2MQTT now.

Unfortunately not on one dongle. You can have 2 dongles (coordinators), one for ZHA and one for Zigbee2mqtt. They run fine on the same box/server.

2 Likes

So, it’s impossible to add to zha, considering migrate to z2m

What a pity, zha was so easy…

It works as a dimmer or as a 4 button scene switch. You need Z2M for the 12 scene mode, at least as of now. Personally I just use them for 4 scenes, as I will not migrate away from ZHA.

Sorry @khvej8, you said “it works as a 4 button scene switch” … How do you make it work as 4 button scene switch (not the dimmer mode) ? I did not succeed (even with the right 2+4 switch mode trick). Thx