forked from basnijholt/home-assistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lights.yaml
executable file
·338 lines (318 loc) · 8.41 KB
/
lights.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
---
- alias: "Light: next colors in the bedroom"
trigger:
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_bedroom
event: 1004
- platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_bedroom
event: 1002
action:
- service: input_select.select_next
entity_id: input_select.last_script_bedroom
- service: script.turn_on
data_template:
entity_id: "{{ states('input_select.last_script_bedroom') }}"
- alias: "Light: next colors in the living room"
trigger:
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_living_room
event: 1004
- platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_living_room
event: 1002
action:
service: script.next_colors
data:
input_select: input_select.last_script_living_room
- alias: "Light: bright white lights the living room"
trigger:
platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_living_room
event: 2000
condition:
condition: state
entity_id: light.living_room_lights
state: "on"
action:
- service: script.white_lights_living_room
- service: light.turn_on
entity_id: light.living_room_lights
data:
brightness: 255
- alias: "Light: bright white lights the bedroom"
trigger:
platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_bedroom
event: 2000
condition:
condition: state
entity_id: light.bedroom_lights
state: "on"
action:
- service: script.white_lights_bedroom
- service: light.turn_on
entity_id: light.bedroom_lights
data:
brightness: 255
- alias: "Light: toggle max/min brightness in the bedroom"
trigger:
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_bedroom
event: 1002
- platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_bedroom
event: 4002
action:
service: script.increase_brightness
data:
group: light.bedroom_lights
- alias: "Light: toggle max/min brightness in the living room"
trigger:
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_living_room
event: 1002
- platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_living_room
event: 4002
action:
service: script.increase_brightness
data:
group: light.living_room_lights
- alias: "Light: toggle kitchen ceiling"
trigger:
platform: state
entity_id: binary_sensor.activity_in_kitchen
action:
service_template: light.turn_{{ trigger.to_state.state }}
data:
entity_id: light.ceiling_kitchen
transition: 1
- alias: "Light: turn on kitchen counter if sleep mode is off"
trigger:
platform: state
entity_id: binary_sensor.activity_in_kitchen
to: "on"
condition:
condition: state
entity_id: input_boolean.sleep_mode
state: "off"
action:
service: light.turn_on
entity_id: light.kitchen_counter
- alias: "Light: turn off kitchen counter"
trigger:
platform: state
entity_id: binary_sensor.activity_in_kitchen
to: "off"
action:
service: light.turn_off
entity_id: light.kitchen_counter
- alias: "Light: toggle bathroom"
trigger:
platform: state
entity_id: binary_sensor.activity_in_bathroom
action:
service_template: light.turn_{{ trigger.to_state.state }}
data:
entity_id: light.ceiling_bathroom
transition: 1
- alias: "Light: toggle toilet"
trigger:
platform: state
entity_id: binary_sensor.activity_in_toilet
action:
service_template: light.turn_{{ trigger.to_state.state }}
data:
entity_id: light.toilet
transition: 1
- alias: "Light: turn off toilet (extra check)"
description: In case the other automation failed
trigger:
platform: time_pattern
minutes: "/30"
condition:
- condition: state
entity_id: binary_sensor.activity_in_toilet
state: "off"
- condition: state
entity_id: light.toilet
state: "on"
action:
service: light.turn_off
entity_id: light.toilet
- alias: "Light: turn off bathroom (extra check)"
description: In case the other automation failed
trigger:
platform: time_pattern
minutes: "/30"
condition:
- condition: state
entity_id: binary_sensor.activity_in_bathroom
state: "off"
- condition: state
entity_id: light.ceiling_bathroom
state: "on"
action:
service: light.turn_off
entity_id: light.ceiling_bathroom
- alias: "Light: turn off kitchen (extra check)"
description: In case the other automation failed
trigger:
platform: time_pattern
minutes: "/30"
condition:
- condition: state
entity_id: binary_sensor.activity_in_kitchen
state: "off"
- condition: state
entity_id: light.kitchen_lights
state: "on"
action:
service: light.turn_off
entity_id: light.kitchen_lights
- alias: "Light: turn off hall (extra check)"
description: In case the other automation failed
trigger:
platform: time_pattern
minutes: "/30"
condition:
- condition: state
entity_id: binary_sensor.activity_in_hall
state: "off"
- condition: or
conditions:
- condition: state
entity_id: light.stairs_lights
state: "on"
- condition: state
entity_id: light.hall_lights
state: "on"
action:
service: light.turn_off
entity_id:
- light.hall_lights
- light.stairs_lights
- alias: "Light: turn on hall"
trigger:
- platform: state
entity_id: binary_sensor.activity_in_hall
from: "off"
to: "on"
- platform: state
entity_id: binary_sensor.openclose_front_door
from: "off"
to: "on"
action:
service: light.turn_on
data:
entity_id:
- light.stairs_lights
- light.hall_lights
transition: 1
- alias: "Light: turn off hall"
trigger:
- platform: state
entity_id: binary_sensor.activity_in_hall
from: "on"
to: "off"
action:
service: light.turn_off
data:
entity_id:
- light.stairs_lights
- light.hall_lights
transition: 1
- alias: "Light: automatically turn on the bedroom"
trigger:
platform: state
entity_id: binary_sensor.activity_in_bedroom
to: "on"
condition:
- condition: state
entity_id: light.bedroom_lights
state: "off"
- condition: state
entity_id: input_boolean.sleep_mode
state: "off"
- condition: state
entity_id: input_boolean.automatic_bedroom_lights
state: "on"
action:
- service: light.turn_on
entity_id: light.bedroom_lights
data_template:
brightness: 255
xy_color:
- '{{ state_attr("sensor.circadian_values", "xy_color")[0] }}'
- '{{ state_attr("sensor.circadian_values", "xy_color")[1] }}'
- service: input_boolean.turn_on
entity_id: input_boolean.bedroom_lights_automatically_turned_on
- alias: "Light: automatically turn off the bedroom"
initial_state: "on"
trigger:
platform: state
entity_id: binary_sensor.activity_in_bedroom
to: "off"
condition:
- condition: state
entity_id: input_boolean.bedroom_lights_automatically_turned_on
state: "on"
- condition: state
entity_id: light.bedroom_lights
state: "on"
- condition: state
entity_id: input_boolean.automatic_bedroom_lights
state: "on"
action:
service: light.turn_off
entity_id: light.bedroom_lights
data:
transition: 10
- alias: "Light: turn off bedroom lights auto switch"
trigger:
- platform: state
entity_id: light.bedroom_lights
to: "off"
- platform: event
event_type: deconz_event
event_data:
id: dimmer_switch_bedroom
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_bedroom
condition:
condition: state
entity_id: input_boolean.bedroom_lights_automatically_turned_on
state: "on"
action:
service: input_boolean.turn_off
entity_id: input_boolean.bedroom_lights_automatically_turned_on
- alias: "Light: turn on automatic_bedroom_lights switch"
trigger:
platform: time
at: "12:00"
action:
entity_id: input_boolean.automatic_bedroom_lights
service: input_boolean.turn_on