forked from matt8707/hass-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.yaml
executable file
·278 lines (250 loc) · 7.88 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
dator_on:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_dator
- service: switch.toggle
entity_id: switch.switchbot
- condition: template
value_template: "{{ is_state_attr('switch.switchbot', 'last_run_success', false) }}"
- service: script.turn_on
entity_id: script.dator_on_retry
dator_on_retry:
sequence:
- service: script.turn_on
entity_id: script.dator_on
dator_off:
sequence:
- condition: template
value_template: "{{ not is_state('input_boolean.lock_computer', 'on') }}"
- service: input_boolean.turn_on
entity_id: input_boolean.loading_dator
- service: shell_command.imac_turn_off
tv_on:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_braviatv
- service: script.turn_on
entity_id: script.vardagsrum_appletv_start
tv_off:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_braviatv
- service: media_player.turn_off
entity_id: media_player.sony_bravia_tv
tv2_on:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_samsungtv
- service: script.turn_on
entity_id: script.sovrum_appletv_start
tv2_off:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_samsungtv
- service: switch.turn_off
entity_id: switch.samsung_6_series_50
playstation_on:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_playstation
- service: media_player.turn_on
entity_id: media_player.playstation_4
playstation_off:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.loading_playstation
- service: media_player.turn_off
entity_id: media_player.playstation_4
dummy:
sequence:
say_auto_hemma:
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.tablet
media_content_id: >
{{ ['/local/tts_custom/hej.mp3', '/local/tts_custom/startar.mp3', '/local/tts_custom/varmer_upp.mp3', '/local/tts_custom/valkommen_hem.mp3'] | random }}
media_content_type: music
auto_hemma:
sequence:
- service: automation.turn_off
entity_id:
['automation.ui_sound_on', 'automation.ui_sound_off', 'automation.ui_sound_popup']
- service_template: >-
{% if is_state('switch.fullykiosk_screen', 'on') and is_state('switch.fullykiosk_screensaver', 'off') %}
script.say_auto_hemma
{% else %}
script.dummy
{% endif %}
- service: scene.turn_on
data_template:
entity_id: >
{% if is_state('sun.sun', 'below_horizon') %}
scene.hemma_below_horizon
{% else %}
scene.hemma_above_horizon
{% endif %}
- delay: '00:00:04'
- service: automation.turn_on
entity_id:
['automation.ui_sound_on', 'automation.ui_sound_off', 'automation.ui_sound_popup']
auto_hemma_tracker:
sequence:
- wait_template: "{{ is_state('person.mattias', 'home') or is_state('person.sanja', 'home') }}"
- service: script.turn_on
entity_id: script.auto_hemma
say_auto_stang_allt:
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.tablet
media_content_id: >
{{ ['/local/tts_custom/ha_det_bra.mp3',
'/local/tts_custom/saknar_dig_redan.mp3',
'/local/tts_custom/hej_da.mp3',
'/local/tts_custom/stanger_ner_allt.mp3'] | random}}
media_content_type: music
auto_stang_allt:
sequence:
- service: automation.turn_off
entity_id:
['automation.ui_sound_on', 'automation.ui_sound_off', 'automation.ui_sound_popup']
- service_template: >-
{% if is_state('switch.fullykiosk_screen', 'on') and is_state('switch.fullykiosk_screensaver', 'off') %}
script.say_auto_stang_allt
{% else %}
script.dummy
{% endif %}
- service: light.turn_off
entity_id: light.alla_lampor_utom_hall
- service: switch.turn_off
entity_id: switch.wemo_flakt
- service: switch.turn_off
entity_id: switch.wemo_monitorer
- service_template: >-
{% if is_state('input_boolean.lock_computer', 'on') %}
script.toast_dator_locked
{% elif is_state('switch.dator_template', 'on') %}
script.dator_off
{% else %}
script.dummy
{% endif %}
- service_template: >-
{% if is_state('switch.playstation_template', 'on') %}
script.playstation_off
{% else %}
script.dummy
{% endif %}
- service_template: >-
{% if is_state('switch.tv_template', 'on') %}
script.tv_off
{% else %}
script.dummy
{% endif %}
- service_template: >-
{% if is_state('switch.tv2_template', 'on') %}
script.tv2_off
{% else %}
script.dummy
{% endif %}
- delay: '00:00:04'
- service: automation.turn_on
entity_id:
['automation.ui_sound_on', 'automation.ui_sound_off', 'automation.ui_sound_popup']
reference_monitors:
sequence:
- service: shell_command.reference_click
- service: shell_command.reference_kill
- service: shell_command.reference_monitors
reference_headphones:
sequence:
- service: shell_command.reference_click
- service: shell_command.reference_kill
- service: shell_command.reference_headphones
toast_dator_locked:
sequence:
- service: browser_mod.toast
data:
duration: 8000
message: 'Dator är låst från att stängas av...'
homeassistant_restart:
sequence:
- service: browser_mod.toast
data:
duration: 16000
message: 'Startar om Home Assistant...'
- service: shell_command.restart_hass_docker
homekit_restart:
sequence:
- service: browser_mod.toast
data:
duration: 8000
message: 'Startar om Homekit...'
- service: homekit.start
tv_mute_toggle:
sequence:
- service: media_player.volume_mute
data_template:
entity_id: media_player.sony_bravia_tv
is_volume_muted: >-
{% if state_attr('media_player.sony_bravia_tv', 'is_volume_muted') == false %}
true
{% else %}
false
{% endif %}
tv2_mute_toggle:
sequence:
- service: media_player.volume_mute
data_template:
entity_id: media_player.samsung_tv_remote
is_volume_muted: >-
{% if state_attr('media_player.samsung_tv_remote', 'is_volume_muted') == false %}
true
{% else %}
false
{% endif %}
monitorer_mute_toggle:
sequence:
- service: homeassistant.update_entity
entity_id: sensor.monitorer_mute_check
- service_template: >
{% if states('sensor.monitorer_mute_check') == 'false' %}
shell_command.monitorer_mute_on
{% else %}
shell_command.monitorer_mute_off
{% endif %}
- service: homeassistant.update_entity
entity_id: sensor.monitorer_mute_check
vardagsrum_appletv_start:
sequence:
- service: remote.send_command
data:
entity_id: remote.vardagsrum
command: menu
sovrum_appletv_start:
sequence:
- service: remote.send_command
data:
entity_id: remote.sovrum
command: menu
media_ps4_ps_button:
sequence:
- service: ps4.send_command
data:
entity_id: media_player.playstation_4
command: ps
vacuum_start_pause:
sequence:
- service_template: >-
{% if is_state('vacuum.xiaomi_vacuum_cleaner', 'docked') or is_state('vacuum.xiaomi_vacuum_cleaner', 'paused') %}
vacuum.start
{% else %}
vacuum.pause
{% endif %}
entity_id: vacuum.xiaomi_vacuum_cleaner
restart_laundry_timer:
sequence:
- service: timer.cancel
entity_id: timer.laundry
- service: timer.start
entity_id: timer.laundry