Zigbee2MQTT Tuya Moes Smart Knob (ERS-10TZBVK-AA)

Thank you - do you mean manually type that in the “Tuya Smart Knob” field in the blueprint? that didn’t seem to work for me. the automation won’t save (I’ve grabbed the right device ID from z2m).

It worked!!! Thanksss!!

Thanks for the tip!

This is not ideal but by using the blueprint from Alexandre above (command mode) and switching to event mode with the triple click it is then possible to get control over all events exposed by this knob.

Quite often, the blueprint decides to take no action. This is a typical trace:

Triggered by the state of sensor.radio_knob_action at 19. února 2023 18:29:57
Define variables command
Choose: No action taken
Finished at 19. února 2023 18:29:57 (runtime: 0.13 seconds)

The knob does send commands in the event mode properly according to Z2M log. What gives?

I combined some blueprints found above (rdeangel and checksummaster and possibly others) to give access to all the functions of Moes Smart knob.

blueprint:
  name: Zigbee2MQTT - Tuya Moes Smart Knob (Operation Mode = event or command)
  description: Automate your Tuya Smart Knob - ERS-10TZBVK-AA
  domain: automation
  input:
    switch:
      name: Tuya Smart Knob
      description: Tuya Smart Knob used in command or event mode (triple press will switch modes)
      selector:
        entity:
          integration: mqtt
          domain: sensor
          multiple: false
    event_button_short_press:
      name: Event - Single Press
      description: Action to run on single press (careful not to turn knob instead)
      default: []
      selector:
        action: {}
    event_button_double_press:
      name: Event - Double Press
      description: (Most likely won't work in command) Action to run on double press (careful not to turn knob instead)
      default: []
      selector:
        action: {}
    event_button_long_press:
      name: Event - Long Press
      description: Action to run on long press (at least 4 seconds - careful not to
        turn knob instead)
      default: []
      selector:
        action: {}
    event_button_rotate_right:
      name: Event - Rotate Right
      description: Action to run when Smart Knob is rotated right
      default: []
      selector:
        action: {}
    event_button_rotate_left:
      name: Event - Rotate Left
      description: Action to run when Smart Knob is rotated left
      default: []
      selector:
        action: {}
    command_button_short_press:
      name: Command - Single Press
      description: Action to run on single press (careful not to turn knob instead)
      default: []
      selector:
        action: {}
    command_button_long_press:
      name: Command - Long Press
      description: Action to run on long press (at least 4 seconds - careful not to
        turn knob instead)
      default: []
      selector:
        action: {}
    command_button_rotate_right:
      name: Command - Rotate Right
      description: Action to run when Smart Knob is rotated right
      default: []
      selector:
        action: {}
    command_button_rotate_left:
      name: Command - Rotate Left
      description: Action to run when Smart Knob is rotated left
      default: []
      selector:
        action: {}
    command_button_rotate_press_right:
      name: Command - Rotate Press Right
      description: Action to run when Smart Knob is rotated left
      default: []
      selector:
        action: {}
    command_button_rotate_press_left:
      name: Command - Rotate Press Left
      description: Action to run when Smart Knob is rotated left
      default: []
      selector:
        action: {}
  source_url: https://dummyurl.com/new
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input switch
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''single'' }}'
    sequence: !input event_button_short_press
  - conditions:
    - '{{ command == ''double'' }}'
    sequence: !input event_button_double_press
  - conditions:
    - '{{ command == ''hold'' }}'
    sequence: !input event_button_long_press
  - conditions:
    - '{{ command == ''rotate_right'' }}'
    sequence: !input event_button_rotate_right
  - conditions:
    - '{{ command == ''rotate_left'' }}'
    sequence: !input event_button_rotate_left
  - conditions:
    - '{{ command == ''toggle'' }}'
    sequence: !input command_button_short_press
  - conditions:
    - '{{ command == ''hue_move'' }}'
    sequence: !input command_button_long_press
  - conditions:
    - '{{ command == ''brightness_step_up'' }}'
    sequence: !input command_button_rotate_right
  - conditions:
    - '{{ command == ''brightness_step_down'' }}'
    sequence: !input command_button_rotate_left
  - conditions:
    - '{{ command == ''color_temperature_step_up'' }}'
    sequence: !input command_button_rotate_press_right
  - conditions:
    - '{{ command == ''color_temperature_step_down'' }}'
    sequence: !input command_button_rotate_press_left

Based on what I understood, the knob can be used in either event or command modes (a triple press will always switch modes) and the following functions are available:

Event mode:
-short press
-double press
-long press
-rotate right → seems to only send command when released
-rotate left → seems to only send command when released

Command mode:
-short press
-long press
-rotate right → seems to allow live dimming or volume control
-rotate left → seems to allow live dimming or volume control
-rotate-press right → seems to allow live dimming or volume control
-rotate-press left → seems to allow live dimming or volume control

As an example automation, I am using the following:

  • toggle lights (event and/or command - single press)
  • dim a light (command - rotate left/right), using device and increase/decrease brightness
  • start spotify on the room speaker (command - long press), using spotcast
  • change volume (command - rotate press left/right) using:
service: media_player.volume_set
data:
  volume_level: "{{ state_attr('media_player.nestmini4974', 'volume_level') | float +0.05 }}"
target:
  entity_id: media_player.nestmini4974

Switching to event mode (triple press) allows me to

  • play/pause the music (event - double press)
  • switch to previous / next song (event - rotate left/right)

Another automation is used to always reset the mode to command in order not to confuse other users too much:

device_id: knob
domain: select
entity_id: select.knob_operation_mode
type: select_option
option: command

This blueprint works well for my use. Please feel free to make a proper blueprint out of it (I had to write something under source_url in order to be able to use it).

5 Likes

Wow - this is great. Thank you!

The command/event mode detail is most helpful. It’s been a frustration around here, as my kid will often get a little over eager and press 3x. This combination will allow me to map both functions and hopefully increase usability.

trigger:
- platform : state

for w/e reason does not work for me, even if i add

legacy_triggers: true

to z2m config.

but mqtt trigger does so here is same bueprint but with mqtt trigger

blueprint:
  name: Zigbee2MQTT - Moes Knob TS004F
  description: Moes Knob (_TZ3000_4fjiwweb) via Zigbee2MQTT.
  domain: automation
  input:
    switch:
      name: TS004F Tuya Smart Knob
      description: mqtt topic of your Smart Knob to use
      selector:
        object:
    target:
      name: target
      description: mqtt topic of target for brightness up/down (add /set to the end)
      selector:
        object:
    short_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: {}
    double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: {}
    toggle:
      name: Toggle
      description: Action to run on Toggle
      default: []
      selector:
        action: {}
    hold:
      name: Hold
      description: Action to run on hold
      default: []
      selector:
        action: {}
    rotate_left:
      name: Rotate - Left
      description: Action to run on left rotation
      default: []
      selector:
        action: {}
    rotate_right:
      name: Rotate - Right
      description: Action to run on right rotation
      default: []
      selector:
        action: {}
    color_temperature_step_up:
      name: Color Temperature Step Up
      description: Action to run on hold & right rotation
      default: []
      selector:
        action: {}
    color_temperature_step_down:
      name: Color Temperature Step Down
      description: Action to run on hold & left rotation
      default: []
      selector:
        action: {}
mode: single
max_exceeded: silent
trigger:
  - platform: mqtt
    topic: !input switch
