-
Notifications
You must be signed in to change notification settings - Fork 437
/
scripts.yaml
621 lines (604 loc) · 21.2 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
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
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
#################################################################
## Scripts
#################################################################
set_hue_scene:
sequence:
- service: hue.hue_activate_scene
data_template:
group_name: "{{ group }}"
scene_name: "{{ scene }}"
abodeaway:
alias: 'Abode Arm'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.abodestatus
option: armed_away
- service: alarm_control_panel.alarm_arm_away
entity_id:
- alarm_control_panel.abode_alarm
- alarm_control_panel.aarlo_arlohome
- alarm_control_panel.alexa_guard_227b3
- service: switch.turn_on
entity_id:
- switch.downstairs_away
- switch.upstairs_away
- switch.bedroom_away
# - service: homeassistant.turn_on
# entity_id: input_boolean.startrecording
- service: ifttt.trigger
data: {"event":"wyze_cams_on"}
abodehome:
alias: 'Abode Home'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.abodestatus
option: armed_home
- service: alarm_control_panel.alarm_arm_home
entity_id:
- alarm_control_panel.abode_alarm
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.aarlo_arlohome
# - service: ifttt.trigger
# data: {"event":"AbodeHome", "value1":"Abode Home"}
abodestandby:
alias: 'Abode Standby'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.abodestatus
option: disarmed
- service: alarm_control_panel.alarm_disarm
entity_id:
- alarm_control_panel.abode_alarm
- alarm_control_panel.aarlo_arlohome
- alarm_control_panel.alexa_guard_227b3
- service: switch.turn_off
entity_id:
- switch.downstairs_away
- switch.upstairs_away
- switch.bedroom_away
- service: light.turn_off
entity_id: light.living_room_lights
- service: ifttt.trigger
data: {"event":"wyze_cams_off"}
# - service: ifttt.trigger
# data: {"event":"AbodeStandby", "value1":"Abode Standby"}
# - service: homeassistant.turn_off
# entity_id: input_boolean.startrecording
tv_off:
alias: 'Turn Television off'
sequence:
- condition: state
entity_id: input_boolean.tv
state: 'on'
- service: remote.send_command
data_template:
command: Home
device: 31747959
entity_id: remote.livingroom
- service: remote.turn_on
data_template:
entity_id: remote.livingroom
activity: PowerOff
- service: homeassistant.turn_off
data:
entity_id: input_boolean.tv
tv_youtube_on:
alias: 'Television - turn Youtube on'
sequence:
- condition: state
entity_id: input_boolean.tv
state: 'on'
- service: remote.send_command
data_template:
command: PowerOn
device: 56988979
entity_id: remote.livingroom
- delay: 00:00:02
- service: rest_command.youtube
- service: homeassistant.turn_on
data:
entity_id: input_boolean.tv
sonos_say:
alias: "Sonos TTS script"
sequence:
- service: sonos.snapshot
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
- service: sonos.unjoin
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
- service: media_player.volume_set
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
volume_level: "{{ volume|default(0.5) }}"
- service: tts.google_say
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
message: "{{ message }}"
- delay: "{{ delay|default('00:00:00') }}"
- wait_template: "{{ is_state(sonos_entity|default('media_player.livingroomsonos'), 'playing') }}"
timeout: '00:00:05'
- service: sonos.restore
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
notificationgaragedoor:
alias: 'Garage Door Open'
sequence:
- service: script.sonos_say
data:
sonos_entity: media_player.livingroomsonos
volume: 0.7
delay: '00:00:04'
message: 'Garage door is open, please check!'
notificationleavework:
alias: 'Leave for Work'
sequence:
- service: script.sonos_say
data:
sonos_entity: media_player.livingroomsonos
volume: 0.6
delay: '00:00:05'
message: 'Traffic has cleared, you can leave for work.'
notificationalarm:
alias: 'Notify that sensors changed when nobody is home'
sequence:
- service: sonos.snapshot
entity_id: media_player.livingroomsonos
- service: media_player.volume_set
entity_id: media_player.livingroomsonos
data:
volume_level: .9
- service: media_player.play_media
entity_id: media_player.livingroomsonos
data:
media_content_id: 'https://dl.dropboxusercontent.com/u/7457/HASS/Burglar_Alarm.mp3'
media_content_type: 'music'
- delay: '00:01:28'
- service: sonos.restore
entity_id: media_player.livingroomsonos
arm_security:
alias: 'Arm Security'
sequence:
- delay: 00:05:00
- service: homeassistant.turn_on
entity_id: script.abodeaway
disarm_security:
alias: 'Disarm Security'
sequence:
- service: homeassistant.turn_on
entity_id: script.abodestandby
playradio:
alias: 'Play Radio on Sonos'
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.livingroomsonos
media_content_id: >-
{% if station == 'golden_oldies' %}
x-sonosapi-radio:STATION%3afeatured%5e-%5eGolden%20Oldies%5e-%5ehindi?sid=164&flags=8236&sn=29
{% elif station == 'party' %}
x-sonosapi-radio:STATION%3afeatured%5e-%5eParty%5e-%5ehindi?sid=164&flags=8236&sn=29
{% elif station == 'chartbusters' %}
x-sonosapi-radio:STATION%3afeatured%5e-%5eChartbusters%5e-%5ehindi?sid=164&flags=8236&sn=29
{% elif station == 'flashback' %}
x-sonosapi-radio:STATION%3afeatured%5e-%5eFlashback%5e-%5ehindi?sid=164&flags=8236&sn=29
{% elif station == 'bollywood_instrumental' %}
x-rincon-mp3radio://123.176.41.8:8532
{% elif station == 'bollywood_radio_and_beyond' %}
x-rincon-mp3radio://96.31.83.86:8084
{% elif station == 'npr' %}
x-rincon-mp3radio://nprdmp-live01-mp3.akacast.akamaistream.net/7/998/364916/v1/npr.akacast.akamaistream.net/nprdmp_live01_mp3
{% elif station == 'wabe_news' %}
x-rincon-mp3radio://pba-ice.streamguys.org:80/news
{% elif station == 'wabe' %}
x-rincon-mp3radio://pba-ice.streamguys.org:80/wabe
{% endif %}
media_content_type: "MUSIC"
sonoslinein:
alias: 'Sonos set Line-in'
sequence:
- service: media_player.play_media
data:
entity_id: media_player.livingroomsonos
media_content_id: 'x-rincon-stream:RINCON_5CAAFD01D8BC01400'
media_content_type: "MUSIC"
lifxeffects:
alias: 'LIFX effects'
sequence:
- service: lifx.effect_colorloop
data_template:
entity_id:
- light.lifx3
- light.lifxnrguest
- light.lifxnrkitchen
brightness: "{{lifxbrightness}}"
period: "{{lifxtransition}}"
spread: "{{lifxspread}}"
change: "{{lifxchange}}"
colorloop_start:
alias: 'Start LIFX colorloop'
sequence:
- service: lifx.effect_colorloop
data:
entity_id:
- light.lifx3
- light.lifxnrguest
- light.lifxnrkitchen
brightness: 255
period: 15
spread: 359
change: 35
master_colorloop:
alias: 'Master start colorloop'
sequence:
- service: light.turn_on
data:
entity_id: light.master_1
brightness: 255
effect: colorloop
- service: light.turn_on
data:
entity_id: light.master_2
brightness: 255
effect: colorloop
- service: light.turn_on
data:
entity_id: light.master_3
brightness: 255
effect: colorloop
master_random:
alias: 'Master random'
sequence:
- service: light.turn_on
data:
entity_id: light.master_1
brightness: 255
effect: random
- service: light.turn_on
data:
entity_id: light.master_2
brightness: 255
effect: random
- service: light.turn_on
data:
entity_id: light.master_3
brightness: 255
effect: random
lifx_stop_effects:
alias: 'Stop LIFX effects'
sequence:
- service: lifx.effect_stop
data:
entity_id:
- light.lifxnrkitchen
- light.lifxnrguest
- light.lifx3
- service: light.turn_on
entity_id: light.living_room_lights
data:
rgb_color: [255, 255, 255]
brightness: 250
updatetracker:
alias: 'Update tracker'
sequence:
- service: python_script.meta_device_tracker
data_template:
entity_id: '{{entityid}}'
- condition: template
value_template: '{{fromstate != tostate}}'
- service: logbook.log
data_template:
name: "Tracker updated: "
message: >-
{{ states[entityid.split('.')[0]][entityid.split('.')[1]].name }} is {{ tostate }} at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p', true) }}.
portfolio:
sequence:
- service: input_number.set_value
data_template:
entity_id: input_number.portfoliovalue
value: "{{ value }}"
- service: input_number.set_value
data_template:
entity_id: input_number.portfoliochange
value: "{{ change }}"
initialize_hass:
alias: 'Initialize HASS after restart'
sequence:
- service: frontend.set_theme
data:
name: "oxfordblue"
- service: input_select.select_option
data:
entity_id: input_select.current_theme
option: "oxfordblue"
- service: device_tracker.see
data_template:
dev_id: test_rashmi
location_name: '{{states.device_tracker.life360_sonu.state|lower }}'
gps: [ '{{ states.device_tracker.life360_sonu.attributes.latitude }}' , '{{states.device_tracker.life360_sonu.attributes.longitude }}' ]
gps_accuracy: >-
{{ states.device_tracker.life360_sonu.attributes.gps_accuracy }}
attributes:
update_source: 'device_tracker.life360_sonu'
source_type: '{{ states.device_tracker.life360_sonu.attributes.source_type }}'
velocity: >-
{{ states.device_tracker.life360_sonu.attributes.speed }}
battery: >-
{{ states.device_tracker.life360_sonu.attributes.battery }}
- service: device_tracker.see
data_template:
dev_id: test_alok
location_name: '{{states.device_tracker.life360_alok_saboo.state|lower }}'
gps: [ '{{ states.device_tracker.life360_alok_saboo.attributes.latitude }}' , '{{states.device_tracker.life360_sonu.attributes.longitude }}' ]
gps_accuracy: >-
{{ states.device_tracker.life360_alok_saboo.attributes.gps_accuracy }}
attributes:
update_source: 'device_tracker.life360_alok_saboo'
source_type: '{{ states.device_tracker.life360_alok_saboo.attributes.source_type }}'
velocity: >-
{{ states.device_tracker.life360_alok_saboo.attributes.speed }}
battery: >-
{{ states.device_tracker.life360_alok_saboo.attributes.battery }}
- service: script.updatetracker
data_template:
entityid: 'device_tracker.life360_sonu'
fromstate: '{{states.device_tracker.life360_sonu.state}}'
tostate: '{{states.device_tracker.life360_sonu.state}}'
- service: script.updatetracker
data_template:
entityid: 'device_tracker.life360_alok_saboo'
fromstate: '{{states.device_tracker.life360_alok_saboo.state}}'
tostate: '{{states.device_tracker.life360_alok_saboo.state}}'
- service: script.updatetracker
data_template:
entityid: 'device_tracker.life360_arnav_saboo'
fromstate: '{{states.device_tracker.life360_arnav_saboo.state}}'
tostate: '{{states.device_tracker.life360_arnav_saboo.state}}'
- service_template: "homeassistant.turn_{{ 'on' if states.media_player.living_room_tv.state == 'on' else 'off' }}"
entity_id:
- input_boolean.tv
- service: input_select.select_option
data_template:
entity_id: input_select.abodestatus
option: "{{states.alarm_control_panel.abode_alarm.state}}"
# - service: ifttt.push_alarm_state
# data_template:
# entity_id: alarm_control_panel.abode
# state: "{{states.alarm_control_panel.abode_alarm.state}}"
# - service: ifttt.push_alarm_state
# data_template:
# entity_id: alarm_control_panel.aarlo_arlohome
# state: "{{states.alarm_control_panel.abode_alarm.state}}"
- service: input_select.select_option
data_template:
entity_id: input_select.livingroomharmony
option: "{{states.sensor.living_room.state}}"
- service: input_select.select_option
data_template:
entity_id: input_select.hdmiswitcher
option: >
{%- if states.remote.livingroom.attributes.current_activity == "Watch Apple TV" -%}
AppleTV
{%- elif states.remote.livingroom.attributes.current_activity == "Watch Fire TV" -%}
FireTV
{%- else -%}
Shield
{%- endif -%}
- service: input_number.set_value
data_template:
entity_id: input_number.harmonyvolume
value: >
{{ (state_attr('media_player.family_room_2', 'volume_level') * 100) | int }}
- service: homeassistant.turn_on
entity_id: script.classify_images
- wait_template: >-
{% if states("binary_sensor.homekit_ready") %}
true
{% else %}
false
{% endif %}
timeout: 00:05 # Waits 15 minutes
continue_on_timeout: false
classify_images:
alias: 'Process all images'
sequence:
# - service: shell_command.image_classify
# data_template:
# camera: "porch"
# - service: shell_command.image_classify
# data_template:
# camera: "patio"
# - service: shell_command.image_classify
# data_template:
# camera: "driveway"
# - service: shell_command.image_classify
# data_template:
# camera: "backyard"
- service: image_processing.scan
entity_id:
- image_processing.tensorflow_porch
- image_processing.tensorflow_patio
- image_processing.tensorflow_driveway
- image_processing.tensorflow_backyard
discovery:
alias: 'Play Discovery'
sequence:
service: media_player.play_media
data:
entity_id: media_player.shield
media_content_id: !secret discovery_url
media_content_type: tvshow
cnn:
alias: 'Play CNN'
sequence:
service: media_player.play_media
data:
entity_id: media_player.shield
media_content_id: !secret cnn_url
media_content_type: tvshow
disney:
alias: 'Play Disney'
sequence:
service: media_player.play_media
data:
entity_id: media_player.shield
media_content_id: !secret disney_url
media_content_type: tvshow
cnbc:
alias: 'Play CNBC'
sequence:
service: media_player.play_media
data:
entity_id: media_player.shield
media_content_id: !secret cnbc_url
media_content_type: tvshow
animalplanet:
alias: 'Play Animal Planet'
sequence:
service: media_player.play_media
data:
entity_id: media_player.shield
media_content_id: !secret animal_planet_url
media_content_type: tvshow
kodi_update_library:
alias: Kodi Update Library
sequence:
service: media_player.kodi_call_method
data:
entity_id: media_player.kodi_nstv
method: VideoLibrary.Scan
kodi_clean_library:
alias: Kodi Clean Library
sequence:
service: media_player.kodi_call_method
data:
entity_id: media_player.kodi_nstv
method: VideoLibrary.Clean
sonos_speech_toggle:
alias: Sonos - toggle speech mode
sequence:
service: homeassistant.toggle
data:
entity_id: switch.sonos_speech_enhance
shieldtv_youtube:
alias: 'Launch Youtube on Shield'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"
shieldtv_netflix:
alias: 'Launch Netflix on Shield'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n com.netflix.ninja/.MainActivity"
shieldtv_kodi:
alias: 'Launch Kodi on Shield'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n org.xbmc.kodi/.Splash"
shieldtv_thoptv:
alias: 'Launch ThopTV on Shield'
sequence:
- service: homeassistant.turn_off
entity_id: switch.pihole
- delay: '00:00:03'
- service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n live.aiplex.software/.Splash"
shieldtv_windscribe:
alias: 'Launch Windscribe on Shield'
sequence:
- service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n com.windscribe.vpn/.ui.activities.EntryPointActivity"
- delay: '00:00:03'
- service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "RIGHT" #KEYCODE_DPAD_RIGHT
- service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "ENTER" #KEYCODE_DPAD_CENTER
shieldtv_amazon_prime:
alias: 'Launch Prime on Shield'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n com.amazon.amazonvideo.livingroom/com.amazon.ignition.IgnitionActivity"
shieldtv_plex:
alias: 'Launch Plex on Shield'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "am start -a android.intent.action.VIEW -d -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity"
shieldtv_dpad_down:
alias: 'Shield DPad Down'
sequence:
service: androidtv.adb_command
data:
entity_id: media_player.shieldtv
command: "input keyevent 20" # see https://stackoverflow.com/questions/7789826/adb-shell-input-events
cast_patio:
alias: 'Cast Patio Camera'
sequence:
- service: camera.play_stream
data:
entity_id: camera.patio
media_player: media_player.shield
cast_porch:
alias: 'Cast Porch Camera'
sequence:
- service: camera.play_stream
data:
entity_id: camera.porch
media_player: media_player.shield
cast_driveway:
alias: 'Cast Driveway Camera'
sequence:
- service: camera.play_stream
data:
entity_id: camera.driveway
media_player: media_player.shield
cast_backyard:
alias: 'Cast Backyard Camera'
sequence:
- service: camera.play_stream
data:
entity_id: camera.backyard
media_player: media_player.shield
cast_cycle_cameras:
alias: 'Cast Cycle through all cameras'
sequence:
- service: homeassistant.turn_on
entity_id: script.cast_driveway
- delay: '00:00:15'
- service: homeassistant.turn_on
entity_id: script.cast_porch
- delay: '00:00:15'
- service: homeassistant.turn_on
entity_id: script.cast_patio
- delay: '00:00:15'
- service: homeassistant.turn_on
entity_id: script.cast_backyard
refresh_arlo_cameras:
alias: 'Arlo refresh snapshots'
sequence:
- service: camera.aarlo_request_snapshot
entity_id: camera.aarlo_arlolivingroom
- service: camera.aarlo_request_snapshot
entity_id: camera.aarlo_arlo3
- service: camera.aarlo_request_snapshot
entity_id: camera.aarlo_livingroom2