-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.yaml
492 lines (455 loc) · 14.8 KB
/
scripts.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
---
resync_lights:
alias: Resync lights with sun
sequence:
- service: adaptive_lighting.set_manual_control
data:
entity_id:
- switch.adaptive_lighting_hallway
- switch.adaptive_lighting_pantry
- switch.adaptive_lighting_living_room
- switch.adaptive_lighting_bathroom
- switch.adaptive_lighting_bedroom
- switch.adaptive_lighting_kitchen
manual_control: false
message_blood_sugar:
alias: Message blood sugar
sequence:
- service: notify.liam
data:
message:
"BG: {{ states('sensor.dexcom_liamwoodleigh_glucose_value') }}. Trend:
{{ states('sensor.dexcom_liamwoodleigh_glucose_trend') }}"
white_lights_living_room:
alias: Set white lights in the living room
sequence:
- service: light.turn_on
data:
entity_id:
- light.living_room
color_temp: 366
- service: input_select.select_option
entity_id: input_select.last_script_living_room
data:
option: script.white_lights_living_room
white_lights_bedroom:
alias: Set white lights in the bedroom
sequence:
- data:
color_temp: 366
entity_id:
- light.bedroom
service: light.turn_on
- service: input_select.select_option
entity_id: input_select.last_script_bedroom
data:
option: script.white_lights_bedroom
increase_brightness:
alias: Increase the brightness of a group of lights
fields:
group:
description: The group to apply the light increase to.
example: light.living_room
sequence:
- service: light.turn_on
data:
entity_id: "{{ group }}"
brightness:
"{% set b = state_attr(group, 'brightness') %} {% if b == None %}\n\
\ 10\n{% elif b < 20 %}\n 128\n{% elif b < 140 %}\n 255\n{% else %}\n \
\ 10\n{% endif %}\n"
turn_off_everything:
alias: Turn off everything
mode: single
sequence:
- service: light.turn_off
data:
transition: 4
entity_id: light.all_the_lights
- service: script.turn_off_tv
- service: script.turn_off_tv_ambilight
- service: script.set_low_temperature
going_to_sleep:
alias: Going to sleep
sequence:
- service: input_select.select_option
data:
entity_id: input_select.sleep_mode
option: "on"
entity_id: input_select.sleep_mode
- service: script.turn_off_everything
sleep_mode_half:
alias: Sleep mode half
sequence:
- service: input_select.select_option
data:
entity_id: input_select.sleep_mode
option: "half"
entity_id: input_select.sleep_mode
next_colors:
alias: Change the colors of lights
fields:
input_select:
description: The input select that lists script names.
example: input_select.last_script_living_room
sequence:
- service: input_select.select_next
data:
entity_id: "{{ input_select }}"
- service: "{{ states(input_select) }}"
start_netflix:
alias: Start Netflix
sequence:
- entity_id: media_player.living_room_android_tv
service: media_player.turn_on
- data:
source: Netflix
entity_id: media_player.living_room_tv
service: media_player.select_source
mode: single
set_low_temperature:
alias: Set low temperature
sequence:
- service: climate.set_temperature
entity_id: climate.living_room
data:
temperature: '{{ states("input_number.temperature_low") }}'
set_high_temperature:
alias: Set high temperature
sequence:
- service: climate.set_temperature
entity_id: climate.living_room
data:
temperature: '{{ states("input_number.temperature_high") }}'
leaving:
alias: Leaving the house
sequence:
- service: script.set_low_temperature
- service: script.turn_off_everything
vacuum_command:
alias: Vacuum living room
icon: mdi:robot-vacuum
fields:
option:
description:
all, stop, living_room, bedroom, hallway, kitchen, dining_area
or bathroom
example: living_room
sequence:
choose:
- conditions: "{{ option == 'all' }}"
sequence:
service: vacuum.start
entity_id: vacuum.xiaomi_vacuum_cleaner
- conditions: "{{ option == 'stop' }}"
sequence:
service: vacuum.return_to_base
entity_id: vacuum.xiaomi_vacuum_cleaner
- conditions: "{{ option == 'living_room' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 18
- conditions: "{{ option == 'bedroom' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 17
- conditions: "{{ option == 'hallway' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 19
- conditions: "{{ option == 'kitchen' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 20
- conditions: "{{ option == 'dining_area' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 21
- conditions: "{{ option == 'bathroom' }}"
sequence:
service: xiaomi_miio.vacuum_clean_segment
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
segments: 16
show_home_assistant_on_kitchen_hub:
alias: Show Home Assistant
sequence:
- data:
dashboard_path: lovelace
entity_id: media_player.kitchen_hub
view_path: home
service: cast.show_lovelace_view
flash_bedroom:
sequence:
- service: light.turn_on
data:
entity_id: light.bedroom_lights
rgb_color:
- 0
- 191
- 255
brightness: 255
transition: false
- delay: 1
- service: light.turn_off
data:
entity_id: light.bedroom_lights
transition: false
# turn_on_lights:
# alias: lights with Adaptive Lighting
# icon: mdi:lamp
# fields:
# entity_id:
# description: entity_id of light
# example: light.bedroom_lights
# sequence:
# - service: adaptive_lighting.apply
# data:
# entity_id:
# - switch.adaptive_lighting_bedroom
# - switch.adaptive_lighting_living_room
# - switch.adaptive_lighting_hallway
# - switch.adaptive_lighting_bathroom
# - switch.adaptive_lighting_pantry
# - switch.adaptive_lighting_office_lights
# lights:
# - light.hallway_lights
# - light.pantry_lights
# - light.bedroom_lights
# - light.corner_lamp
# - light.standing_lamp
# - light.table_lamp
# - light.bathroom_lights
# - light.java_lamp
# turn_on_lights: true
turn_off_tv_ambilight:
alias: Turn off TV ambilight
sequence:
- condition: not
conditions:
- condition: state
entity_id: light.tv_ambilight
state: unavailable
- service: light.turn_off
data: {}
entity_id: light.tv_ambilight
mode: single
turn_on_tv_ambilight:
alias: Turn on TV ambilight
sequence:
- condition: not
conditions:
- condition: state
entity_id: light.tv_ambilight
state: unavailable
- service: light.turn_on
data: {}
entity_id: light.tv_ambilight
mode: single
turn_off_tv:
alias: Turn off TV
sequence:
- condition: not
conditions:
- condition: state
entity_id: media_player.living_room_android_tv
state: unavailable
- service: media_player.turn_off
data: {}
entity_id: media_player.living_room_android_tv
mode: single
# turn_on_lights:
# alias: Turn on lights with Adaptive Lighting
# icon: mdi:lamp
# fields:
# entity_id:
# description: entity_id of light
# example: light.bedroom_lights
# sequence:
# service: adaptive_lighting.apply
# data:
# entity_id: switch.adaptive_lighting_living_room # Make this line dynamic
# lights: "{{ entity_id }}"
# turn_on_lights: true
turn_on_lights:
alias: Turn on lights
icon: mdi:lamp
fields:
entity_id:
description: entity_id of light
example: light.bedroom_lights
sequence:
service: light.turn_on
data:
entity_id:
- light.living_room_lights
- light.hallway_lights
- light.kitchen_lights
# switch_music_from_iphone_to_soundbar:
# alias: Switch music to soundbar
# mode: single
# sequence:
# # Send iPhone notification
# - service: notify.liam
# data:
# title: "Arriving"
# message: "Switching music from phone to TV. Take out your Airpods & press play when ready!"
# data:
# push:
# category: spotify
# # Turn on the TV
# - service: media_player.turn_on
# entity_id: media_player.living_room_android_tv
# # Open Spotify on TV
# - service: media_player.select_source
# entity_id: media_player.living_room_android_tv
# data:
# source: "\U0001F4F1 Spotify"
# # Set Spotify to play on TV
# - service: media_player.select_source
# entity_id: media_player.spotify
# data:
# source: Living Room TV
arriving:
alias: Arriving home
sequence:
- service: script.set_high_temperature
- service: script.turn_on_lights
- service: input_boolean.turn_off
entity_id: input_boolean.vacation_mode
trash_notification:
sequence:
- service: notify.liam
data:
title: "Afvalbeheer"
message: |+
Vandaag: {{ states('sensor.mijnafvalwijzer_vandaag') }}
Morgen: {{ states('sensor.mijnafvalwijzer_morgen') }}
light_automation_on:
sequence:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.automatic_lights
light_automation_off:
sequence:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.automatic_lights
waking_up:
sequence:
- service: input_select.select_option
data:
entity_id: input_select.sleep_mode
option: "off"
disable_tv_mode:
sequence:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.tv_mode
enable_tv_mode:
sequence:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.tv_mode
bedroom_chill_on:
sequence:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.bedroom_chill
bedroom_chill_off:
sequence:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.bedroom_chill
# TV Scripts
tv_click_center:
sequence:
- service: androidtv.adb_command
target:
entity_id: media_player.living_room_android_tv
data:
command: "sendevent /dev/input/event1 1 352 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 352 0 && sendevent /dev/input/event1 0 0 0"
tv_click_quick_settings:
sequence:
- service: androidtv.adb_command
target:
entity_id: media_player.living_room_android_tv
data:
command: "sendevent /dev/input/event1 1 641 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 641 0 && sendevent /dev/input/event1 0 0 0"
tv_click_right:
sequence:
- service: androidtv.adb_command
target:
entity_id: media_player.living_room_android_tv
data:
command: "sendevent /dev/input/event1 1 106 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 106 0 && sendevent /dev/input/event1 0 0 0"
tv_click_down:
sequence:
- service: androidtv.adb_command
target:
entity_id: media_player.living_room_android_tv
data:
command: "sendevent /dev/input/event1 1 108 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 108 0 && sendevent /dev/input/event1 0 0 0"
tv_wakeup_soundbar:
sequence:
- service: script.tv_click_quick_settings
- delay: 1
- service: script.tv_click_down
- delay: 1
- service: script.tv_click_center
- delay: 1
- service: script.tv_click_right
- delay: 1
- service: script.tv_click_down
- delay: 1
- service: script.tv_click_down
- delay: 1
- service: script.tv_click_center
# tv_wakeup_soundbar:
# sequence:
# # Open quick settings settings
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 641 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 641 0 && sendevent /dev/input/event1 0 0 0"
# # Clicker center to open frequent settings
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 352 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 352 0 && sendevent /dev/input/event1 0 0 0"
# # Press right
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 106 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 106 0 && sendevent /dev/input/event1 0 0 0"
# # Press down once
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 108 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 108 0 && sendevent /dev/input/event1 0 0 0"
# # Press down second time
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 108 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 108 0 && sendevent /dev/input/event1 0 0 0"
# # Press center button
# - service: androidtv.adb_command
# target:
# entity_id: media_player.living_room_android_tv
# data:
# command: "sendevent /dev/input/event1 1 352 1 && sendevent /dev/input/event1 0 0 0 && sendevent /dev/input/event1 1 352 0 && sendevent /dev/input/event1 0 0 0"