Tuya ZigBee "Smart Knob"

By the way,
This rotary button is kind of meh, because like every tuya device i own, i find it slugish and you always have to pause yourself between every action.
For exemple when you try to raise the volume rapidly by rotating the knob with fast turn motion or with a continuous turn motion(i understand this case can be hard to debounce), only the first one i sent until you pause for 0.5 sec.

Does anyone know another knob that would feel snappy ( can be zwave or zigbee )?

1 Like

The IKEA knob does not need 0.5 seconds at least.
You can’t go fast, but you rarely need to pause either.

Thanks i’ll give it a try

Just found it on aliexpress. So does it work properly with z2mqtt?

I also just found this knob and would like to know if it’s working directly with ZHA ?
I don’t want to install ZigbeeMQTT if I can avoid it.

Again, there already looks to be a ZHA quirk handler for it in ZHA quirks library (ZHA Device Handlers), so again suggest help improve ZHA by reporting bugs and assisting in troubleshooting the quirks, see:

https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

and

https://github.com/zigpy/zha-device-handlers/issues

as well as information for more advanced users here:

https://github.com/zigpy/zha-device-handlers/blob/4956114628a2aee435776c5e286a8e97d4f3df53/README.md

https://github.com/zigpy/zha-device-handlers

PS: The reason why it works in Zigbee2MQTT is its community has fixed their converter = quirk for it.

Hi,
Like i posted some days ago, it does not work out of the box with ZHA, you have to use a custom quirk. it’s not as dreadful as it sound, you just have to add a file at a certain place in your configuration (How to setup local ZHA quirks).

I just tested the ikea symfonisk volume knob and overall i’m more pleased with it than the tuya device.

If i can just give a piece of advice, you’d better avoid any tuya device. They are a pain. I own a light bulb, a 4 buttons remote, the smart knob and some smart plug. And every time there is a something that is a deal breaker when you use them and make them a waste of your money.
They can be troublesome to install/recognize because you have to use custom quirks, but i saw worse zigbee devices in this aspect.

It’s just that they are workish…
The bulb: Slow as *** but not that big deal if you accept a little delay and it’s the least infuriating device in my book.
The 4 button remotes: Slow, press debounce too long and sometimes the presses are not registred ( not an issue with the communication, but rather with the build quality ). You can live with it, but the miss click are really annoying
The smart knob: Slow and ridiculous debounce time. Making it nearly unusable to smootlhy tune the volume or dim a light
The smart plug: They works just fine, except they randomly turn off, killing the connected equipment without any user input due to what seems to be a firmware problem ( i was not really pleased when i woke up one morning with my nas shut down improperly and my network cabinet shut down too )

Regards

Edit: I forgot that i own tuya humidity/temperature sensor. Those are safe, not the best calibrated temp sensor, but nothing that can’t be offseted with HA.

1 Like

The reason why ZHA Device Handlers (a.k.a. a quirks) are sometimes needed i explained in the ZHA docs here → https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

Summery in relevant technical layman’s terms;

Most Zigbee devices with Chinese brands are either made by Tuya or Aqara/Xiaomi and both of those manufacturers are infamous for making device firmware for those products that do not strictly follow Zigbee specification standards, in fact, deviating from standard attributes and values (as well as standard Zigbee clusters) will break practically all Zigbee solutions until they implement custom workarounds for each and every individual device that does not follow the standards of the set specifications, and manufacturers keep releasing new devices so to developers of any third-party Zigbee solutions that did not make that non-standard device it is like a never-ending game of playing catch-up in order to implement a new custom workaround for each new such device that is found in the wild.

To make things a little bit easier such workarounds for individual devices in different Zigbee solutions are implemented in the same way so much can be reused via shared device handlers that deal with conversions of non-standard quirks and deviations from the official specification standards set by the Zigbee Alliance.

Therefore each brand new device needs parsing and translation to convert the messages so are presented as virtual device representations that actually do follow the Zigbee specification standards. That is when someone needs to write a custom “quirk” (sometimes also referred to as a “converter”).

Device handlers/converters parse and translate/convert any non-standard Zigbee attribute(s) and value(s) or other deviating quirks into standard Zigbee attribute(s) and value(s) which then the ZHA integration can understand.

By the way, unlike some proprietary Zigbee solutions such as for example Tuya or Aqara/Xiaomi own Zigbee gateways the ZHA integration implementation and its zigpy dependency has been designed to follow the official Zigbee specification standard and therefore all devices that actually do follow the Zigbee specification standard should just work out-of-the-box without the need of any custom device handlers.

PS: Zigbee2MQTT also require Zigbee Device Handlers but they call them " zigbee-herdsman converters":

https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html

https://github.com/Koenkk/zigbee-herdsman-converters/tree/master/

Sorry to resurrect this somewhat-old post, but this is the main result when searching for these knobs within HA, so…

I bought a couple of these, and I’m having a hard time figuring out how to properly configure them in HA. To my understanding, the only way to make physical buttons trigger actions inside HA is to create a bunch of automations, for each one of the triggers, right? (gosh, HA needs to create “automation categories” for us to group those ASAP).

