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
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?"
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
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
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.
I tried several blueprints to make this controller work reliably and with lower latency.
I couldn’t find one that worked for me.
But then I a reddit commentor proposed using ControllerX, available for AppDeamon via HACS. And it works. Reliable and swift reaction to my input, including holding and rotating.
Once you set up ControllerX according to their guide1, you can try my config after disabling all automations for your controller.
Here’s my current config for the controller:
<your_appdaemon_appname>:
module: controllerx
class: TuYaERS10TZBVKAALightController
integration:
name: z2m
listen_to: mqtt
controller: <friendly name in z2m>
light: <light entity, can be single or group>
release_delay: 0.001 # helped me to avoid a toggle event by releasing after holding
mapping:
# Command mode
brightness_step_up: click_brightness_up
brightness_step_down: click_brightness_down
toggle: toggle
hue_move: hold_brightness_toggle
hue_stop: release
color_temperature_step_up: click_color_down
color_temperature_step_down: click_color_up
1 You also need to activate the mqtt plugin and add username and password to your broker.
I’ve imported the @pbergman blueprint as suggested by @rdeangel in the OP.
When trying to use it, it only allows me to choose select
entities in the state
step, but the knob doesn’t expose any to HA. The action
sensor is just a normal sensor, not a select
. In my case sensor.living_room_knob_action
.
Is this correct?
What am I missing?
Edit: nvm. I saw the original post and noticed it says it should be the select entity that changes event to command mode. Still I took charge of the automation and adapted it to my needs.
Hi,
maybe look at my post if you need a smoother dimming experience. I’ve done some work to make it work better with zigbee2mqtt directly:
Tuya smart knob improved blueprint for Zigbee2Mqtt - Blueprints Exchange - Home Assistant Community
Nice work, will try have look! Currently i have some good result when leveraging the step size state to increase/decrease the brightness instead of letting ha increase/decrease the lights.
data_template:
brightness: >
{% set current = state_attr('light.some_light', 'brightness')|int(0) %}
{% set step_size = states('sensor.rotate_switch_action_step_size')|int(0) %}
{{ current + step_size if current + step_size < 255 else 255 }}
entity_id: light.some_light
action: light.turn_on
for command brightness up and
data_template:
brightness: >
{% set current = state_attr('light.some_light', 'brightness')|int(0) %}
{% set step_size = states('sensor.rotate_switch_action_step_size')|int(0) %}
{{ current - step_size if current - step_size > 0 else 0 }}
entity_id: light.some_light
action: light.turn_on
brightness down. The rotate_switch_action_step_size
is the Action step size
sensor of the device
Do you have the new (white) rotary button by any chance? Like this one: https://a.aliexpress.com/_EQayxwC
And would you mind sharing your full automation?
i don`t have that particular model. The ones i use are similar to this one and show up as Tuya ERS-10TZBVK-AA
i use my blue print for setting up the devices