ZHA - TS004F Rotary Knob with dual-mode support

Hey everyone,

I made a blueprint for the Tuya TS004F rotary button that fixes the sensitivity issue (where pressing the button accidentally triggers rotation events) and handles both operating modes automatically - the button has two modes (dimmer mode with step events, and scene mode with button press events).

Features:

  • Single press, double press, long press actions
  • Rotation left/right (works in both modes)
  • Configurable debounce delay slider

Tested on my setup with _TZ3000_402vrq2i. Works great after adding the debounce.

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

Let me know if you have issues with it.

Hello jrfigura,
Thanks for contributing to the community with a new Blueprint.
I have a suggestion for you. Many people who are not familiar with directory structures will have problems installing this without the Home Assistant MY tools.
Adding a MY link for this Blueprint to your top post would help them a lot.
Here is the link to make that.
Create a link – My Home Assistant
You need to be a trust level ‘member’ to edit a post. Understanding Discourse Trust Levels
If you can’t edit, I would load a link into a second post.

1 Like

When i use it on my TS004F_TZ3000_402vrq2i then i get following error: Message malformed: device does not have trigger (‘remote_button_short_press’, ‘button’)
Didn’t see anything strange myself

How do you have your rotary button configured? Since ZHA was not supporting it very well I’m using a local quirk for it. It’s described in the thread: [Device Support Request] _TZ3000_402vrq2i TS004F Tuya Rotary Button · Issue #3738 · zigpy/zha-device-handlers · GitHub

It’s using the below quirk, so i thought that’s OK
Quirk: zhaquirks.tuya.ts004f.TuyaSmartRemote004F

Now just replaced that quirk with the other one, now it seems to work better.
(just tested the toggle)
Do the rest tomorrow

Hello @rene.wolferink
After your message I have realised that my custom quirk was based on the outaded version of TuyaSmartRemote004FROK class. At this momen such simple change no longer worked - I have created a new code for the RotaryDimmer: HomeAssistant/zha_custom_quirks/ts004f_402vrq2i.py at 8f980f9ad6af8a1c09dc78745711b4b23e076cd6 · jrfigura/HomeAssistant · GitHub

Also I pushed the change to the zha-device-handlers

With those changes I had to update the blueprint - please import it one more time

In the end had to change some ‘button’ to ‘button_1’ in the yaml for the single click. No problem.

The Long Press i ended up doing with my own fabricated ZHA_event, then i got it.

So in my case i use the button to toggle lights and rotate for brightness. The double click changes to a certain scene whilst the long click changes to another scene.
All works now… thnx…learned a lot again

1 Like

It was a mode problem I was trying to solve.


I am using this blueprint but one of the devices doesn’t recognise the double press.
I already re-added the device multiple times but I still have the same issue.

I even tried to be next to the ZBT-2 to test if it doesn’t lose connection as it’s farther away from than the other device.

I hope it’s ok to ask in this thread.

Do you have any ides why this would be happening?

Thanks.

@Rick99 since the device I’m working with (_TZ3000_402vrq2i) is not handled well by available zhaquirk I’m using a custom zha quirk

your device is using TuyaSmartRemote004FROK class taht I have based on my custom quirk. Both handle double click in the same way:
(DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},

I’m afraid I cannot help you

1 Like

If you change the blueprint in the UI it will clear your current setup. If you know the blueprint path you could change it in the automations.yaml file

use_blueprint:
  path: path_to_blueprint
1 Like