Moes Smart Knob Lights Control

I’m having some issues binding my knob to a zigbee bulb in Zigbee2mqtt. Is there a trick to it? I’ve set up the binding from the knob in zigbee2mqtt but pressing the button and twisting the knob is not having any effect on the bulb.

Go to groups in z2m tab and make a new group called whatever then add the knob and (zigbee) bulb to that group.

Thanks I was missing that the bulb and knob need to be in the same group. Works great!

Hi, how did you make it being supported? Mine just shows unsupported device in z2m and I havent found much helpful information in how to get it running.

Thank you!

I’ve forked your blueprint with some improvements, including step percent configuration for both, pressed and unpressed rotations, and different lights for pressed and unpressed rotations (it allows me to control two lights with a single knob, but same light could be assigned for both if that’s not needed)

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

blueprint:
  name: ZHA - Moes Smart Knob for lights
  description: 'Control lights with a Moes Smart Knob.
    You can set functions for a single press. This allows you to assign, e.g., a scene
    or anything else.
    Rotating left/right will change the brightness smoothly of the selected light.
    Not all functionality of the device is available at time of writing, e.g. double
    press, long press and press and rotate.

    Original blueprint by seamus65 (https://gist.github.com/seamus65/939a147634942dd885c8704334627f93).

    Improved by GonzaloAlbito (https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731).

    Version 2022-11-15.'
  domain: automation
  input:
    remote:
      name: Remote
      description: Moes Knob to use
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_qja6nq5z
          model: TS004F
          multiple: false
    light:
      name: Light(s)
      description: The light(s) to control
      selector:
        target:
          entity:
            domain: light
    step_percent:
      name: Light step
      description: Light pecent change for each knob step
      selector:
        number:
          mode: slider
          min: 0
          max: 100
          unit_of_measurement: "%"
      default: 20
    press_light:
      name: Pressed light(s)
      description: The light(s) to control when pressed
      selector:
        target:
          entity:
            domain: light
    press_step_percent:
      name: Pressed light step
      description: Light pecent change for each knob step when pressed
      selector:
        number:
          mode: slider
          min: 0
          max: 100
          unit_of_measurement: "%"
      default: 5
    single_press:
      name: Single press
      description: Action to run on single press
      default: []
      selector:
        action: {}
  source_url: https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input remote
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    cluster_id: '{{ trigger.event.data.cluster_id }}'
    endpoint_id: '{{ trigger.event.data.endpoint_id }}'
    mode: '{% if command != ''toggle'' %} {{ trigger.event.data.args[0] }} {% endif %}'
    steps: '{% if command != ''toggle'' %} {{ (trigger.event.data.args[1] / 12.5 ) | int }} {% endif %}'
    step_percent: !input step_percent
    press_step_percent: !input press_step_percent
- choose:
  - conditions:
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''toggle'' }}'
    sequence: !input single_press
  - conditions:
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step'' }}'
    - '{{ mode == ''StepMode.Up'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input light
          data_template:
            brightness_step_pct: '{{ step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step'' }}'
    - '{{ mode == ''StepMode.Down'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input light
          data_template:
            brightness_step_pct: '-{{ step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step_color_temp'' }}'
    - '{{ mode == ''StepMode.Up'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input press_light
          data_template:
            brightness_step_pct: '{{ press_step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step_color_temp'' }}'
    - '{{ mode == ''StepMode.Down'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input press_light
          data_template:
            brightness_step_pct: '-{{ press_step_percent * steps }}'
            transition: 0.5
2 Likes

Nothing fancy… paired it with z2m, and got it working. I found that z2m has two operation modes for this button: command and event. I’m using “command” now.

Strange, I paired it with z2m, and under Manufacturer is written Unsupported. I guess thats why I can’t see it in my devices and entities. I did repair it, nothing changed. How did you select a operation mode?

It’s under “expose” tab.

The “about” tab looks like this:

Edit:

Sorry, Its not working. is it supposed to work with ZHA OR Zigbee2Mqtt?

I tried with ZHA and it says no device found.

It’s for ZHA.
I think there may be more than a single model. You may need to change these values
Screenshot_5
by the ones displayed in your device when you go to its information page:
Screenshot_6

2 Likes

