Skip to content

Instantly share code, notes, and snippets.

@tube0013
Created April 30, 2023 15:47
Show Gist options
  • Select an option

  • Save tube0013/c54b86dc3c84c71f2687b1e58c5124ab to your computer and use it in GitHub Desktop.

Select an option

Save tube0013/c54b86dc3c84c71f2687b1e58c5124ab to your computer and use it in GitHub Desktop.
blueprint:
name: Use a Terncy Smart Dial to control covers
description: |
• Turn the dial left or right to change the cover position.
• Single click to toggle open or close fully.
• Double click to set a favorite cover position.
• 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_covers:
name: Covers
selector:
target:
entity:
domain: cover
smooth_transition:
name: Smooth Dial Transition
description: Turn on for a smoother dial brightness transition
default: false
selector:
boolean:
cover_step:
name: Cover Step
description: Each step of the dial changes cover position this amount
default: 5
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: "%"
favorite_position:
name: Favorite Position
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:
cover_step: !input cover_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: cover.set_cover_position
target: !input target_covers
data:
position: "{{ -(cover_step | int) * args.steps }}"
- conditions: "{{ command == 'rotate_right' }}"
sequence:
service: cover.set_cover_position
target: !input target_covers
data:
position: "{{ (cover_step | int) * args.steps }}"
- conditions: "{{ command == 'button_single' }}"
sequence:
service: cover.toggle
target: !input target_covers
- conditions: "{{ command == 'button_double' }}"
sequence:
service: cover.set_cover_position
target: !input target_covers
data:
position: !input favorite_position
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment