-
Notifications
You must be signed in to change notification settings - Fork 1
/
automations.yaml
246 lines (238 loc) · 8.79 KB
/
automations.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
- id: '1658870166462'
alias: Change Patio Vizio Source
description: ''
trigger:
- platform: state
entity_id:
- input_select.patio_vizio_input
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.patio_vizio_input
state: Power off
sequence:
- service: media_player.turn_off
data: {}
target:
entity_id: media_player.patio_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.patio_vizio'',''off'')}}'
sequence:
- service: media_player.turn_on
data_template:
entity_id: media_player.patio_vizio
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.patio_vizio_input'',''options'').index(states(''input_select.patio_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''patio_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.patio_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.patio_vizio'',''on'')}}'
sequence:
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.patio_vizio_input'',''options'').index(states(''input_select.patio_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''patio_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.patio_vizio
default: []
mode: single
- id: '1658870166663'
alias: Change Office Vizio Source
description: ''
trigger:
- platform: state
entity_id:
- input_select.office_vizio_input
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.office_vizio_input
state: Power off
sequence:
- service: media_player.turn_off
data: {}
target:
entity_id: media_player.office_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.office_vizio'',''off'')}}'
sequence:
- service: media_player.turn_on
data_template:
entity_id: media_player.office_vizio
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.office_vizio_input'',''options'').index(states(''input_select.office_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''office_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.office_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.office_vizio'',''on'')}}'
sequence:
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.office_vizio_input'',''options'').index(states(''input_select.office_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''office_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.office_vizio
default: []
mode: single
- id: '1658870177773'
alias: Change Kitchen Vizio Source
description: ''
trigger:
- platform: state
entity_id:
- input_select.kitchen_vizio_input
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.kitchen_vizio_input
state: Power off
sequence:
- service: media_player.turn_off
data: {}
target:
entity_id: media_player.kitchen_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.kitchen_vizio'',''off'')}}'
sequence:
- service: media_player.turn_on
data_template:
entity_id: media_player.kitchen_vizio
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.kitchen_vizio_input'',''options'').index(states(''input_select.kitchen_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''kitchen_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.kitchen_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.kitchen_vizio'',''on'')}}'
sequence:
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.kitchen_vizio_input'',''options'').index(states(''input_select.kitchen_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''kitchen_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.kitchen_vizio
default: []
mode: single
- id: '1658870199993'
alias: Change Bedroom Vizio Source
description: ''
trigger:
- platform: state
entity_id:
- input_select.bedroom_vizio_input
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.bedroom_vizio_input
state: Power off
sequence:
- service: media_player.turn_off
data: {}
target:
entity_id: media_player.bedroom_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.bedroom_vizio'',''off'')}}'
sequence:
- service: media_player.turn_on
data_template:
entity_id: media_player.bedroom_vizio
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.bedroom_vizio_input'',''options'').index(states(''input_select.bedroom_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''bedroom_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.bedroom_vizio
- conditions:
- condition: template
value_template: '{{is_state(''media_player.bedroom_vizio'',''on'')}}'
sequence:
- service: media_player.select_source
data_template:
source: '{% set choice = state_attr(''input_select.bedroom_vizio_input'',''options'').index(states(''input_select.bedroom_vizio_input''))
%} {% set tv = state_attr(''sensor.vizio_tvs'',''tvs'') | selectattr(''name'',''search'',''bedroom_vizio'')
| list %} {{ tv[0].inputs[choice].input }}
'
entity_id: media_player.bedroom_vizio
default: []
mode: single
- id: '1659026711599'
alias: Build Vizio Inputs
description: ''
trigger:
- platform: state
entity_id:
- sensor.vizio_tvs
condition: []
action:
- service: input_select.set_options
data_template:
entity_id: input_select.office_vizio_input
options: '{% set ttv = ''office_vizio'' %} {% for tvs in state_attr(''sensor.vizio_tvs'',''tvs'') %}
{% if tvs.name == ttv %} {{tvs.inputs | map(attribute=''fname'') | list }}
{% endif %} {% endfor %}'
- service: input_select.set_options
data_template:
entity_id: input_select.patio_vizio_input
options: '{% set ttv = ''patio_vizio'' %} {% for tvs in state_attr(''sensor.vizio_tvs'',''tvs'') %}
{% if tvs.name == ttv %} {{tvs.inputs | map(attribute=''fname'') | list }}
{% endif %} {% endfor %}'
- service: input_select.set_options
data_template:
entity_id: input_select.kitchen_vizio_input
options: '{% set ttv = ''kitchen_vizio'' %} {% for tvs in state_attr(''sensor.vizio_tvs'',''tvs'') %}
{% if tvs.name == ttv %} {{tvs.inputs | map(attribute=''fname'') | list }}
{% endif %} {% endfor %}'
- service: input_select.set_options
data_template:
entity_id: input_select.bedroom_vizio_input
options: '{% set ttv = ''bedroom_vizio'' %} {% for tvs in state_attr(''sensor.vizio_tvs'',''tvs'') %}
{% if tvs.name == ttv %} {{tvs.inputs | map(attribute=''fname'') | list }}
{% endif %} {% endfor %}'
mode: single