Skip to content

Instantly share code, notes, and snippets.

@kasnder
Last active May 4, 2026 13:54
Show Gist options
  • Select an option

  • Save kasnder/694397bdf16c700db36bc6acc532fb03 to your computer and use it in GitHub Desktop.

Select an option

Save kasnder/694397bdf16c700db36bc6acc532fb03 to your computer and use it in GitHub Desktop.
ZHA Tuya knob
blueprint:
name: ZHA Tuya knob - rotate + single/double/long press
description: Rotate left/right to dim, plus configurable actions for single, double, and long press.
domain: automation
input:
remote:
name: Remote
description: Tuya knob device
selector:
device:
integration: zha
multiple: false
light:
name: Light(s) to dim
selector:
target:
entity:
domain: light
step_percent:
name: Brightness step
description: Brightness change per rotation tick
default: 10
selector:
number:
mode: slider
min: 1
max: 50
unit_of_measurement: "%"
single_press_action:
name: Single press action
default: []
selector:
action: {}
double_press_action:
name: Double press action
default: []
selector:
action: {}
long_press_action:
name: Long press action
default: []
selector:
action: {}
mode: queued
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
action:
- variables:
command: "{{ trigger.event.data.command }}"
press_arg: "{{ trigger.event.data.args[0] if trigger.event.data.args else None }}"
step_percent: !input step_percent
- choose:
- conditions:
- "{{ command == 'press_type' and press_arg == 0 }}"
sequence: !input single_press_action
- conditions:
- "{{ command == 'remote_button_double_press' }}"
sequence: !input double_press_action
- conditions:
- "{{ command == 'remote_button_long_press' }}"
sequence: !input long_press_action
- conditions:
- "{{ command == 'right' }}"
sequence:
- service: light.turn_on
target: !input light
data:
brightness_step_pct: "{{ step_percent }}"
transition: 0.3
- conditions:
- "{{ command == 'left' }}"
sequence:
- service: light.turn_on
target: !input light
data:
brightness_step_pct: "-{{ step_percent }}"
transition: 0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment