This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
scripts.yaml
executable file
·770 lines (765 loc) · 20.3 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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
toot_engine:
alias: Toot Engine
fields:
who:
name: Who
description: The notifier name that will send the toot. See Services for options.
required: true
default: mastodon
example: mastodon
selector:
text:
multiline: false
type: text
message:
name: Message
description: The message to toot.
required: true
example: Hello world!
selector:
text:
multiline: true
type: text
sequence:
- if:
- condition: not
conditions:
- condition: state
state: 'on'
entity_id: input_boolean.toot_engine
alias: Niet
then:
- stop: ''
- service: notify.{{ who | default('mastodon') }}
data:
message: '{{ message }}'
mode: queued
icon: mdi:elephant
max: 10
time_to_leave_for_robert:
alias: Time to Leave for Robert
icon: mdi:exit-run
mode: single
sequence:
- service: notify.robert
data:
message: Tijd om te vertrekken naar je werk.
printer_off:
alias: 'Kantoor: Printer ingeschakeld actionable melding'
sequence:
- service: notify.robert
data:
message: Printer staat nog aan
title: Printer
data:
actions:
- action: PRINTER_OFF
title: Uitschakelen
- action: PRINTER_REMIND
title: Herinneren
- action: PRINTER_IGNORE
title: Negeren
mode: single
morning_routine:
alias: Ochtendroutine
fields:
player:
name: Sonos Mediaspeler
description: The media player that plays the morning routine.
required: true
selector:
entity:
domain: media_player
integration: sonos
multiple: false
variables:
time_of_day: Goedemorgen.
vandaag: 'Het is vandaag {{ states(''sensor.weekday'') }} {{ states(''sensor.long_date'')
}} en de tijd is {{ states(''sensor.time'') }}.
'
weer: 'Het is nu {{ states(''sensor.knmi_thuis_omschrijving'') | lower }} en {{
state_attr(''weather.knmi_thuis'',''temperature'') | float(0) | round(0) }}
graden. Het wordt vandaag maximaal {{ state_attr(''weather.knmi_thuis'',''forecast'')[0].temperature
| float(0) | round(0) }} graden. Later vandaag: {{ states(''sensor.knmi_thuis_korte_dagverwachting'')
}}.
'
weer_waarschuwing: "{% if is_state('binary_sensor.knmi_thuis_waarschuwing','on')
%}\n Let op.\n {{ state_attr('binary_sensor.knmi_thuis_waarschuwing', 'Waarschuwing')
}}\n{% endif %}\n"
sequence:
- service: script.sonos_say
data:
entity_id: '{{ player }}'
message: '{{ time_of_day }} {{ vandaag }} {{ weer }} {{ weer_waarschuwing }}'
volume_percent: 30
- service: script.lees_het_nieuws_voor
data:
player: '{{ player }}'
volume_percent: 30
double_toggle:
alias: Lighting > Double Toggle
fields:
entity:
name: Light target
description: The light to toggle twice
required: true
selector:
entity:
domain: light
sequence:
- service: light.toggle
target:
entity_id: '{{ entity }}'
- service: light.toggle
target:
entity_id: '{{ entity }}'
mode: single
icon: mdi:lightbulb-on-70
bark_the_dog:
alias: Security > Bark The Dog
description: 'Loudly play the sound of a barking dog. Delay for the duration of
the clip afterwards. Lower the volume just in case. Limited to Sonos players.
'
fields:
entity_id:
name: Media Player
description: The media player that plays the sound
example: media_player.living_speaker
required: true
selector:
entity:
domain: media_player
integration: sonos
volume_pct:
name: Volume Level
description: The volume level of the barking dog. As loud as possible.
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: '%'
mode: slider
default: 100
example: '100'
sequence:
- variables:
volume_level: '{{ (volume_pct | int(100) / 100) | float }}'
- service: sonos.snapshot
data:
entity_id: '{{ entity_id }}'
- service: media_player.unjoin
data:
entity_id: '{{ entity_id }}'
- service: media_player.media_pause
target:
entity_id: '{{ entity_id }}'
- service: media_player.volume_set
data:
volume_level: '{{ volume_level | float }}'
entity_id: '{{ entity_id }}'
- service: media_player.play_media
data:
media_content_type: music
media_content_id: /local/sounds/dog-barking-noise.mp3
entity_id: '{{ entity_id }}'
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
alias: Delay so sound can start playing
- wait_template: '{{ is_state(entity_id, ''paused'') }}'
continue_on_timeout: true
alias: Wait until sound has finished playing
- service: sonos.restore
data:
entity_id: '{{ entity_id }}'
mode: single
icon: mdi:dog-side
movie_pause:
alias: Media > Pause movie
mode: single
icon: mdi:television-pause
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.apple_tv_woomkamer
state: playing
sequence:
- service: remote.send_command
data:
command: select
target:
entity_id: remote.apple_tv_woomkamer
- conditions:
- alias: Test if Living TV is playing a specific source
condition: and
conditions:
- condition: state
entity_id: media_player.living_tv
state: 'on'
- alias: Test for a list of sources
condition: or
conditions:
- condition: state
entity_id: media_player.living_tv
attribute: source
state: Netflix
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.living_tv
- service: media_player.volume_mute
target:
entity_id: media_player.living_tv
data:
is_volume_muted: true
movie_time_start:
alias: Media > Start Movie Time
icon: mdi:movie-open
mode: single
sequence:
- if:
- condition: state
entity_id: light.living
state: 'on'
then:
- service: scene.turn_on
target:
entity_id:
- scene.living_lighting_theater
data:
transition: 3
movie_time_stop:
alias: Media > Stop Movie Time
icon: mdi:movie-open-off
mode: single
sequence:
- if:
- condition: state
entity_id: light.living
state: 'on'
then:
- service: scene.turn_on
target:
entity_id:
- scene.living_lighting_min
data: {}
start_netflix:
alias: Media > Start Netflix on living TV
description: Start de TV als deze nog uit staat, en schakelt vervolgens Netflix
in.
icon: mdi:netflix
mode: single
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.living_tv
state: 'off'
sequence:
- service: notify.mobile_app_iphone_robert
data:
message: De TV wordt ingeschakeld voor Netflix. Een ogenblikje...
- service: media_player.turn_on
target:
entity_id: media_player.living_tv
data: {}
default: []
- wait_template: '{{ is_state(''media_player.living_tv'', ''on'') }}'
timeout: 00:01:00
- service: media_player.select_source
data:
source: Netflix
target:
entity_id: media_player.living_tv
- service: notify.living_tv
data:
message: Netflix is gestart. Veel kijkplezier!
switch_netflix_robert:
alias: Media > Ga naar Netflix van Robert on living TV
description: Start Netflix en open het profiel van Robert. Aangenomen dat de TV
al aan staat.
icon: mdi:netflix
mode: single
sequence:
- condition: state
entity_id: media_player.living_tv
state: 'on'
- service: media_player.select_source
target:
entity_id: media_player.living_tv
data:
source: Netflix
- delay:
seconds: 1
- service: webostv.button
data:
entity_id: media_player.living_tv
button: LEFT
- delay:
seconds: 1
- service: webostv.button
data:
entity_id: media_player.living_tv
button: LEFT
- delay:
seconds: 1
- service: webostv.button
data:
entity_id: media_player.living_tv
button: LEFT
- delay:
seconds: 1
- service: webostv.button
data:
entity_id: media_player.living_tv
button: LEFT
- delay:
seconds: 2
- service: webostv.button
data:
entity_id: media_player.living_tv
button: ENTER
double_toggle_office_desk_lamp:
alias: Lighting > Double Toggle Office Desk Lamp
sequence:
- service: script.double_toggle
data:
entity: light.office_desk_lamp
mode: single
icon: mdi:lightbulb-on-70
toggle_heater:
alias: Toggle Heater
sequence:
- choose:
- conditions:
- condition: state
entity_id: climate.office
state: 'off'
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: heat
target:
entity_id: climate.office
default:
- service: climate.set_hvac_mode
data:
hvac_mode: 'off'
target:
entity_id: climate.office
mode: single
icon: mdi:radiator
sonos_say:
alias: Sonos Text-To-Speech
description: Text to speech for Sonos devices.
mode: queued
max: 10
fields:
entity_id:
name: Entity
description: The media player that speeks the text
example: media_player.living_speaker
required: true
selector:
entity:
domain:
- media_player
integration: sonos
multiple: false
message:
name: Message
description: The message to speak
example: Hallo wereld!
required: true
selector:
text:
multiline: true
type: text
volume_percent:
name: Volume
description: Volume of the spoken text, Range 0-100
example: '30'
default: 30
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: '%'
mode: slider
variables:
volume_level: "{% if (volume_percent is none) or (volume_percent is undefined)
or (volume_percent == \"\") %}\n 0.3\n{% else %}\n {{ (volume_percent / 100)
| float(0) }}\n{% endif %}"
is_playing: '{{ is_state(entity_id, "playing") }}'
media: '{{ state_attr(entity_id,"media_content_id") }}'
is_cloud: '{{ (media.split(":")[0] == "x-sonos-vli") }}'
cannot_restore: '{{ is_playing and is_cloud }}'
sequence:
- if:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
then:
- service: sonos.snapshot
data:
entity_id: '{{ entity_id }}'
- service: media_player.unjoin
data:
entity_id: '{{ entity_id }}'
- service: media_player.media_pause
data:
entity_id: '{{ entity_id }}'
- service: media_player.volume_set
data:
entity_id: '{{ entity_id }}'
volume_level: '{{ volume_level }}'
- service: tts.cloud_say
data:
entity_id: '{{ entity_id }}'
message: '{{ message }}'
- alias: Delay for generating speech online
delay: 3
- alias: Wait until playing speech has finished
wait_template: '{{ is_state(entity_id, ''paused'') }}
'
- service: sonos.restore
data:
entity_id: '{{ entity_id }}'
icon: mdi:speaker-message
notify_living:
alias: Notify Living
fields:
message:
name: Message
description: Het uit te spreken bericht.
example: Hallo. Ik ben de virtuele assistent.
default: Hallo. Ik ben de virtuele assistent.
required: true
selector:
text:
multiline: true
type: text
icon:
name: Icon
description: De afbeelding die wordt getoond bij het bericht op de TV.
example: /config/www/img/home-assistant.png
default: /config/www/img/home-assistant.png
selector:
text:
multiline: false
type: text
sequence:
- variables:
message: '{{ message | default(''Hallo. Ik ben de virtuele assistent.'', true)
}}'
icon: '{{ icon | default(''/config/www/img/home-assistant.png'', true) }}'
- service: notify.living_tv
data:
message: '{{ message }}'
data:
icon: '{{ icon }}'
- condition: state
entity_id: input_boolean.do_not_disturb
state: 'off'
- service: chime_tts.say
target:
entity_id:
- media_player.office_speaker
- media_player.living_speaker
data:
chime_path: bells
delay: 450
tts_playback_speed: 100
volume_level: 0.3
tts_platform: cloud
message: '{{ message }}'
cache: true
announce: true
language: nl-NL
options:
voice: MaartenNeural
mode: single
icon: mdi:account-voice
notify_living_dashboard:
alias: Notify Living Dashboard
sequence:
- service: script.notify_living
data:
message: '{{ states(''input_text.notification_message'') }}'
mode: single
icon: mdi:account-voice
lees_het_nieuws_voor:
alias: Lees het nieuws voor
fields:
player:
name: Media player
description: The media player that reads the news. Currently limited to Sonos
speakers only.
required: true
selector:
entity:
domain: media_player
integration: sonos
example: media_player.sonos_living
volume_percent:
name: Player Volume
description: The player volume
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: '%'
mode: slider
default: 30
example: '30'
sequence:
- variables:
volume_level: '{{ ((volume_percent | default(30) | int(0)) / 100) | float(0)
}}'
- service: script.sonos_say
data:
entity_id: '{{ player }}'
message: 'Het nieuws van {{ ((states.sensor.anp_nieuws_audio.attributes.entries[0].title |
regex_replace(find=''0(\d)'', replace=''\\1'', ignorecase=True)).split()[-2] |
int(0)) % 12 }} uur.
'
volume_percent: '{{ volume_percent }}'
- service: sonos.snapshot
data:
entity_id: '{{ player }}'
- service: media_player.unjoin
data:
entity_id: '{{ player }}'
- service: media_player.media_pause
data:
entity_id: '{{ player }}'
- service: media_player.volume_set
data:
entity_id: '{{ player }}'
volume_level: '{{ volume_level }}'
- service: media_player.play_media
data:
media_content_id: '{{ states.sensor.anp_nieuws_audio.attributes.entries[0].media_content[0].url
}}'
media_content_type: music
target:
entity_id: '{{ player }}'
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
alias: Delay for 5 seconds, wait for media to download and start playing
- alias: Wait until media has finished, or max 2 minutes (> audio file)
wait_template: '{{ is_state( player,''paused'') }}'
timeout: '120'
continue_on_timeout: true
- service: sonos.restore
data:
entity_id: '{{ player }}'
mode: single
icon: mdi:account-voice
pauzeer_mediaspelers_woonkamer:
alias: Pauzeer mediaspelers woonkamer
sequence:
- service: media_player.media_pause
data: {}
target:
area_id: 474a3ca8a301432eb3b99533b9833d3e
mode: single
icon: mdi:pause
system_reset_error_warning_counters:
alias: 'System: Reset error warning counters'
sequence:
- service: counter.reset
data: {}
target:
entity_id:
- counter.system_errors
- counter.system_warnings
mode: single
icon: mdi:restore
garage_motion_timer_start:
alias: Pantry Light Timer Start
sequence:
- service: timer.start
data:
duration: '{{ states(''input_number.pantry_light_timeout'') | int(0) }}'
target:
entity_id: timer.pantry_light
mode: single
mindergas:
alias: 'Energy: Post meter reading to mindergas.nl'
description: A simple wrapper script around the RESTful command, to be able to post
a gas meter reading both manually through the Services menu in the developer tools
and call it from the automations editor.
mode: single
fields:
date:
name: Reading date
description: The date to post the last reading of.
required: true
selector:
date:
reading:
name: Meter reading
description: The last meter reading at the end of the day of the specified date.
required: true
default: 0
example: '1234.567'
selector:
number:
min: 0
max: 999999.999
step: 0.001
unit_of_measurement: m3
mode: box
sequence:
- service: rest_command.mindergas
data:
date: '{{ date }}'
reading: '{{ reading }}'
notification_engine:
alias: Notification Engine
fields:
message:
name: Message
description: The notification message. Required.
required: true
example: Hello world!
selector:
text:
multiline: true
type: text
media_players:
selector:
entity:
domain: media_player
multiple: true
name: Media Players
description: De mediaspelers om het bericht op af te spelen. Bericht wordt niet
afgespeeld indien leeg.
example: '["media_player.living_speaker", "media_player.office_speaker"]'
required: false
emergency:
selector:
boolean: {}
name: Emergency
required: true
description: Spreekt melding uit tijdens stiltetijd. Stuurt een mobiele en permanente
melding.
mobile:
selector:
boolean: {}
name: Mobile
required: true
persistent:
selector:
boolean: {}
name: Blijvend
description: Toont een blijvende melding.
required: true
sequence:
- variables:
emoji_alert: "{{ '\U0001F6A8 ' if emergency }}"
- alias: Maak blijvende melding
if:
- condition: or
conditions:
- condition: template
value_template: '{{ persistent }}'
alias: Blijvend ingeschakeld
- condition: template
value_template: '{{ emergency }}'
alias: Noodgeval
- condition: state
entity_id: input_boolean.do_not_disturb
state: 'on'
then:
- service: notify.persistent_notification
metadata: {}
data:
message: '{{ emoji_alert }}{{ message }}'
- alias: Verzend mobiel bericht
if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.occupancy_guests
state: 'off'
- alias: Mobiel of Noodgeval
condition: or
conditions:
- alias: Mobiel
condition: template
value_template: '{{ mobile }}'
- alias: Noodgeval
condition: template
value_template: '{{ emergency }}'
- condition: state
entity_id: input_boolean.do_not_disturb
state: 'on'
then:
- service: notify.family
metadata: {}
data:
message: '{{ emoji_alert }}{{ message }}'
- alias: Spreek bericht uit
if:
- condition: and
conditions:
- condition: template
value_template: '{{ media_players != null }}'
alias: Mediaspeler(s) gekozen
- condition: state
entity_id: input_boolean.occupancy_guests
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.do_not_disturb
state: 'off'
- condition: template
value_template: '{{ emergency }}'
alias: Noodgeval
then:
- variables:
chime: '{{ "/config/www/sounds/emergency.mp3" if emergency else "bells" }}'
- service: chime_tts.say
target:
entity_id: '{{ media_players }}'
data:
message: '{{ message }}'
chime_path: '{{ chime }}'
end_chime_path: ''
offset: 450
final_delay: 0
volume_level: 0.3
tts_platform: cloud
language: nl-NL
options:
voice: MaartenNeural
cache: true
announce: true
tts_speed: 100
tts_pitch: 0
join_players: false
unjoin_players: false
enabled: true
mode: single
run_speedtest:
alias: Run Speedtest
sequence:
- service: homeassistant.update_entity
metadata: {}
data: {}
target:
entity_id: sensor.orbi_router_downlink_bandwidth
mode: single
icon: mdi:speedometer