-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscripts.yaml
More file actions
548 lines (513 loc) · 16.7 KB
/
Copy pathscripts.yaml
File metadata and controls
548 lines (513 loc) · 16.7 KB
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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# Script to Turn on the Front outdoor lights when Garage door open and Turn off after 2 minutes.
garagelight:
sequence:
- action: light.turn_on
entity_id: light.frontoutdoor_light_zb_1
- delay:
minutes: 4
- action: light.turn_off
entity_id: light.frontoutdoor_light_zb_1
# Script to execute the Xiaomi Gatway alarm
xiaomi_gateway_alarm:
sequence:
- action: xiaomi_aqara.play_ringtone
data:
ringtone_id: 2
ringtone_vol: 15
gw_mac: !secret xiaomi_mac
- delay: 00:00:05
- action: xiaomi_aqara.play_ringtone
data:
ringtone_id: 2
ringtone_vol: 15
gw_mac: !secret xiaomi_mac
# Script that executes on arrival at home after work
sonos_afternoon_greet:
alias: "Sonos afternoon great - Living"
sequence:
- action: sonos.snapshot
data_template:
entity_id: media_player.living
- action: media_player.media_pause
data_template:
entity_id: media_player.living
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: tts.speak
target:
entity_id: tts.google_en_com_au
data_template:
media_player_entity_id: media_player.living
language: en
message: >
Good Evening!, Welcome back home. ... {% set seconda = ["Hope you had a great day.","Hope you had a fantastic day.","I beleive you had a fantastic day."] %} {% set aindex = (range(0, (seconda | length - 1) )|random) %}
{{seconda[aindex]}}
The temperature inside is {{ states('sensor.living_espmulti_t') | float | round }} degrees and the humidity is {{ states('sensor.living_espmulti_h') | int }} percent ...
{% set secondb = ["Here is some music for you now ...","How about some music now ...","Let me play some music for you ..."] %} {% set bindex = (range(0, (secondb | length - 1) )|random) %}
{{secondb[bindex]}}
{% set secondr = ["Have a great evening.","Have a good one.","Goodbye.","Talk to you later."] %} {% set sindex = (range(0, (secondr | length - 1) )|random) %}
{{secondr[sindex]}}
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('sun.sun', 'above_horizon') and is_state('input_boolean.blinds_auto', 'on') %}
script.open_all_blinds
{% else %}
script.do_nothing
{% endif %}
- delay:
seconds: 18
- action: sonos.restore
data_template:
entity_id: media_player.living
- delay:
seconds: 2
- action: script.turn_on
data_template:
entity_id: >-
{% if 'Good' in state_attr('media_player.living', 'media_title') %}
script.sonos_living_play_jazz
{% elif is_state_attr('media_player.living', 'media_title', '') %}
script.sonos_living_play_jazz
{% else %}
script.sonos_living_play_resume
{% endif %}
- action: input_boolean.turn_off
entity_id: input_boolean.arrival_greet
# Script that executes good morning greet
sonos_morning_greet:
alias: "Sonos morning greet - Living"
sequence:
- action: sonos.snapshot
data_template:
entity_id: media_player.living
- action: media_player.media_pause
data_template:
entity_id: media_player.living
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: tts.speak
target:
entity_id: tts.google_en_com_au
data_template:
media_player_entity_id: media_player.living
language: en
message: >
Good morning!. It's currently {{ states('sensor.dark_sky_summary') }} and {{ states('sensor.dark_sky_temperature') |round}} degrees in Treeby. Today it will be {{ states('sensor.dark_sky_hourly_summary') |replace(".", "")}} ...
I will now turn on the TV. ...
{% set secondr = ["Have a great day.","Enjoy the day","Have a good one.","Talk to you later."] %} {% set sindex = (range(0, (secondr | length - 1) )|random) %}
{{secondr[sindex]}}
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('sun.sun', 'above_horizon') and is_state('input_boolean.blinds_auto', 'on') %}
script.open_all_blinds
{% else %}
script.do_nothing
{% endif %}
- delay:
seconds: 18
- action: sonos.restore
data_template:
entity_id: media_player.living
- action: remote.turn_on
entity_id: remote.Living
data:
activity: "Watch TV"
- action: input_boolean.turn_off
entity_id: input_boolean.morning_greet
# Script that executes good morning greet
garage_door_warning:
alias: "Sonos Garage Door warning 30 mins"
sequence:
- action: sonos.snapshot
data_template:
entity_id: media_player.living
- action: media_player.media_pause
data_template:
entity_id: media_player.living
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: tts.speak
target:
entity_id: tts.google_en_com_au
data_template:
media_player_entity_id: media_player.living
language: en
message: >
Warning!. Garage Door was opened for more than 30 minutes
- delay:
seconds: 10
- action: sonos.restore
data_template:
entity_id: media_player.living
# Script that executes good morning greet
sonos_warning:
alias: "Sonos Warning Message"
fields:
message:
description: "The warning message content"
example: "Warning! Garage door is open"
sequence:
- action: sonos.snapshot
data_template:
entity_id: media_player.living
- action: media_player.media_pause
data_template:
entity_id: media_player.living
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: tts.speak
target:
entity_id: tts.google_en_com_au
data_template:
media_player_entity_id: media_player.living
language: en
message: "{{ message }}"
- delay:
seconds: 15
- action: sonos.restore
data_template:
entity_id: media_player.living
# Rainmachine Sprinkler Turn on Call
rainmachine_zoneon:
description: 'Rainmachine Sprinkler Turn on Call'
fields:
id:
description: 'zone id'
example: '2'
sequence:
- action: rainmachine.start_zone
data_template:
entity_id: '{{ id }}'
zone_run_time: "{{ states('sensor.sprinkler_runtime_seconds') | int }}"
# Resume Living Sonos
sonos_living_play_resume:
description: 'Resume Existing Playlist in Living Sonos'
alias: "Resume Existing Playlist in Living Sonos"
sequence:
- action: media_player.media_play
data_template:
entity_id: media_player.living
# Pause Living Sonos
sonos_living_pause:
description: 'Pause Living Sonos'
alias: "Pause Living Sonos"
sequence:
- action: media_player.media_pause
data_template:
entity_id: media_player.living
# Play Living Sonos Jazz Playlist
sonos_living_play_jazz:
description: 'Play Jazz Playlist in Living Sonos'
alias: "Play Jazz Playlist in Living Sonos"
sequence:
- action: media_player.play_media
data_template:
entity_id: media_player.living
media_content_type: playlist
media_content_id: 'Jazz'
# Play Living Sonos Playlist
sonos_living_play_playlist:
description: 'Play Playlist in Living Sonos'
alias: "Play Playlist in Living Sonos"
fields:
playlist:
description: 'Playlist Name'
example: 'Jazz'
sequence:
- action: media_player.shuffle_set
data_template:
entity_id: media_player.living
shuffle: true
- action: media_player.play_media
data_template:
entity_id: media_player.living
media_content_type: playlist
media_content_id: '{{ playlist }}'
# Play Living Sonos Lullabies Playlist
sonos_living_play_lullabies:
description: 'Play Lullabies Playlist in Living Sonos'
alias: "Play Lullabies Playlist in Living Sonos"
sequence:
- action: media_player.shuffle_set
data_template:
entity_id: media_player.living
shuffle: true
- action: media_player.play_media
data_template:
entity_id: media_player.living
media_content_type: playlist
media_content_id: 'Lullabies'
# Play/Pause Living Sonos Lullabies
play_pause_sonos_living_play_lullabies:
description: 'Play Pause Living Sonos Lullabies'
alias: "Play Pause Living Sonos Lullabies"
sequence:
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('binary_sensor.lullabies_music_sensor', 'on') %}
script.sonos_living_pause
{% else %}
script.sonos_living_play_lullabies
{% endif %}
# Play Living Sonos Montessori Playlist
sonos_living_play_montessori:
description: 'Play Montessori Playlist in Living Sonos'
alias: "Play Montessori Playlist in Living Sonos"
sequence:
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: media_player.shuffle_set
data_template:
entity_id: media_player.living
shuffle: true
- action: media_player.play_media
data_template:
entity_id: media_player.living
media_content_type: playlist
media_content_id: 'Montessori'
# Play/Pause Living Sonos Montessori
play_pause_sonos_living_play_montessori:
description: 'Play Pause Living Sonos Montessori'
alias: "Play Pause Living Sonos Montessori"
sequence:
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('binary_sensor.montessori_music_sensor', 'on') %}
script.sonos_living_pause
{% else %}
script.sonos_living_play_montessori
{% endif %}
# Resume Alfresco Sonos
sonos_alfresco_play_resume:
description: 'Resume Existing Playlist in Alfresco Sonos'
alias: "Resume Existing Playlist in Alfresco Sonos"
sequence:
- action: media_player.media_play
data_template:
entity_id: media_player.alfresco
# Play Alfresco Sonos Jazz Playlist
sonos_alfresco_play_jazz:
description: 'Play Jazz Playlist in Alfresco Sonos'
alias: "Play Jazz Playlist in Alfresco Sonos"
sequence:
- action: media_player.play_media
data_template:
entity_id: media_player.alfresco
media_content_type: playlist
media_content_id: 'Jazz'
# Play Alfresco Sonos
sonos_alfresco_play:
description: 'Play music in Alfresco Sonos'
alias: "Play music in Alfresco Sonos'"
sequence:
- action: script.turn_on
data_template:
entity_id: >-
{% if is_state_attr('media_player.alfresco', 'media_title', '') %}
script.sonos_alfresco_play_jazz
{% else %}
script.sonos_alfresco_play_resume
{% endif %}
# Script that executes when leaving home
leave_home_workflow:
alias: "Leave Home"
sequence:
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('input_boolean.blinds_auto', 'on') %}
script.close_all_blinds
{% else %}
script.do_nothing
{% endif %}
- action: remote.turn_on
entity_id: remote.Living
data:
activity: "PowerOff"
- action: light.turn_off
entity_id: light.living_dimmer
- action: light.turn_off
entity_id: light.kitchen_dimmer
- action: media_player.media_pause
data_template:
entity_id: media_player.living
# Launch HA Dashboard
launch_ha_dashboard:
description: 'Launch Home Assistant Dashboard'
alias: "Home Assistant Dashboard"
sequence:
- action: cast.show_lovelace_view
data:
entity_id: media_player.kitchen_display
view_path: home
# Launch HA floorplan
launch_ha_floorplan:
description: 'Launch Home Assistant Floorplan'
alias: "Home Assistant Floorplan"
sequence:
- action: cast.show_lovelace_view
data:
entity_id: media_player.kitchen_display
view_path: "4"
# Toggle TV
toggle_tv:
description: 'Toggle TV'
alias: "Toggle TV"
sequence:
- action: remote.turn_on
entity_id: remote.Living
data_template:
activity: >-
{% if is_state('binary_sensor.living_tv', 'on') %}
PowerOff
{% else %}
Watch TV
{% endif %}
# Open all blinds, don't open tv blides if it's before 11am.
open_all_blinds:
alias: "Open all blinds"
sequence:
- action: cover.open_cover
entity_id: cover.living_blind_1
- action: cover.open_cover
entity_id: cover.living_blind_2
- action: cover.open_cover
entity_id: cover.dining_blind_1
- action: cover.open_cover
entity_id: cover.dining_blind_2
- condition: template
value_template: "{{ now().hour > 11 }}"
- action: cover.open_cover
entity_id: cover.tv_blind_left
- action: cover.open_cover
entity_id: cover.tv_blind_right
# Close all blinds
close_all_blinds:
alias: "Close all blinds"
sequence:
- action: cover.close_cover
entity_id: cover.tv_blind_left
- action: cover.close_cover
entity_id: cover.tv_blind_right
- action: cover.close_cover
entity_id: cover.living_blind_1
- action: cover.close_cover
entity_id: cover.living_blind_2
- action: cover.close_cover
entity_id: cover.dining_blind_1
- action: cover.close_cover
entity_id: cover.dining_blind_2
# Do Nothing Script
do_nothing:
alias: "Do Nothing Script"
sequence:
# Send snaptshot in Garage
send_snapshot_garage:
alias: "Send snapshot Garage"
fields:
title:
description: "The title of the notification"
example: "State change"
message:
description: "The message content"
example: "The light is on!"
sequence:
- action: camera.snapshot
data:
entity_id: camera.garage_camera
filename: !secret garagecameranotifytemp
- delay:
seconds: 5
- action: notify.phoneapps
data:
title: "{{ title }}"
message: "{{ message }}"
data:
image: !secret garagecameranotifytemp
# Sonos Alarm Bell
sonos_alarm_bell:
alias: "Sonos Alarm Bell"
sequence:
- action: sonos.snapshot
data_template:
entity_id: media_player.living
- action: media_player.media_pause
data_template:
entity_id: media_player.living
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.60"
- action: media_player.play_media
data_template:
entity_id: media_player.living
media_content_id: !secret dingdong
media_content_type: music
- delay:
seconds: 5
- action: sonos.restore
data_template:
entity_id: media_player.living
# Turn on Google TV
google_tv_on:
description: 'Turn on Google TV'
alias: "Turn on Google TV"
sequence:
- action: remote.turn_on
entity_id: remote.living
data_template:
activity: 'Google TV'
- delay:
seconds: 20
# Play Youtube Videos for Sienna
youtube_sienna:
alias: "Play Youtube Videos for Sienna"
sequence:
- action: script.turn_on
data_template:
entity_id: >
{% if is_state('media_player.yamaha_receiver', 'off') %}
script.google_tv_on
{% else %}
script.do_nothing
{% endif %}
- action: media_player.volume_set
data_template:
entity_id: media_player.living
volume_level: "0.70"
# - action: remote.send_command
# entity_id: remote.living
# data_template:
# device: "Samsung TV"
# command: "InputHdmi1"
- action: media_player.media_stop
entity_id: media_player.living_tv
- action: media_player.turn_on
entity_id: media_player.living_tv
- delay:
seconds: 3
- action: media_player.play_media
entity_id: media_player.living_tv
data:
media_content_type: cast
media_content_id: >
{
"app_name": "youtube",
{% set videolist = ["mN3dCN98DUU","ddjPSIt_3YE","FPQ7oBWCTgs","RPAq9bElBv8","uCkszsDvpXc","U80sqVMPBtQ","MlYRPd44guk","ARDf25lSzRk","a9PpVo6b7z0","CkQ2I8zsVyY","gBTYOTh7VlA","vSVr4HBPYUI","fMMJ5IIbHLw","Vnd_JK6u4wA","6lEya-UvCH4","U8T1F4I-sjM","Lw5hCMcoBLc"] %} {% set sindex = (range(0, (videolist | length - 1) )|random) %}
"media_id": "{{videolist[sindex]}}"
}
# Previous Videos 1 = ["vkRDOcma9Qk","FPQ7oBWCTgs","TBRdYaYTs18","JqIqywOBWAY","U80sqVMPBtQ","aUiswwr77L8","pZ_7dZbYGjU","fMMJ5IIbHLw","FubT0Pf9QPk"]