-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.yaml
executable file
·257 lines (231 loc) · 6.91 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
toggle_tv_power:
alias: TV on/off
sequence:
- service_template: >
{% if is_state('media_player.tv', 'off') %}
script.turn_tv_on
{% else %}
script.turn_tv_off
{% endif %}
turn_tv_on:
alias: Turn TV on
sequence:
- service: media_player.turn_on
data:
entity_id: media_player.google_tv
- delay:
seconds: 2
- service: media_player.turn_off
data:
entity_id: media_player.google_tv
turn_tv_off:
alias: Turn TV off
sequence:
- service: media_player.turn_off
data:
entity_id: media_player.tv
turn_tv_volume_up:
alias: Turn TV volume up
sequence:
- service: media_player.volume_up
data:
entity_id: media_player.tv
turn_tv_volume_down:
alias: Turn TV volume down
sequence:
- service: media_player.volume_down
data:
entity_id: media_player.tv
toggle_tv_mute:
alias: Toggle TV mute
sequence:
- service: media_player.volume_mute
data:
entity_id: media_player.tv
is_volume_muted: "{{ not state_attr('media_player.tv', 'is_volume_muted') }}"
play_pause_tv:
alias: Play/pause TV
sequence:
- service: media_player.media_play_pause
data:
entity_id: media_player.tv
stop_tv_media:
alias: Stop TV media
sequence:
- service: media_player.media_stop
data:
entity_id: media_player.tv
turn_everything_off:
alias: Turn everything off
sequence:
- service: media_player.turn_off
entity_id: media_player.tv
- service: light.turn_off
entity_id: all
- service: switch.turn_off
entity_id: all
good_morning_home:
alias: Turn lights on in the morning
sequence:
- service: light.turn_on
entity_id:
- light.living_room_christmas_star
- light.kitchen_ceiling
- service: switch.turn_on
entity_id:
- switch.advent_candlestick
- switch.christmas_tree
- switch.balcony_string_lights
cast_youtube:
alias: Cast YouTube
sequence:
- service: media_extractor.play_media
entity_id: media_player.google_tv
data:
media_content_id: "https://www.youtube.com/watch?v=ROkXM3csNWY"
media_content_type: video/youtube
cast_magic_mirror_camera:
alias: Cast Phone
sequence:
- service: media_extractor.play_media
data_template:
entity_id: "{{ media_player }}"
data:
media_content_id: !secret magic_mirror_video
media_content_type: image/jpg
turn_magic_mirror_screen_on:
alias: Turn on Magic Mirror screen
sequence:
- service: rest_command.fully_kiosk_browser_turn_screen_on
data:
device_ip: !secret magic_mirror_ip
device_port: !secret magic_mirror_fully_port
password: !secret magic_mirror_fully_password
turn_magic_mirror_screen_off:
alias: Turn off Magic Mirror screen
sequence:
- service: rest_command.fully_kiosk_browser_turn_screen_off
data:
device_ip: !secret magic_mirror_ip
device_port: !secret magic_mirror_fully_port
password: !secret magic_mirror_fully_password
turn_computer_on:
alias: Turn on computer
sequence:
- service: wake_on_lan.send_magic_packet
data:
mac: !secret computer_mac
turn_computer_off:
alias: Turn off computer
sequence:
- condition: state
entity_id: switch.computer_power
state: "on"
- service: shell_command.turn_off_computer
data:
ssh_user: !secret shutdown_ssh_user
user: !secret shutdown_computer_user
ip: !secret computer_ip
timeout: 10
flic_button_lights_click:
alias: Flic button Lights click
sequence:
- service: scene.turn_on
data:
entity_id: scene.evening
flic_button_lights_double_click:
alias: Flic button Lights double click
sequence:
- service: light.turn_on
data:
entity_id: all
brightness: 255
flic_button_lights_hold:
alias: Flic button Lights hold
sequence:
- service: script.turn_everything_off
play_sound:
alias: Play sound
sequence:
- service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id: !secret bitcoin_sound
media_content_type: audio/mp3
send_robocop_to_waste_bin:
alias: Send Robocop to waste bin
sequence:
- service: vacuum.stop
entity_id: vacuum.robocop
- delay:
seconds: 1
- service: vacuum.send_command
entity_id: vacuum.robocop
data:
command: app_goto_target
params: !secret waste_bin_location
dim_without_turn_off:
alias: Change brightness in steps without turning lights off
sequence:
- data_template:
brightness: 10
entity_id: "{{ entities | join(', ') }}"
service: light.turn_on
test_script:
alias: For testing purposes
sequence:
- service: system_log.write
data:
message: >
{{ expand(entity_id)
| map(attribute='entity_id')
| list }}
logger: mycomponent.myplatform
smart_dimming_set_level:
alias: Smart dimming of groups with lights in them
sequence:
# Set brightness by amount to all lights (when all are off), OR only the lights that would remain on by the brightness change
- service: light.turn_on
data:
brightness_step: "{{ brightness - state_attr('light.office_lights_smart', 'brightness')|int }}"
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand(entity_id)
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '>', -brightness_change)
| map(attribute='entity_id')
| list or
expand(entity_id)
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness != 255 else [] }}
# Set brightness to 1 for all lights that would turn off, keeping them on
- service: light.turn_on
data:
brightness_pct: 1
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand(entity_id)
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '<=', -brightness_change)
| map(attribute='entity_id')
| list
}}
# Set brightness to 100 for all lights currently on when slider moves to 100%, or all the lights if all are currently off
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: >
{{ expand("group.office")
| selectattr('attributes.brightness')
| map(attribute='entity_id')
| list or
expand(entity_id)
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness == 255 else [] }}