action:
  - variables:
      command: "{{ trigger.payload_json.action }}"
      size: "{{ trigger.payload_json.action_step_size }}"
  - choose:
      - conditions:
          - "{{ command == 'single' }}"
        sequence: !input "short_press"
      - conditions:
          - "{{ command == 'double' }}"
        sequence: !input "double_press"
      - conditions:
          - "{{ command == 'toggle' }}"
        sequence: !input "toggle"
      - conditions:
          - "{{ command == 'rotate_right' }}"
        sequence: !input "rotate_right"
      - conditions:
          - "{{ command == 'rotate_left' }}"
        sequence: !input "rotate_left"
      - conditions:
          - "{{ command == 'brightness_step_up' }}"
        sequence:
          - service: mqtt.publish
            data:
              topic: !input "target"
              payload: >
                {"brightness_step_onoff": {{( size * 0.5)|round}},"transition":0.1 }
      - conditions:
          - "{{ command == 'brightness_step_down' }}"
        sequence:
          - service: mqtt.publish
            data:
              topic: !input "target"
              payload: >
                {"brightness_step": -{{( size * 0.5)|round}},"transition":0.1 }
      - conditions:
          - "{{ command == 'color_temperature_step_up' }}"
        sequence: !input "color_temperature_step_up"
      - conditions:
          - "{{ command == 'color_temperature_step_down' }}"
        sequence: !input "color_temperature_step_down"
      - conditions:
          - "{{ command == 'hold' }}"
        sequence: !input "hold"

edit #n : sorry for constant edit, but I’m so excited that I finaly grasp the way it works. Added Antonio’s great code for smoother brightness stepping and moved “switch” and “target” (for brightness change) mqtt topics to input. It’s mostly “zigbee2mqtt/Friendly Name” of your device, you can also use MQTT Explorer

1 Like

The blueprint doesn’t work for me.
I tested the ones from rdeangel and prichard, I don’t understand where my mistake is.
Last Test:

**alias: Schalter RC Test
description: ""
use_blueprint:
  path: Z2M/tuya_smartknob.yaml
  input:
    switch: sensor.rc_test_action
    event_button_short_press:
      - service: media_player.media_play_pause
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    event_button_rotate_right:
      - service: media_player.volume_up
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    event_button_rotate_left:
      - service: media_player.volume_down
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    command_button_short_press:
      - service: media_player.media_play_pause
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    command_button_rotate_right:
      - service: media_player.volume_up
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    command_button_rotate_left:
      - service: media_player.volume_down
        data: {}
        target:
          entity_id:
            - media_player.alexa_mp_denon_wohnzimmer
            - media_player.denon_wohnzimmer
    command_button_rotate_press_right:
      - service: media_player.volume_set
        data:
          volume_level: >-
            {{ state_attr('media_player.alexa_mp_denon_wohnzimmer',
            'volume_level') | float +0.05 }}
        target:
          entity_id: media_player.alexa_mp_denon_wohnzimmer
    command_button_rotate_press_left:
      - service: media_player.volume_set
        data:
          volume_level: >-
            {{ state_attr('media_player.alexa_mp_denon_wohnzimmer',
            'volume_level') | float -0.05 }}
        target:
          entity_id: media_player.alexa_mp_denon_wohnzimmer
`Preformatted text`**

I am not sure if my Meos smart knob is defective or if there is some configuration issue. It is publishing one action 2 times. The first data has the correct action but the second data is empty. Also, for rotate actions, there is no action_step_size value. Has anyone else seen this issue? Attached Z2M logs below:

Info 2023-04-29 11:24:21MQTT publish: topic 'zigbee2mqtt/Bedroom Smart Knob', payload '{"action":"rotate_right","action_rate":null,"action_step_size":null,"action_transition_time":null,"battery":100,"linkquality":152,"operation_mode":"event","voltage":3000}'
Info 2023-04-29 11:24:21MQTT publish: topic 'zigbee2mqtt/Bedroom Smart Knob', payload '{"action":"","action_rate":null,"action_step_size":null,"action_transition_time":null,"battery":100,"linkquality":152,"operation_mode":"event","voltage":3000}'
Info 2023-04-29 11:24:21MQTT publish: topic 'zigbee2mqtt/Bedroom Smart Knob/action', payload 'rotate_right'

Due to this HA reads the empty (last) value and none of the automation is triggering.

I’m trying to use this blueprint to control the brightness of my Wifi Tuya lamp. The problem is, the lamp doesn’t have a “increase brightness” command. I can only set a valuem between 10 (minimum brightness) and 1000 (maximum brightness). So I was wondering, is there a way that I can configure the “rotate right” command to increment the number value by a pre-defined step? For example, with this blueprint I can trigger a set_value action like this (example for maximum value):

  button_rotate_right:
      - device_id: XXXXXX
        domain: number
        entity_id: number.brightness
        type: set_value
        value: 1000

However, I would like to set an action to do something like:

number.brightness = number.brightness + step_value

This way I can gradually increase brightness. I’m not familiar to Home Assistant coding, so I’m totally lost here. Can somebody help me with this?

Wow, this smart knob is a tricky one!

I can get my knob to work as seperate automations
‘’'YAML

alias: Nathans Dimmer Rotate Right
description: “test”
trigger:

  • platform: device
    domain: mqtt
    device_id: 26f938600e99c13f570db7890e9a6659
    type: action
    subtype: rotate_right
    discovery_id: 0xdc8e95fffeb8d9dd action_rotate_right
    condition: []
    action:
  • device_id: f55f3cd5c2b83f72404077a3c0884248
    domain: light
    entity_id: light.0x385b44fffe054c9b
    type: brightness_increase’’’

‘’’

But - My device is picked up as an ‘action’ rather than an event or command
so, alll these blueprints don’t seem to work - unless I change the MQTT informatino to ‘action’

I’m trundling slowly picking it up

So far, with seperate automations I can get every function going,
just unsure how to combine into one automation

1 Like

Is there an updated working blueprint? I’ve tried the one at the beginning of the topic but it does not work.

I’ve just uploaded a working config of the event mode to ‘switch manager’

Still working on the command mode

GitHub - Sian-Lee-SA/Home-Assistant-Switch-Manager: Switch manager is a centralised component to handle button pushes for your wireless switches. This includes anything passed through the event bus. The component relies on switch blueprints which is easily made to allow GUI configuration of your switches and their button pushes. This helps remove clutter from the automations.Switch manager GitHub

2 Likes

i already use switch manager but I can no see the moes knob, how can I add it?

I’m new to Github
my submission is here - Downloading those two files into your blueprints directory and re-starting will do the trick

GitHub commit

thanks, not necessary, a guy changed the only thing requested and now your branch is merged to master, in next release will be available for everyone!

Not working for me.
At blueprint has this error: String does not match the pattern of "DEPRECATED


- id: "1680983583560"
  description: ""
  alias: Zigbee2MQTT - Tuya Moes Smart Knob (Operation Mode = event)
  use_blueprint:
    path: rdeangel/zigbee2mqtt-tuya-moes-smart-knob-ers-10tzbvk-aa.yaml
    input:
      button_short_press:
        - service: notify.persistent_notification
          data:
            message: Knock triggered to Single action
            title: Knock
      switch: sensor.dimmer_bedroom_action
      button_double_press:
        - service: notify.persistent_notification
          data:
            message: "Knock triggered to Single double "
            title: Knock
      button_rotate_right:
        - service: notify.persistent_notification
          data:
            message: Knock triggered to Rotate right action
            title: Knock

Automation not triggered. operation mode is event.

You need to switch the mode (triple-press the button)

Same here. It worked for some month w/o issues, and now it‘s completely erratic. Just about 1 out of 5 operations are picked up by the automation. In all other cases it detects the Tuya events, but decides to do nothing. Mode is set correctly to „event“, and nothing changed with the setup of the Tuya or the automation derived from the blueprint.

The according logs from MQTT device overview are identical to the ones above (in German….sorry…)

Maybe something changed in the way these three events are forwarded to the automation? Tried debouncing, but couldn‘t find any setting that would help. Only rarely the actual first „single“ event is executed upon, and it mostly is overshadowed by the two following ones…

1 Like