-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblueprint.yaml
70 lines (65 loc) · 2.04 KB
/
blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
blueprint:
name: Universal Smart Knob Control
description: Control any entity with a Smart Knob using customizable rotation and click actions
domain: automation
input:
brightness_sensor:
name: Brightness Delta Sensor
description: Sensor providing brightness delta values from Smart Knob rotation
selector:
entity:
domain: sensor
click_sensor:
name: Click Action Sensor
description: Sensor providing click actions from Smart Knob (expects 'toggle' state)
selector:
entity:
domain: sensor
rotation_action:
name: Rotation Action
description: Action to execute when rotating the knob. Use 'delta_value' variable for the rotation value.
selector:
action: {}
click_action:
name: Click Action
description: Action to execute when clicking the knob
selector:
action: {}
mode: parallel
max_exceeded: silent
trigger:
- platform: state
entity_id: !input brightness_sensor
id: rotation
- platform: state
entity_id: !input click_sensor
to: toggle
id: click
action:
- choose:
# Handle rotation action
- conditions:
- condition: trigger
id: rotation
- condition: template
value_template: >
{{ not is_state(trigger.entity_id, 'unavailable') and
not is_state(trigger.entity_id, 'unknown') and
trigger.to_state.state not in ['unavailable', 'unknown'] }}
sequence:
- variables:
delta_value: "{{ trigger.to_state.state | float(0) / 12.5 }}"
- alias: "Execute rotation action"
sequence: !input rotation_action
# Handle click action
- conditions:
- condition: trigger
id: click
sequence:
- alias: "Execute click action"
sequence: !input click_action
default:
- service: logbook.log
data:
name: "Smart Knob Debug"
message: "Unhandled state: {{ trigger.to_state.state }}"