Hi!
I was using your wonderful yaml, but encountered these three error today :frowning:



This is weird as I have two same device and it seems like they are sending different event when rotary is turned. One that works
image
This one doesn’t work
image

I have updated the blueprint as the enpoint id no longer exists, hopefully it works again.

There are two modes with the Moes smart knob, toggled with a triple press, and this blueprint only works with one mode, so if it isn’t working try a triple press and try again.

2 Likes

Here’s my updated version : zha_moes_smart_knob_lights.yaml · GitHub

It’s way simpler as it de-duplicates the increasing and decreasing actions. It also implements a speed percent argument.

Also it doesn’t use the argsarray but the params dict for readability.

2 Likes

Thank you. I added long press action and removed manufacturer lock.

blueprint:
  name: ZHA - Moes Smart Knob for lights
  description: 'Control lights with a Moes Smart Knob.
    You can set functions for a single press. This allows you to assign, e.g., a scene
    or anything else.
    Rotating left/right will change the brightness smoothly of the selected light.
    Not all functionality of the device is available at time of writing, e.g. double
    press, long press and press and rotate.
    Original blueprint by seamus65 (https://gist.github.com/seamus65/939a147634942dd885c8704334627f93).
    Improved by GonzaloAlbito (https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731).
    Version 2022-11-15.
    Edited by Gordio'
  domain: automation
  input:
    remote:
      name: Remote
      description: Moes Knob to use
      selector:
        device:
          integration: zha
          model: TS004F
          multiple: false
    light:
      name: Light(s)
      description: The light(s) to control
      selector:
        target:
          entity:
            domain: light
    step_percent:
      name: Light step
      description: Light pecent change for each knob step
      selector:
        number:
          mode: slider
          min: 0
          max: 100
          unit_of_measurement: "%"
      default: 20
    press_light:
      name: Pressed light(s)
      description: The light(s) to control when pressed
      selector:
        target:
          entity:
            domain: light
    press_step_percent:
      name: Pressed light step
      description: Light pecent change for each knob step when pressed
      selector:
        number:
          mode: slider
          min: 0
          max: 100
          unit_of_measurement: "%"
      default: 5
    single_press:
      name: Single press
      description: Action to run on single press
      default: []
      selector:
        action: {}
    long_press:
      name: Long press
      description: Action to run on long press
      default: []
      selector:
        action: {}
  source_url: https://gist.github.com/gonzaloalbito/3dc06702e941e08298ea9bfade731731
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input remote
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    cluster_id: '{{ trigger.event.data.cluster_id }}'
    endpoint_id: '{{ trigger.event.data.endpoint_id }}'
    mode: '{% if command != ''toggle'' %} {{ trigger.event.data.args[0] }} {% endif %}'
    steps: '{% if command != ''toggle'' %} {{ (trigger.event.data.args[1] / 12.5 ) | int }} {% endif %}'
    step_percent: !input step_percent
    press_step_percent: !input press_step_percent
- choose:
  - conditions:
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''toggle'' }}'
    sequence: !input single_press
  - conditions:
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''move_hue'' }}'
    sequence: !input long_press
  - conditions:
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step'' }}'
    - '{{ mode == ''StepMode.Up'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input light
          data_template:
            brightness_step_pct: '{{ step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step'' }}'
    - '{{ mode == ''StepMode.Down'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input light
          data_template:
            brightness_step_pct: '-{{ step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step_color_temp'' }}'
    - '{{ mode == ''StepMode.Up'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input press_light
          data_template:
            brightness_step_pct: '{{ press_step_percent * steps }}'
            transition: 0.5
  - conditions:
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ command == ''step_color_temp'' }}'
    - '{{ mode == ''StepMode.Down'' }}'
    sequence:
    - repeat:
        while:
        - condition: template
          value_template: '{{ repeat.index < 2 }}'
        sequence:
        - service_template: light.turn_on
          target: !input press_light
          data_template:
            brightness_step_pct: '-{{ press_step_percent * steps }}'
            transition: 0.5
1 Like

Were you ever able to get this working as a volume control? I’m receiving my devices tomorrow and I was hoping to use them for this purpose.

Hello! I have been having the same problem for a few weeks now.
Could you solve it?

Hi,

Possible to change the light color via the rotary method? Example blue , red or etc

