forked from arsaboo/homeassistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.yaml
457 lines (444 loc) · 15.4 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
#################################################################
## 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.arlohome
- alarm_control_panel.abode
- 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":"AbodeAway", "value1":"Arm Abode"}
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
- alarm_control_panel.abode
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.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.arlohome
- alarm_control_panel.abode
- service: switch.turn_off
entity_id:
- switch.downstairs_away
- switch.upstairs_away
- switch.bedroom_away
- service: light.turn_off
entity_id: group.living_room_lights
# - 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: media_player.sonos_snapshot
data_template:
entity_id: "{{ sonos_entity|default('media_player.livingroomsonos') }}"
- service: media_player.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: media_player.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: media_player.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: media_player.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"
colorloop_start:
alias: 'Start LIFX colorloop'
sequence:
- service: light.lifx_effect_colorloop
data:
entity_id: group.living_room_lights
brightness: 255
period: 15
spread: 359
change: 35
disco_party:
alias: 'Start Party Mode'
sequence:
- service: light.lifx_effect_colorloop
data:
entity_id: group.living_room_lights
brightness: 255
period: 1
spread: 359
change: 35
master_colorloop:
alias: 'Master start colorloop'
sequence:
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
brightness: 255
effect: colorloop
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_2
brightness: 255
effect: colorloop
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_3
brightness: 255
effect: colorloop
master_random:
alias: 'Master random'
sequence:
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
brightness: 255
effect: random
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_2
brightness: 255
effect: random
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_3
brightness: 255
effect: random
lifx_stop_effects:
alias: 'Stop LIFX effects'
sequence:
- service: light.lifx_effect_stop
data:
entity_id: group.all_lights
- service: light.turn_on
entity_id: group.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: script.updatetracker
data_template:
entityid: 'device_tracker.sonu_sonu'
fromstate: '{{states.device_tracker.sonu_sonu.state}}'
tostate: '{{states.device_tracker.sonu_sonu.state}}'
- service: script.updatetracker
data_template:
entityid: 'device_tracker.alok_alok'
fromstate: '{{states.device_tracker.alok_alok.state}}'
tostate: '{{states.device_tracker.alok_alok.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: alarm_control_panel.ifttt_push_alarm_state
# data_template:
# entity_id: alarm_control_panel.abode
# state: "{{states.alarm_control_panel.abode_alarm.state}}"
- service: alarm_control_panel.ifttt_push_alarm_state
data_template:
entity_id: alarm_control_panel.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
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.opencv_porch
- image_processing.opencv_patio
- image_processing.opencv_driveway
- image_processing.opencv_backyard
- image_processing.tensorflow_porch
- image_processing.tensorflow_patio
- image_processing.tensorflow_driveway
- image_processing.tensorflow_backyard
- image_processing.deepstack_porch
- image_processing.deepstack_patio
- image_processing.deepstack_driveway
- image_processing.deepstack_backyard
- image_processing.facebox_backyard
- image_processing.facebox_patio
- image_processing.facebox_driveway
- image_processing.facebox_porch
- image_processing.tagbox_backyard
- image_processing.tagbox_patio
- image_processing.tagbox_driveway
- image_processing.tagbox_porch
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