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

I also use this device but I cannot listen via mqtt. How did you achieve this?

I installed mqtt integration, created a username and password and activated it. I couldn’t figure out how to listen to this and my other zigbee devices. I couldn’t do it.

Thank you for the code. It is great. I had some little problems when I first set it but I was able to edit the blueprint and everything works.
I had to change 2 small things on it to work, my edited version is here:

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
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
1 Like

these are the only sensors exposed …any way to fix

this is great, thanks a lot for sharing. This is so far the smoothest code i found to control my light with this Knob.
any chance somebody can guide on how to implement color temperature control?
i know the commad equivalent

"{{ command == ''color_temperature_step_up'' }}"

but i don’t know which is the equivalent color temp code of the below:

brightness_step_pct: "-{{ step_percent }}"
transition: 0.5

i would love to be able to use the same smooth transition and control for color temperature as well :slight_smile:

thanks in advance!

I bought this device this week and using this blueprint from the beginning of the page. It seems to be working, but it’s very slow to increase/decrease brightness with z2m. Any way to solve it?"

1 Like

Thank you so much for this!
This is definitely the smoothest and most natural way to use this device.

I would also love to have to ability to control color temperature. Will try to figure this out.

FWIW this is my solution for now for a light entitiy - see below.

This will only work in command mode.

Supports:
-light entity toggle (single click)
-brightness dimming (turn button)
-prevents dimming to 0 and therefore switching off the light. The Minimum brightness is adjustable through a variable.
-color temperature (press & turn) with safety mechanisms: you can define min and max Kelvin values of your specific bulb through variables
-fine-tune the resolution for color temperature adjustments via step_multiplier variable (recommended between 4 to 8 but feel free to experiment)

For now not a blueprint but a normal automation. So if somebody uses it you will have to adjust to your specific MQTT topic and the light entity.

alias: Moes Tuya Smart Knob - Command mode functionality
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/Tuya Dimmerknopf Schlafzimmer Nachttisch Ben
condition: []
action:
  - variables:
      command: "{{ trigger.payload_json.action }}"
      step_size: "{{ trigger.payload_json.action_step_size }}"
      step_percent: >-
        {% if is_number(step_size) %} {{ (step_size / 2 ) | int }} {% else %} {{ 0 }} {% endif %}
      step_multiplier: 5
      kelvin_min: 2000
      kelvin_max: 6500
      min_brightness: 1
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ command == 'toggle' }}"
        sequence:
          - service: light.toggle
            target:
              entity_id: light.hue_play_leselampe_ben
            data: {}
      - conditions:
          - condition: template
            value_template: "{{ command == 'brightness_step_down' }}"
        sequence:
          - service: light.turn_on
            data_template:
              brightness: >-
                {% set current_brightness = state_attr('light.hue_play_leselampe_ben', 'brightness') | int %}
                {% set new_brightness = current_brightness - (step_percent * 255 / 100) %}
                {{ [new_brightness, min_brightness] | max }}
              transition: 0.3
            target:
              entity_id: light.hue_play_leselampe_ben
      - conditions:
          - condition: template
            value_template: "{{ command == 'brightness_step_up' }}"
        sequence:
          - service: light.turn_on
            data_template:
              brightness_step_pct: "{{ step_percent }}"
              transition: 0.3
            target:
              entity_id: light.hue_play_leselampe_ben
      - conditions:
          - condition: template
            value_template: "{{ command == 'color_temperature_step_up' }}"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.hue_play_leselampe_ben
            data_template:
              kelvin: >-
                {% set current_kelvin = state_attr('light.hue_play_leselampe_ben', 'color_temp_kelvin') %}
                {% if current_kelvin is not none %}
                  {{ [current_kelvin + (step_percent * step_multiplier), kelvin_max] | min }}
                {% else %}
                  2800
                {% endif %}
              transition: 0.2
      - conditions:
          - condition: template
            value_template: "{{ command == 'color_temperature_step_down' }}"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.hue_play_leselampe_ben
            data_template:
              kelvin: >-
                {% set current_kelvin = state_attr('light.hue_play_leselampe_ben', 'color_temp_kelvin') %}
                {% if current_kelvin is not none %}
                  {{ [current_kelvin - (step_percent * step_multiplier), kelvin_min] | max }}
                {% else %}
                  2800
                {% endif %}
              transition: 0.2
mode: single
3 Likes

Great, thanks for sharing! Exactly what I was looking for!

I (like many others) can’t seem to get this button to work. I’ve got it connected fine on Zigbee2Mqtt but whenever I press the button or rotate, no events are emitted. It’s correctly identified, is this a Z2M issue?

I haver tried your automation, single press works fine, but rotation gives me this error on z2m:

“No converter available for ‘transition’ (1)”
"Publish ‘set’ ‘brightness’ to ‘Dimmer [Elena]’ failed: ‘Error: No datapoint defined for ‘transition’’ "

Amigo muchas gracias por tu configuracion, despues de dias buscando un ```
blueprint para mi Moes he conseguido dar con tu automatizacion y me ha funcionado a la primera, cambiando un par de cosas.
de verdad mil gracias por tu aporte¡¡¡¡¡
un saludo

1 Like

Thank you so much for sharing (:
it worked like a charm <3

as a suggestion is it possible to add the command mode set so command mode is set every time to ensure its on?

with kind regards

Hi. Thanks for sharing your automation. I could not get the blueprints to work so far as I cannot find my bulb in the list of available entities. However, only the toggle action works for me. When I go into z2m I get the following error:

Works like a charm. Thank a lot!
One thing though. It dig go off when I turn it all the way down. What do I need to change?

Happy to hear!

If you want to dim to 0 (and therefore effectively turn off the light) just change min_brightness: 1 in the variables block to 0.

BR

So I took the time, transferred the basic idea of this automation into an blueprint and added a couple more feature including keeping the knob in command-mode automatically:

Feel free to check it out.