This is a blueprint to use a Terncy Smart Dial to control lights. The Terncy Smart Dial (TERNCY-SD01) is a zigbee device which I’ve connected using Zigbee Home Automation (ZHA). It’s an awesome little device, this blueprint is a simple example.
The Blueprint UI:
The Blueprint yaml:
-
2021-Feb-05: Added a trigger condition to check against a list of event commands
The smart dial sends a “checkin” event command every 15 minutes which caused this automation to run and do nothing. That just fills up the logs and is pointless, so now the automation will only run when an actionable command is issued by the dial.
blueprint:
name: Use a Terncy Smart Dial to control lights
description: |
• Turn the dial left or right to change the brightness.
• Single click to toggle lights off and on.
• Double click to set a favorite brightness level.
• Triple, Quadruple, and Quintuple clicks are configurable.
domain: automation
input:
dial:
name: Terncy Smart Dial
description: "Model: TERNCY-SD01"
selector:
device:
integration: zha
model: TERNCY-SD01
target_lights:
name: Lights
selector:
target:
entity:
domain: light
smooth_transition:
name: Smooth Dial Transition
description: Turn on for a smoother dial brightness transition
default: false
selector:
boolean:
brightness_step:
name: Brightness Step
description: Each step of the dial changes brightness this amount
default: 5
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: "%"
favorite_brightness:
name: Favorite Brightness
description: Double click to set this brightness
default: 25
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: "%"
triple_click:
name: Triple Click
default: []
selector:
action:
quadruple_click:
name: Quadruple Click
default: []
selector:
action:
quintuple_click:
name: Quintuple Click
default: []
selector:
action:
variables:
brightness_step: !input brightness_step
smooth_transition: !input smooth_transition
command_list:
- rotate_left
- rotate_right
- button_single
- button_double
- button_triple
- button_quadruple
- button_quintuple
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input dial
condition: "{{ trigger.event.data.command in command_list }}"
action:
- variables:
command: "{{ trigger.event.data.command }}"
args: "{{ trigger.event.data.args }}"
- choose:
- conditions: "{{ command == 'rotate_left' }}"
sequence:
service: light.turn_on
target: !input target_lights
data:
brightness_step_pct: "{{ -(brightness_step | int) * args.steps }}"
transition: "{{ 1 if smooth_transition else 0 }}"
- conditions: "{{ command == 'rotate_right' }}"
sequence:
service: light.turn_on
target: !input target_lights
data:
brightness_step_pct: "{{ (brightness_step | int) * args.steps }}"
transition: "{{ 1 if smooth_transition else 0 }}"
- conditions: "{{ command == 'button_single' }}"
sequence:
service: light.toggle
target: !input target_lights
- conditions: "{{ command == 'button_double' }}"
sequence:
service: light.turn_on
target: !input target_lights
data:
brightness_pct: !input favorite_brightness
transition: 1
- conditions: "{{ command == 'button_triple' }}"
sequence: !input triple_click
- conditions: "{{ command == 'button_quadruple' }}"
sequence: !input quadruple_click
- conditions: "{{ command == 'button_quintuple' }}"
sequence: !input quintuple_click