Besides that, most of these triggers don’t have clear meaning, and are disconnected from the events fired as seen in Dev Tools > Events > Listen. Thus, I’ve opened a new GH issue to request some renaming / clarification. Here’s what I could gather about these little knobs: [Device Support Request] Clarify Tuya smart knob (TS004F) automation events · Issue #1808 · zigpy/zha-device-handlers · GitHub

One trigger for each button. There can’t possibly be less.
You could either make one automation for all the remotes or one per remote and use trigger id to separate the actions.

Events are just something you need to listen for and copy paste to the automation. There is no logic to the values usually.
But doesn’t ZHA expose the remote as a device?

One trigger for each button of each remote… What means for three remotes (one for each bedroom) with possibly 10 actions each… That’s 30 automations polluting the panel and 30 repeated settings I have to make :skull_and_crossbones: I understand why, but I hope this gets a big improvement in future releases :pray:

EDIT: it seems this has been requested more than three years ago. I made a more specialized request of a controller config screen.

As far as I can understand, the events from ZHA are turned into automation triggers, but they’re confusing (I guess because the triggers use standard names which don’t exactly fit the knob actions), to say the least. Then I went down the rabbit role to investigate the actual events and came up with that GH report to see if this can be improved.
And yes, there’s a Zigbee device, but it only shows the battery level and an “identify button” which I can press in the UI but have no clue what that’s for :sweat_smile: But that’s the device the triggers are attached to.

No.
It can be one automation as I said before.

OH. RIGHT. Sorry! I didn’t understand what you meant so I guess my brain ignored it - since it seems to not be a standard option in the UI.

Could you give an example on how to create a single automation for many triggers and then split actions by the trigger?

One way to do this is to give each trigger a trigger id. Then use the Choose action to run actions based on which trigger occurred:

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - binary_sensor.bathroom_motion_sensor_ias_zone
    id: Motion in bathroom
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.bedroom_2_motion_sensor_ias_zone
    id: "Motion in bedroom "
    to: "on"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Motion in bathroom
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.bathroom_ceiling_light_2_level_on_off
      - conditions:
          - condition: trigger
            id: "Motion in bedroom "
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.bedroom_2_ceiling_light_level_on_off

1 Like

WOW. No clue that was possible. Don’t recall seeing that in docs, but found it here.

That sort of changed my life - while it’s still a bit tiring to configure it all by hand, it will definitely be cleaner now! Will try to learn on blueprints too.

Thanks for the description and example! And thanks to @Hellis81 too, for the sort of early pointer which I missed :slight_smile:

If you learn more advanced yaml then you could use variables or using a device mapper to convert to what target device you want to control.

As an example:

{% set target = {"f594d0a16628c130b023f476a35c0091": "livingroom", "other device ID": "bedroom"} %}

could translate the trigger device_id to what room you want to control.
And from that you then use:

service: button.press
data: {}
target:
  entity_id: "button.{{ target[trigger.event.data.device_id }}]_volume_up"

Or whatever the service call is to change volume.
That means all your remotes can work under one automation if you have a strict naming convention so that a template like above works.

Hi, I know this treat is for ZHA, but maybe someone knows how I get this device supported in Z2M. What I tried so far: How to get my Zigbee2MQTT device working (TS004F)

Hey guys,

Has anyone made a blueprint where I can specify events? I want to use this as a media control device.

Thanks

I made a custom quirk for this device specifically TZ3000_abrsvsou - TS004F

Supports : Mode Change from Hue / Temp Control and Normal Mode,
Single, Double and Toggle, Left Rotate, Right Rotate, Press and Rotate - Left Right. Detect Tripple Presses for Mode Change. Hope this helps someone :slight_smile:

"""Tuya TS004F devices."""
from __future__ import annotations
from zhaquirks.tuya.mcu import EnchantedDevice #old versions
#from zhaquirks.tuya import EnchantedDevice #2024.2 onward
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import (
    Basic,
    Groups,
    Identify,
    LevelControl,
    OnOff,
    Ota,
    PowerConfiguration,
    Scenes,
    Time,
)
from zigpy.zcl.clusters.lighting import Color
from zigpy.zcl.clusters.lightlink import LightLink
from zhaquirks.const import (
    ALT_SHORT_PRESS,
    BUTTON,
    BUTTON_1,
    BUTTON_2,
    BUTTON_3,
    BUTTON_4,
    CLUSTER_ID,
    COMMAND,
    COMMAND_MOVE,
    COMMAND_MOVE_SATURATION,
    COMMAND_OFF,
    COMMAND_ON,
    COMMAND_STEP,
    COMMAND_STOP,
    COMMAND_STOP_MOVE_STEP,
    COMMAND_TOGGLE,
    DEVICE_TYPE,
    DIM_DOWN,
    DIM_UP,
    DOUBLE_PRESS,
    ENDPOINT_ID,
    ENDPOINTS,
    INPUT_CLUSTERS,
    LEFT,
    LONG_PRESS,
    LONG_RELEASE,
    MODEL,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PARAMS,
    PROFILE_ID,
    RIGHT,
    ROTATED,
    ROTATED_FAST,
    ROTATED_SLOW,
    SHORT_PRESS,
    TURN_OFF,
    TURN_ON,
    ARGS,
    
)
from zhaquirks.tuya import (
    TuyaNoBindPowerConfigurationCluster,
    TuyaSmartRemoteOnOffCluster,
    TuyaZBExternalSwitchTypeCluster,
)

#Some of the TZ3000_abrsvsou TS004F Customizations
ROTATED_PRESSED = "Press Rotate Knob HUE Mode Only"
COMMAND_STEP_COLOR_TEMP = "step_color_temp"
PRESSED = "pressed"
TOGGLE = "toggle"
ATTRIBUTE_UPDATED = "attribute_updated"
TRIPPLE_PRESSED = "Tripple Press"
TRIPPLE_PRESSED_NORMAL_MODE = "Tripple press to Normal Mode"
TRIPPLE_PRESSED_HUE_MODE = "Tripple press to HUE Mode"
ROTATED_HUE = "Rotate in HUE Mode"
ROTATED_NORMAL = "Rotate in Normal Mode"
DOUBLE_PRESS = "Double Click in Normal Mode"
LONG_PRESS = "Long Press in Normal Mode"
LONG_PRESS_HUE = "Long Press in HUE Mode"
BUTTON_1_HUE = "Button 1 in Hue Mode"
BUTTON_1_NORMAL = "Button 1 in Normal Mode"

class TuyaSmartRemote004FROK(EnchantedDevice):
    """Tuya Smart (rotating) Knob device."""

    signature = {
        # "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0, *allocate_address=True, *complex_descriptor_available=False, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False, *is_valid=True, *logical_type=<LogicalType.EndDevice: 2>, *user_descriptor_available=False)",
        # SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 6, 4096], output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096])
        MODELS_INFO: [
            ("_TZ3000_4fjiwweb", "TS004F"),
            ("_TZ3000_uri7ongn", "TS004F"),
            ("_TZ3000_ixla93vd", "TS004F"),
            ("_TZ3000_qja6nq5z", "TS004F"),
            ("_TZ3000_csflgqj2", "TS004F"),
            ("_TZ3000_abrsvsou", "TS004F"),
        ],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    OnOff.cluster_id,
                    LightLink.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                    Time.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    LightLink.cluster_id,
                ],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaNoBindPowerConfigurationCluster,
                    Identify.cluster_id,
                    Groups.cluster_id,  # Is needed for adding group then binding is not working.
                    LightLink.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                    Time.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaSmartRemoteOnOffCluster,
                    LevelControl.cluster_id,
                    Color.cluster_id,
                    LightLink.cluster_id,
                ],
            },
        },
    }

    device_automation_triggers = {
        #HUE MODE STUFF 
        (LONG_PRESS_HUE, BUTTON): {
            COMMAND: COMMAND_MOVE_SATURATION,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 768,
            PARAMS: {"move_mode": 1},
        },
        (ROTATED_HUE, RIGHT): {
            COMMAND: COMMAND_STEP,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 8,
            PARAMS: {"step_mode": 0},
        },
        (ROTATED_HUE, LEFT): {
            COMMAND: COMMAND_STEP,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 8,
            PARAMS: {"step_mode": 1},
        },
        (ROTATED_PRESSED, RIGHT): {
            COMMAND: COMMAND_STEP_COLOR_TEMP,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 768,
            PARAMS: {"step_mode": 1, "color_temp_min_mireds": 153},
        },
        (ROTATED_PRESSED, LEFT): {
            COMMAND: COMMAND_STEP_COLOR_TEMP,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 768,
            PARAMS: {"step_mode": 3, "color_temp_min_mireds": 153},
        },
        (TOGGLE, BUTTON_1_HUE): {
            COMMAND: TOGGLE,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 6,
        },
        (TRIPPLE_PRESSED_NORMAL_MODE, BUTTON_1_HUE): {
            COMMAND: ATTRIBUTE_UPDATED,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 6,
            ARGS: {"attribute_name": "switch_mode", "attribute_id": 32772, "value": 1},
        },
        (TRIPPLE_PRESSED_HUE_MODE, BUTTON_1): {
            COMMAND: ATTRIBUTE_UPDATED,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 6,
            ARGS: {"attribute_name": "switch_mode", "attribute_id": 32772, "value": 0},
        },
        (SHORT_PRESS, BUTTON_1_NORMAL): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
        (LONG_PRESS, BUTTON_1_NORMAL): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
        (DOUBLE_PRESS, BUTTON_1_NORMAL): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
        (ROTATED_NORMAL, RIGHT): {
            COMMAND: RIGHT,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 6,
        },
        (ROTATED_NORMAL, LEFT): {
            COMMAND: LEFT,
            ENDPOINT_ID: 1,
            CLUSTER_ID: 6,
        },
    }

1 Like

it is now included? i did not need to install this quirk and found the device in zha?!
but i need a blueprint for this device?!