Skip to content

Instantly share code, notes, and snippets.

@SpeedyGoneZales
Last active March 14, 2025 21:30
Show Gist options
  • Save SpeedyGoneZales/e01dc9f73fac9398ff4f38863bc2d08b to your computer and use it in GitHub Desktop.
Save SpeedyGoneZales/e01dc9f73fac9398ff4f38863bc2d08b to your computer and use it in GitHub Desktop.
ZHA Tuya Rotary Switch _TZ3000_402vrq2i (TS004F)
blueprint:
name: Tuya Rotary Switch
description: Automate your Tuya rotary switch using ZHA events.
domain: automation
input:
tuya_rotary_dimmer_switch:
name: Tuya Rotary Dimmer Switch
description: Tuya Rotary Dimmer Switch
selector:
device:
integration: zha
manufacturer: _TZ3000_402vrq2i
model: TS004F
button_press:
name: Toggle
description: Push button
default: []
selector:
action: {}
rotate_right:
name: Dim up
description: Rotate right
default: []
selector:
action: {}
rotate_left:
name: Dim down
description: Rotate left
default: []
selector:
action: {}
button_press_right:
name: Hold and rotate right
description: Rotate right while holding
default: []
selector:
action: {}
button_press_left:
name: Hold and rotate left
description: Rotate left while holding
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'tuya_rotary_dimmer_switch'
action:
- variables:
command: '{{ trigger.event.data.command }}'
step_mode: '{{ trigger.event.data.params.step_mode }}'
- choose:
- conditions: '{{ command == ''toggle'' }}'
sequence: !input 'button_press'
- conditions: '{{ command == ''step'' and step_mode == ''StepMode.Up'' }}'
sequence: !input 'rotate_right'
- conditions: '{{ command == ''step'' and step_mode == ''StepMode.Down'' }}'
sequence: !input 'rotate_left'
- conditions: '{{ command == ''step_color_temp'' and step_mode == ''StepMode.Up'' }}'
sequence: !input 'button_press_right'
- conditions: '{{ command == ''step_color_temp'' and step_mode == ''StepMode.Down'' }}'
sequence: !input 'button_press_left'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment