forked from matt8707/hass-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomations.yaml
501 lines (464 loc) · 12.3 KB
/
automations.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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
- alias: delay_homekit_start
trigger:
- platform: homeassistant
event: start
action:
- delay: 00:01:00
- service: homekit.start
- alias: restart_homekit
trigger:
platform: time
at: '04:00:00'
action:
- service: homekit.start
- alias: set_theme_on_startup
trigger:
platform: homeassistant
event: start
action:
service: frontend.set_theme
data:
name: slate
- alias: toast_motion_hall
trigger:
- platform: state
entity_id: input_boolean.motion_hall
from: 'off'
to: 'on'
action:
service: browser_mod.toast
data:
duration: 8000
message: Rörelse detekterat i hallen
- alias: toast_motion_garderob
trigger:
- platform: state
entity_id: input_boolean.motion_garderob
from: 'off'
to: 'on'
action:
service: browser_mod.toast
data:
duration: 8000
message: Rörelse detekterat i klädkammaren
- alias: toast_motion_badrum
trigger:
- platform: state
entity_id: input_boolean.motion_badrum
from: 'off'
to: 'on'
action:
service: browser_mod.toast
data:
duration: 8000
message: Rörelse detekterat i badrummet
- alias: toast_motion_vardagsrum
trigger:
- platform: state
entity_id: binary_sensor.wemo_motion
from: 'off'
to: 'on'
action:
service: browser_mod.toast
data:
duration: 8000
message: Rörelse detekterat i vardagsrummet
- alias: monitorer_volume_slider
trigger:
platform: state
entity_id: input_number.monitorer_volume
condition:
- condition: state
entity_id: switch.dator_template
state: 'on'
action:
service: shell_command.monitorer_volume_slider
- alias: tablet_brightness_slider
trigger:
platform: state
entity_id: input_number.fullykiosk_brightness_slider
action:
service: shell_command.fullykiosk_brightness_slider
- alias: monitorer_volume_update
trigger:
- platform: state
entity_id: sensor.getvolume
- platform: event
event_type: call_service
event_data:
domain: shell_command
service: monitorer_volume_up
- platform: event
event_type: call_service
event_data:
domain: shell_command
service: monitorer_volume_down
condition:
- condition: state
entity_id: switch.dator_template
state: 'on'
action:
- service: homeassistant.update_entity
entity_id: sensor.getvolume
- service: homeassistant.update_entity
entity_id: sensor.monitorer_mute_check
- service: input_number.set_value
data_template:
entity_id: input_number.monitorer_volume
value: "{{ states('sensor.getvolume') }}"
- alias: reference_monitors
trigger:
- platform: state
entity_id: switch.wemo_monitorer
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: switch.dator_template
state: 'on'
action:
service: script.reference_monitors
- alias: reference_headphones
trigger:
- platform: state
entity_id: switch.wemo_monitorer
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: switch.dator_template
state: 'on'
action:
service: script.reference_headphones
- alias: turn_off_monitorer
trigger:
- platform: state
entity_id: switch.dator_template
from: 'on'
to: 'off'
for:
minutes: 5
action:
- service: switch.turn_off
entity_id: switch.wemo_monitorer
- alias: turn_off_fläkt
trigger:
platform: state
entity_id: switch.wemo_flakt
from: 'off'
to: 'on'
for:
hours: "{{ states('input_number.flakt_minuter') | int }}"
action:
- service: switch.turn_off
entity_id: switch.wemo_flakt
- alias: turn_on_fläkt_temp
trigger:
platform: numeric_state
entity_id: sensor.sensor_hall_temperature
above: 26
condition:
condition: or
conditions:
- condition: state
entity_id: device_tracker.mattias
state: 'home'
- condition: state
entity_id: device_tracker.sanja
state: 'home'
action:
- service: switch.turn_on
entity_id: switch.wemo_flakt
- alias: fullykiosk_brightness_slider
trigger:
platform: homeassistant
event: start
action:
- service: input_number.set_value
data_template:
entity_id: input_number.fullykiosk_brightness_slider
value: "{{ (state_attr('sensor.fullykiosk', 'screenBrightness') | int / 2.55) | round(0) }}"
- alias: fullykiosk_automatic_brightness
trigger:
- platform: state
entity_id: sun.sun
to: above_horizon
- platform: state
entity_id: sun.sun
to: below_horizon
action:
- service_template: input_number.set_value
data_template:
entity_id: input_number.fullykiosk_brightness_slider
value: >
{% if is_state('sun.sun', 'above_horizon') %}
200
{% else %}
100
{% endif %}
- alias: update_imac_sensors
trigger:
- platform: state
entity_id: switch.dator_template
from: 'off'
to: 'on'
action:
- service: homeassistant.update_entity
entity_id:
['sensor.imac_cpu_per', 'sensor.imac_mem_per', 'sensor.imac_system_ssd', 'sensor.imac_macintosh_hd', 'sensor.imac_time_machine', 'sensor.getvolume', 'sensor.macos_uptime']
- alias: close_popups_on_tablet
trigger:
- platform: state
entity_id: switch.fullykiosk_screen
from: 'on'
to: 'off'
for:
seconds: 30
action:
- service: browser_mod.close_popup
data:
deviceID: tablet
- alias: turn_off_tv_loading
trigger:
- platform: state
entity_id: media_player.sony_bravia_tv
from: 'off'
to: 'on'
- platform: state
entity_id: media_player.sony_bravia_tv
from: 'on'
to: 'off'
- platform: state
entity_id: input_boolean.loading_tv
from: 'off'
to: 'on'
for:
minutes: 1
action:
- service: input_boolean.turn_off
entity_id: input_boolean.loading_tv
- alias: turn_off_dator_loading
trigger:
- platform: state
entity_id: switch.dator_template
from: 'off'
to: 'on'
- platform: state
entity_id: switch.dator_template
from: 'on'
to: 'off'
- platform: state
entity_id: input_boolean.loading_dator
from: 'off'
to: 'on'
for:
minutes: 1
action:
- service: input_boolean.turn_off
entity_id: input_boolean.loading_dator
- alias: turn_off_ps4_loading
trigger:
- platform: state
entity_id: switch.playstation_template
from: 'off'
to: 'on'
- platform: state
entity_id: switch.playstation_template
from: 'on'
to: 'off'
- platform: state
entity_id: input_boolean.loading_playstation
from: 'off'
to: 'on'
for:
minutes: 1
action:
- service: input_boolean.turn_off
entity_id: input_boolean.loading_playstation
- alias: notification_motion_hall
initial_state: 'false'
trigger:
- platform: state
entity_id: input_boolean.motion_hall
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: switch.dator_template
state: 'on'
action:
- service: shell_command.ssh_motion_hall_notify
- alias: hdmi_input_select
trigger:
- platform: state
entity_id: input_select.hdmi
action:
- service: media_player.select_source
data_template:
entity_id: media_player.sony_bravia_tv
source: >-
{% if is_state('input_select.hdmi', 'HDMI 1') %}
HDMI 1
{% elif is_state('input_select.hdmi', 'HDMI 2/MHL') %}
HDMI 2/MHL
{% elif is_state('input_select.hdmi', 'HDMI 3') %}
HDMI 3
{% elif is_state('input_select.hdmi', 'HDMI 4') %}
HDMI 4
{% else %}
HDMI 1
{% endif %}
- alias: hdmi_input_select_update
trigger:
- platform: state
entity_id: media_player.sony_bravia_tv
action:
- service: input_select.select_option
data_template:
entity_id: input_select.hdmi
option: >-
{% set source = state_attr('media_player.sony_bravia_tv', 'media_title') %}
{% if source == 'HDMI 1' %}
HDMI 1
{% elif source == 'HDMI 2/MHL' %}
HDMI 2/MHL
{% elif source == 'HDMI 3' %}
HDMI 3
{% elif source == 'HDMI 4' %}
HDMI 4
{% else %}
HDMI 1
{% endif %}
- alias: turn_off_motion_hall
trigger:
- platform: state
entity_id: input_boolean.motion_hall
from: 'off'
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.motion_hall
- alias: turn_off_motion_garderob
trigger:
- platform: state
entity_id: input_boolean.motion_garderob
from: 'off'
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.motion_garderob
- alias: turn_off_motion_badrum
trigger:
- platform: state
entity_id: input_boolean.motion_badrum
from: 'off'
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.motion_badrum
- alias: turn_on_motion_vardagsrum
trigger:
- platform: state
entity_id: binary_sensor.wemo_motion
from: 'off'
to: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.motion_vardagsrum
- alias: turn_off_motion_vardagsrum
trigger:
- platform: state
entity_id: input_boolean.motion_vardagsrum
from: 'off'
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.motion_vardagsrum
- alias: apple_tv_notitle_true
trigger:
platform: template
value_template: "{% if state_attr('media_player.vardagsrum_2', 'media_title') == 'Nothing playing' %}true{% endif %}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.appletv_notitle
- alias: apple_tv_notitle_false
trigger:
platform: template
value_template: "{% if state_attr('media_player.vardagsrum_2', 'media_title') != 'Nothing playing' %}true{% endif %}"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.appletv_notitle
- alias: ui_sound_on
trigger:
- platform: state
entity_id:
['light.belysning', 'light.fonsterlampa', 'light.datorlampa', 'light.taklampor', 'light.mattias', 'light.sanja', 'light.badrum', 'light.taklampa', 'light.kladkammare_2',
'light.hall', 'switch.wemo_flakt', 'switch.wemo_monitorer', 'input_boolean.loading_dator', 'input_boolean.loading_playstation', 'input_boolean.loading_tv']
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: switch.fullykiosk_screen
state: 'on'
action:
- service: media_player.play_media
data:
entity_id: media_player.tablet
media_content_id: /local/on.m4a
media_content_type: music
- alias: ui_sound_off
trigger:
- platform: state
entity_id:
['light.belysning', 'light.fonsterlampa', 'light.datorlampa', 'light.taklampor', 'light.mattias', 'light.sanja', 'light.badrum', 'light.taklampa', 'light.kladkammare_2',
'light.hall', 'switch.wemo_flakt', 'switch.wemo_monitorer', 'switch.dator_template', 'switch.playstation_template', 'switch.tv_template']
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: switch.fullykiosk_screen
state: 'on'
action:
- service: media_player.play_media
data:
entity_id: media_player.tablet
media_content_id: /local/off.m4a
media_content_type: music
- alias: ui_sound_popup
trigger:
platform: event
event_type: call_service
event_data:
domain: browser_mod
service: popup
condition:
- condition: state
entity_id: switch.fullykiosk_screen
state: 'on'
action:
- service: media_player.play_media
data:
entity_id: media_player.tablet
media_content_id: /local/popup.m4a
media_content_type: music
- alias: turn_on_fullykiosk_screen
initial_state: 'false'
trigger:
- platform: state
entity_id: input_boolean.motion_hall
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sensor.fullykiosk_plugged
state: 'Ja'
action:
- service: switch.turn_on
entity_id: switch.fullykiosk_screen
- alias: clear_log_filesize
trigger:
- platform: numeric_state
entity_id: sensor.home_assistant_log
above: 50
action:
- service: shell_command.clear_logs