-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautomations.yaml
462 lines (451 loc) · 13 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
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
- id: ApagarLuzesAoSair
alias: Apagar as luzes ao sair
trigger:
- platform: state
entity_id: person.roberto_wagner
to: not_home
for:
minutes: 2
condition:
- condition: state
entity_id: group.todos_dispositivos
state: "on"
action:
- service: notify.mobile_app_s20
data:
title: Existem luzes ligadas em casa. Deseja desligá-las?
# yamllint disable rule:line-length
message: "{{ expand('group.todos_dispositivos') | selectattr('state', 'equalto', 'on') | map(attribute='name') | list | join(', ') }}"
# yamllint enable rule:line-length
data:
actions:
- action: desligar_luzes_notification
title: Desligar luzes
mode: single
- id: LigarAlarmeApagarLuzesAoSair
alias: Ligar Alarme e Apagar as luzer ao Sair
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: desligar_luzes_notification
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.alarme
- service: homeassistant.turn_off
entity_id: group.todos_dispositivos
- id: DesligarAlarmeAoChegar
alias: Desligar Alarme ao Chegar
trigger:
platform: state
entity_id: device_tracker.s20
to: home
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.alarme
- id: LigarLuzGaragem
alias: Ligar a luz da garagem ao detectar movimento
trigger:
- platform: state
entity_id: binary_sensor.portao_da_garagem
to: "on"
- platform: state
entity_id: binary_sensor.movimento_garagem
to: "on"
condition:
condition: and
conditions:
- condition: state
entity_id: light.luz_da_garagem
state: "off"
- condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
action:
- service: homeassistant.turn_on
entity_id: light.luz_da_garagem
- delay: 120
- service: homeassistant.turn_off
entity_id: light.luz_da_garagem
- id: ApagarLuzesBaixoAoFecharPorta
alias: Apagar Luzes Baixo ao Fechar Porta
trigger:
- platform: state
entity_id: binary_sensor.porta_da_frente
to: "off"
for:
minutes: 5
action:
- service: homeassistant.turn_off
entity_id: group.luzes_baixo
- id: NotificarCampainha
alias: Notificar Campainha
trigger:
- platform: state
entity_id: binary_sensor.campainha
from: "off"
to: "on"
action:
- service: notify.mobile_app_s20
data:
message: Alguem tocou a campainha
data:
clickAction: "/lovelace-mendes/rua"
tag: "campainha"
image: /api/camera_proxy/camera.camera1
- service: camera.snapshot
data:
entity_id: camera.camera1
# yamllint disable rule:line-length
filename: /media/local/campainha_{{as_local(states.automation.notificar_campainha.attributes.last_triggered).strftime('%Y%m%d_%H%M%S')}}.jpg
# yamllint enable rule:line-length
- id: NotificarPortao
alias: Notificar ao abrir portao
trigger:
- platform: state
entity_id: binary_sensor.portao_da_garagem
from: "off"
to: "on"
action:
- repeat:
sequence:
- service: notify.mobile_app_s20
data:
message: Portao Aberto
data:
clickAction: "/lovelace-mendes/rua"
tag: "portao-garagem"
actions:
- action: fechar_portao_notification
title: Fechar Portão
- delay: 00:01:00
until:
- condition: state
entity_id: binary_sensor.portao_da_garagem
state: "off"
- service: notify.mobile_app_s20
data:
message: Portao Fechado
data:
clickAction: "/lovelace-mendes/rua"
tag: "portao-garagem"
- id: fechar_portao_notification
alias: Fechar portao notificacao
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: fechar_portao_notification
action:
service: cover.close_cover
entity_id: cover.garagem
- id: LigarLuzEscada
alias: Ligar a luz da escada ao detectar movimento
trigger:
- platform: state
entity_id: group.escada_binary_sensors
to: "on"
condition:
condition: and
conditions:
- condition: state
entity_id: light.luz_da_escada_1
state: "off"
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: -0:01:00
- condition: sun
before: sunrise
before_offset: 0:01:00
action:
- service: homeassistant.turn_on
entity_id: light.luz_da_escada_1
- delay: 20
- service: homeassistant.turn_off
entity_id: light.luz_da_escada_1
- id: 13a588d725ce4a65a38e3fc001b861be
alias: Aspirador Velocidade
trigger:
platform: template
value_template: "{{state_attr('vacuum.hx_x506_cc_50_e3_59_15_b1', 'raw_state') == 'AutoClean'}}"
action:
- service: vacuum.set_fan_speed
data:
entity_id: vacuum.hx_x506_cc_50_e3_59_15_b1
fan_speed: Strong
- id: 09c0b93e91e54d27b269d0567db3d270
alias: Aspirador Carregar
trigger:
platform: template
value_template: "{{state_attr('vacuum.hx_x506_cc_50_e3_59_15_b1', 'raw_state') == 'BackCharging'}}"
action:
- service: notify.mobile_app_s20
data_template:
title: Faxina
message: Faxina Completa
- id: alerta_falta_energia
alias: Alerta Falta de Energia
trigger:
- platform: numeric_state
entity_id: sensor.voltagem_geral
below: 180
action:
- service: notify.mobile_app_s20
data:
title: Falta de energia
message: Falta de energia
mode: single
- alias: Alerta Nivel Agua
trigger:
platform: template
value_template: "{{ states.sensor.nivel_da_caixa.state|float < 30 }}"
for:
seconds: 300
condition:
condition: template
# yamllint disable rule:line-length
value_template: "{{ (as_timestamp(now()) - as_timestamp(states.automation.alerta_nivel_agua.attributes.last_triggered | default(0)) | int > 900)}}"
# yamllint enable rule:line-length
action:
- service: notify.mobile_app_s20
data_template:
title: Caixa de água
message: Nivel da caixa em {{states.sensor.nivel_da_caixa.state}}%
data:
actions:
- action: ligar_bomba_notification
title: Ligar Bomba
- id: ligar_bomba_notification
alias: Ligar Bomba Notificacao
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: ligar_bomba_notification
action:
service: switch.turn_on
entity_id: switch.bomba
- id: desligar_bomba
alias: Desligar Bomba
trigger:
- platform: template
value_template: "{{states.sensor.nivel_da_cisterna.state|float < 20}}"
for:
seconds: 10
- platform: template
value_template: "{{states.sensor.nivel_da_caixa.state|float > 90}}"
for:
seconds: 10
action:
service: switch.turn_off
entity_id: switch.bomba
- id: Dirigindo
alias: Dirigindo
trigger:
- platform: state
entity_id: binary_sensor.dirigindo
to: "on"
- platform: state
entity_id: device_tracker.s20
condition:
- condition: state
entity_id: binary_sensor.dirigindo
state: "on"
action:
- service: device_tracker.see
data:
dev_id: wrv
location_name: Em trânsito
host_name: WRV
gps:
- "{{ state_attr('device_tracker.s20', 'latitude') }}"
- "{{ state_attr('device_tracker.s20', 'longitude') }}"
gps_accuracy: "{{ state_attr('device_tracker.s20', 'gps_accuracy')
}}"
- id: Estacionando
alias: Estacionando
trigger:
platform: state
entity_id: binary_sensor.dirigindo
to: "off"
action:
- service: notify.mobile_app_s20
data:
message: request_location_update
- service: device_tracker.see
data:
dev_id: wrv
location_name: Estacionado
host_name: WRV
gps:
- "{{ state_attr('device_tracker.s20', 'latitude') }}"
- "{{ state_attr('device_tracker.s20', 'longitude') }}"
gps_accuracy: "{{ state_attr('device_tracker.s20', 'gps_accuracy')
}}"
- alias: Alarme Disparado
trigger:
- platform: state
entity_id:
- binary_sensor.movimento_escada_baixo
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.movimento_escada_cima
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.movimento_garagem
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.porta_da_frente
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.porta_de_tras
from: "off"
to: "on"
condition:
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarme
state: armed_away
- condition: state
entity_id: alarm_control_panel.alarme
state: triggered
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarme
- service: notify.mobile_app_s20
data:
title: ALARME!!!
message: Alarme em {{ trigger.from_state.attributes.friendly_name }}
- id: LigarTimerArMeninos
alias: LigarTimerArMeninos
trigger:
- platform: state
entity_id: input_boolean.ar_meninos_timer_enabled
to: "on"
action:
- service: timer.start
entity_id: timer.ar_meninos_timer
data_template:
duration: "{{ states('input_number.ar_meninos_timer_minutes') | int * 60 }}"
- id: DesligarTimerArMeninos
alias: DesligarTimerArMeninos
trigger:
- platform: state
entity_id: input_boolean.ar_meninos_timer_enabled
to: "off"
action:
- service: timer.cancel
entity_id: timer.ar_meninos_timer
- alias: TimerArMeninos
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.sleep
action:
- service: input_boolean.turn_off
entity_id: input_boolean.ar_meninos_timer_enabled
- service: fan.turn_on
entity_id: fan.ventilador_dos_meninos
- service: climate.turn_off
entity_id: climate.ar_condicionado_dos_meninos
# - id: TesteNotificacao
# alias: TesteNotificacao
# trigger:
# - platform: state
# entity_id: light.luz_da_sala
# to: "on"
# action:
# - service: notify.telegram
# data:
# title: "Teste de Luz"
# message: "Teste de Luz"
# data:
# inline_keyboard:
# - "Desligar luz:/desligar_luz_sala, Ligar Luzes:/ligar_luzes_sala"
# - alias: "TelegramTeste1"
# trigger:
# - platform: event
# event_type: telegram_callback
# event_data:
# command: "/desligar_luz_sala"
# action:
# - service: homeassistant.turn_off
# entity_id: light.luz_da_sala
# - alias: Alexa Actionable 1
# description: ""
# trigger:
# - platform: sun
# event: sunrise
# condition: []
# action:
# - service: script.activate_alexa_actionable_notification
# data:
# text:
# The front door has been unlocked for 5 mins,
# would you like me to lock it?
# event_id: actionable_notification_lock_left_unlocked
# alexa_device: media_player.kitchen_echo
# mode: single
# - alias: Alexa Actionable Response 1
# description: ""
# trigger:
# - platform: event
# event_type: alexa_actionable_notification
# event_data:
# event_id: actionable_notification_lock_left_unlocked
# event_response_type: ResponseYes
# condition: []
# action:
# - service: notify.mobile_app_marks_iphone_xs_max
# data:
# title: Alexa Actionable Notificiation
# message: This is an Alexa Actionable Notification
# mode: single
# - alias: Alexa Actionable 2 (empty kitchen)
# description: ""
# trigger:
# - platform: state
# entity_id: binary_sensor.presence_12
# to: "off"
# for: "minutes: 30"
# condition:
# - condition: state
# entity_id: light.kitchen_light
# state: "on"
# action:
# - service: script.activate_alexa_actionable_notification
# data:
# text: the kitchen has been empty for a while.
# Should I turn off the lights
# event_id: actionable_notification_kitchen_lights
# alexa_device: media_player.kitchen_echo
# mode: single
# - alias: Alexa Actionable Response 2 (empty kitchen)
# description: ""
# trigger:
# - platform: event
# event_type: alexa_actionable_notification
# event_data:
# event_id: actionable_notification_kitchen_lights
# event_response_type: ResponseYes
# condition: []
# action:
# - service: light.turn_off
# target:
# entity_id: light.light_1
# mode: single