-
Notifications
You must be signed in to change notification settings - Fork 28
/
philips_zigbee_dial.yaml
182 lines (182 loc) · 6.61 KB
/
philips_zigbee_dial.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
blueprint:
name: Philips Tap Dial Switch
description: 'Control lights with a Philips Hue Tap Switch.
Use the four buttons to control up to four light(s) with an on/off toggle. The dial can be used to dim the most recently used light.
'
domain: automation
input:
remote:
name: Philips Hue Tap Switch
selector:
device:
integration: zha
manufacturer: Signify Netherlands B.V.
model: RDM002
first_light:
name: First Light
description: The light(s) to control with first button
selector:
target:
entity: {}
second_light:
name: (OPTIONAL) Second Light
description: The light(s) to control with second button
default: {}
selector:
target:
entity: {}
third_light:
name: (OPTIONAL) Third Light
description: The light(s) to control with third button
default: {}
selector:
target:
entity: {}
forth_light:
name: (OPTIONAL) Forth Light
description: The light(s) to control with forth button
default: {}
selector:
target:
entity: {}
current_light:
name: (OPTIONAL) Current Light
description:
'Text helper to track the current light to dim. Set for the dimmer controls to change which light they are controlling according to the last one turned on.'
default:
selector:
entity:
domain: input_text
dim_scale:
name: Diming Scale
description: Scale factor for the dimming. This value will be multiplied by the value given from the dial. So lower number, more gradual dimming. Larger number, faster dimming.
default: 1.0
selector:
number:
min: 0.0
max: 5.0
step: 0.01
source_url: https://github.com/apollo1220/blueprints/blob/main/philips_zigbee_dial.yaml
mode: restart
max_exceeded: silent
variables:
first_light: !input "first_light"
second_light: !input "second_light"
third_light: !input "third_light"
forth_light: !input "forth_light"
current_light: !input "current_light"
dim_scale: !input "dim_scale"
lights:
first_light: !input "first_light"
second_light: !input "second_light"
third_light: !input "third_light"
forth_light: !input "forth_light"
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "remote"
action:
- variables:
command: "{{ trigger.event.data.command }}"
args: '{% if (trigger.event.data.args is defined) %}{{trigger.event.data.args}}{% endif %}'
params: '{% if (trigger.event.data.params is defined) %}{{trigger.event.data.params}}{% endif %}'
step_size: '{% if (trigger.event.data.params is defined) and (trigger.event.data.params.step_size is defined) %}{{trigger.event.data.params.step_size}}{% endif %}'
step_mode: '{% if (trigger.event.data.params is defined) and (trigger.event.data.params.step_mode is defined) %}{{trigger.event.data.params.step_mode}}{% endif %}'
scene: '{% if (trigger.event.data.params is defined) and (trigger.event.data.params.scene_id is defined) %}{{trigger.event.data.params.scene_id}}{% endif %}'
- choose:
- conditions:
- "{{ command == 'recall' }}"
- "{{ scene == 1 }}"
sequence:
- service: homeassistant.toggle
target: !input "first_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: first_light
- conditions:
- "{{ command == 'recall' }}"
- "{{ second_light != none }}"
- "{{ scene == 0 }}"
sequence:
- service: homeassistant.toggle
target: !input "second_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: second_light
- conditions:
- "{{ command == 'recall' }}"
- "{{ third_light != none }}"
- "{{ scene == 5 }}"
sequence:
- service: homeassistant.toggle
target: !input "third_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: third_light
- conditions:
- "{{ command == 'recall' }}"
- "{{ forth_light != none }}"
- "{{ scene == 4 }}"
sequence:
- service: homeassistant.toggle
target: !input "forth_light"
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: input_text.set_value
target:
entity_id: !input "current_light"
data:
value: forth_light
- conditions:
- "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Up' }}"
sequence:
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: light.turn_on
target: "{{ lights[states(current_light)] }}"
data:
brightness_step_pct: "{{ step_size * dim_scale }}"
transition: 1
default:
- service: light.turn_on
target: !input "first_light"
data:
brightness_step_pct: "{{ step_size * dim_scale }}"
transition: 1
- conditions:
- "{{ command == 'step_with_on_off' }}"
- "{{ step_mode == 'StepMode.Down' }}"
sequence:
- choose:
- conditions: "{{ current_light != none }}"
sequence:
- service: light.turn_on
target: "{{ lights[states(current_light)] }}"
data:
brightness_step_pct: "{{ -step_size * dim_scale }}"
transition: 1
default:
- service: light.turn_on
target: !input "first_light"
data:
brightness_step_pct: "{{ -step_size * dim_scale }}"
transition: 1