Well, I leave this in case it happens to someone, I solve it by deleting the Device and adding it again. He rarely did Blueprint automation but it didn’t reflect on the Devices he commanded.

Hello everyone,

here is my blueprint to use the Moes Smart Knob as Volume Controller. I’ve made it very flexible (no hardcoded media-controll). Hope you like it.

1: Your Moes Device
2: Your Media-Player to controll the volume
3. Optional (second) Device for the Button-Push-Action
4. What to when pushing the button (I use ADB from FireTV to Start / Pause Playback)

blueprint:
  name: ZHA - Moes Tuya Smart Knob (TS004F) controller for media_player
  description: Steuern Sie die Lautstärke des Media Players und setzen Sie Play/Pause darauf
  domain: automation
  input:
    remote:
      name: Remote
      description: Moes Tuya Smart Knob-Gerät zur Verwendung
      selector:
        device:
          integration: zha
          model: TS004F

    media_player:
      name: MediaPlayer
      description: Der MediaPlayer, der gesteuert werden soll
      selector:
        target:
          entity:
            domain: media_player

    volume_step_size:
      name: Volume Step Size
      description: Wert der Drehung, der einer Lautstärke-Änderung von 1% entspricht
      default: 13
      selector:
        number:
          min: 1
          max: 100
          mode: slider
          step: 1

    secondary_media_player:
      name: Secondary MediaPlayer
      description: Ein weiterer MediaPlayer, der bei einem Tastendruck gesteuert werden soll
      selector:
        target:
          entity:
            domain: media_player

    button_custom_action:
      name: Button Custom Action
      description: Benutzerdefinierte Aktion, die beim Tastendruck ausgeführt werden soll
      selector:
        action: {}

mode: restart
max_exceeded: silent
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input 'remote'
action:
  - variables:
      command: '{{ trigger.event.data.command }}'
      cluster_id: '{{ trigger.event.data.cluster_id }}'
      endpoint_id: '{{ trigger.event.data.endpoint_id }}'
      args: '{{ trigger.event.data.args }}'
      step_type: >
        {% if args %}
          {% if 'StepMode.Up' in args %}
            up
          {% elif 'StepMode.Down' in args %}
            down
          {% endif %}
        {% else %}
          none
        {% endif %}
      amount: '{{ (args and args.split(",")[1] | int(default=50)) or 50 }}'
      rate: '{{ (args and args.split(",")[2] | int(default=1)) or 1 }}'
      volume_step_size: !input 'volume_step_size'
      # --- Media Player ---
      media_player_entity: !input 'media_player'
      media_player_is_on: "{{ states(media_player_entity.entity_id) not in ['off', 'unavailable', 'idle'] }}" # Überprüft, ob der Media Player eingeschaltet oder am Abspielen ist.
  - choose:
      - conditions:
          - '{{ command == "toggle" }}'
          - '{{ cluster_id == 6 }}'
          - '{{ endpoint_id == 1 }}'
        sequence: !input 'button_custom_action'

      - conditions:
          - '{{ command == "step" }}'
          - '{{ cluster_id == 8 }}'
          - '{{ endpoint_id == 1 }}'
          - '{{ media_player_is_on }}'
        sequence:
          - repeat:
              count: '{{ rate }}'
              sequence:
                - service: media_player.volume_set
                  target: !input 'media_player'
                  data:
                    volume_level: >
                      {% set current_volume = state_attr(media_player_entity.entity_id, 'volume_level') | float %}
                      {% set volume_increment = (amount | float) / volume_step_size / 100 %}
                      {% if step_type == 'up' %}
                        {% set new_volume = current_volume + volume_increment %}
                      {% elif step_type == 'down' %}
                        {% set new_volume = current_volume - volume_increment %}
                      {% endif %}
                      {% set new_volume = new_volume if 0 <= new_volume <= 1 else 0 if new_volume < 0 else 1 %}
                      {{ new_volume }}
                - delay: '00:00:01'  # Eine konstante Verzögerung zwischen den Befehlen

2 Likes

I used some of the code from your blueprint and created a blueprint for anyone who wants to import it directly.

It also supports push and rotate, increase and decrease volume.

Here is the link to it : ZHA - Moes Smart Knob for Media Player · GitHub

2 Likes