Fun with smart knob TS004F (TuYa ERS-10TZBVK-AA) in Home Assistant

Fun with smart knob TS004F (TuYa ERS-10TZBVK-AA) in Home Assistant

I recently have bought this little knob below.

13.28€ 10% de réduction|Zigbee Commutateur de bouton intelligent sans fil pour la maison intelligente, contrôleur de bouton de commutation à distance, fonctionne avec Zigéquation Gateway, Smart Life Andrea | AliExpress
Achetez malin, vivez mieux! Aliexpress.com

It comes with battery already installed and is quite powerful. It can respond to push, double push, long push, turn left and turn right.

It paired with Zigbee2MQTT with no problem.

While it is trivial to automate the pressing process, with this little thing I could, for example, turn on and off my three lights in my office with this blue print:

alias: Rotator Gabinet
description: ""
use_blueprint:
  path: rdeangel/zigbee2mqtt-tuya-moes-smart-knob-ers-10tzbvk-aa.yaml
  input:
    switch: sensor.rotator_action
    button_short_press:
      - service: light.toggle
        metadata: {}
        data: {}
        target:
          entity_id: light.filament_gabinet
    button_double_press:
      - service: switch.toggle
        target:
          entity_id: switch.halogen_gabinet
        data: {}
    button_long_press:
      - service: light.toggle
        metadata: {}
        data: {}
        target:
          entity_id: light.gabinet

However, it took me a while to figure out how to use the left-hand dial to dim the lights and then turn them off.

Here is a problem, if we use rotate_right to increase light, we can use service light.turn_on with additional parameter brightness_step with value for example 10, which makes light 10% brighter every time we rotate knob.

button_rotate_right:
      - service: light.turn_on
        target:
          entity_id:
            - light.filament_gabinet
        data:
          brightness_step: 10

This is also visible in GUI version:

Great, I just wanted to do the same with dimming, so I select the turn_off service, and... well, it can turn off the light or slow the process down a bit with a transition time, and thats it. And of course this is not what I wanted.

I experimented a bit with some scripting using a float of -0.10 for the brightness value of the light, but it didn't work at all.

Then it hit me - let's just turn the light off by turning it on with a negative value!

As silly as it sounds, to my surprise it worked just like it did straight out of the box. 🤩🤩🤩

So putting it like this:

button_rotate_left:
      - service: light.turn_on
        target:
          entity_id:
            - light.filament_gabinet
        data:
          brightness_step: -10

Actually, it worked the other way round. While it is on, the brightness decreases until the light is turned off! I also thought that while it is off there might be quirks with switching on/off light with backward step, maybe some flashing or errors in the automation, but no, it just stays off, so this is just perfect solution. 😄

All together in automation:

alias: Rotator Gabinet
description: ""
use_blueprint:
  path: rdeangel/zigbee2mqtt-tuya-moes-smart-knob-ers-10tzbvk-aa.yaml
  input:
    switch: sensor.rotator_action
    button_short_press:
      - service: light.toggle
        metadata: {}
        data: {}
        target:
          entity_id: light.filament_gabinet
    button_double_press:
      - service: switch.toggle
        target:
          entity_id: switch.halogen_gabinet
        data: {}
    button_long_press:
      - service: light.toggle
        metadata: {}
        data: {}
        target:
          entity_id: light.gabinet
    button_rotate_right:
      - service: light.turn_on
        target:
          entity_id:
            - light.filament_gabinet
        data:
          brightness_step: 10
    button_rotate_left:
      - service: light.turn_on
        target:
          entity_id:
            - light.filament_gabinet
        data:
          brightness_step: -10