forked from daxda/HomeAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
automations.yaml
executable file
·322 lines (296 loc) · 8.23 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
###### SONOS ######
- alias: Test Sonos
initial_state: False
trigger:
platform: state
entity_id: automation.test_sonos
to: 'on'
action:
- service: media_player.select_source
data:
entity_id: media_player.salotto
source: Lancia Flow
##### METEO #################
- alias: Pioggia
trigger:
platform: numeric_state
entity_id: sensor.netatmo_regenmesser_sum_rain_1
above: 0.2
condition:
condition: and
conditions:
# Solo una volta all'ora
- condition: template
value_template: >
{% if states.automation.pioggia.last_triggered is not none %}
{% if as_timestamp(now()) | int - as_timestamp(states.automation.pioggia.attributes.last_triggered) | int > 3600 %} true {% else %} false
{% endif %}
{% else %}
false
{% endif %}
# Solo se la posizione di entrambe le finestre non è già semibassa
- condition: template
value_template: '{{ (states.cover.level_2.attributes.current_position > 20) and (states.cover.level_3.attributes.current_position > 20) }}'
action:
- service: notify.telefoni
data:
message: "Piove...! Chiudo le finestre che posso chiudere, per le altre organizzati!"
- service: script.pioggia
########## ILLUMINAZIONE ###################
#####Luce Camerina
- alias: Camerina out # dopo 5 minuti di assenza imposta la luminosità al minimo
trigger:
platform: state
entity_id: binary_sensor.sensor
to: 'off'
for:
minutes: 4
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: state
entity_id: light.level_2
state: 'on'
action:
- service: light.turn_on
data:
entity_id: light.level_2
brightness: 3
- service: automation.turn_on
entity_id: automation.camerina_return
- alias: Camerina return # se rientro nella stanza reimposta la luminosità al 50%
initial_state: False
trigger:
platform: state
entity_id: binary_sensor.sensor
to: 'on'
action:
- service: light.turn_on
data:
entity_id: light.level_2
brightness_pct: 50
- service: automation.turn_off
entity_id: automation.camerina_return
- alias: Camerina out out # se dopo 15 minuti non sono rientrato spengi la luce e disattiva la riaccensione automatica
trigger:
platform: state
entity_id: binary_sensor.sensor
to: 'off'
for:
minutes: 15
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: state
entity_id: light.level_2
state: 'on'
action:
- service: light.turn_off
data:
entity_id: light.level_2
- service: automation.turn_off
entity_id: automation.camerina_return
- alias: Camerina out day #di giorno spengi dopo 6 minuti
trigger:
platform: state
entity_id: binary_sensor.sensor
to: 'off'
for:
minutes: 6
condition:
- condition: state
entity_id: sun.sun
state: "above_horizon"
action:
service: light.turn_off
data:
entity_id: light.level_2
########## Luce studio
- alias: Bagno Sera
trigger:
platform: state
entity_id: light.studio
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: time
after: '18:00:00'
before: '23:59:59'
action:
service: light.turn_on
data:
entity_id: light.studio
brightness_pct: 10
transition: 5
########## Luce Bagno Grande
- alias: Bagno Sera
trigger:
platform: state
entity_id: light.level
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: time
after: '18:00:00'
before: '23:59:59'
action:
service: light.turn_on
data:
entity_id: light.level
brightness_pct: 15
- alias: Bagno Notte
trigger:
platform: state
entity_id: light.level
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: time
after: '00:00:01'
before: '07:00:00'
action:
service: light.turn_on
data:
entity_id: light.level
brightness_pct: 3
########## Luce Philips
- alias: Guardo la TV
trigger:
platform: state
entity_id: media_player.lg_tv_remote
to: 'playing'
condition:
condition: state
entity_id: sun.sun
state: "below_horizon"
action:
service: switch.turn_on
entity_id: switch.switch_15
- alias: Philips Energy
trigger:
platform: time
at: '1:40:00'
condition:
- condition: state
entity_id: switch.switch_15
state: 'on'
- condition: state
entity_id: media_player.lg_tv_remote
state: 'off'
action:
service: switch.turn_off
entity_id: switch.switch_15
# - alias: Pulsante Philips
# trigger:
# platform: state
# entity_id: zwave.neo_coolcam_power_plug_12a_5
# to: ''
# action:
# service: switch.toggle
# entity_id: switch.switch_15
############## AUTOMAZIONI DI SERVIZIO #################
- alias: Start HomeKit
trigger:
- platform: event
event_type: zwave.network_ready
action:
- delay: '00:01:00'
- service: homekit.start
- alias: Backup Automatico
trigger:
platform: time
at: '3:00:00'
condition:
- condition: time
weekday:
- mon
action:
- service: hassio.snapshot_full
data_template:
name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
########### NOTIFICHE ##########
- alias: Attiva Notifica lavatrice
trigger:
- platform: numeric_state
entity_id: sensor.neo_coolcam_power_plug_12a_power_8
above: '50'
action:
- service: automation.turn_on
entity_id: automation.notifica_fine_lavaggio
- alias: Notifica fine lavaggio
initial_state: False
trigger:
- platform: numeric_state
entity_id: sensor.neo_coolcam_power_plug_12a_power_8
below: '3'
for:
minutes: 8
action:
- service: notify.ios_davides_iphone
data:
message: "La lavatrice ha completato il lavaggio"
- service: notify.firetv
data:
message: "La lavatrice ha completato il lavaggio"
- service: notify.ios_iphone_di_muriel
data:
message: "Vedi che il marito NERD può essere utile ?!! La LAVATRICE è Pronta"
- service: automation.turn_off
entity_id: automation.notifica_fine_lavaggio
- alias: Notifica aggiornamento
trigger:
- platform: state
entity_id: updater.updater
action:
service: notify.ios_davides_iphone
data_template:
message: "È disponibile Home Assistant {{ states.updater.updater.state }}."
- alias: Spazio Libero
trigger:
platform: numeric_state
entity_id: sensor.disk_use_percent_
above: 85
below: 90
action:
- service: notify.ios_davides_iphone
data:
message: "Spazio libero sulla SD in esaurimento!"
- service: automation.turn_off
data:
entity_id: automation.backup_automatico
- service: notify.ios_davides_iphone
data:
message: "Backup Automatico disattivato"
- alias: Toner
trigger:
platform: numeric_state
entity_id: sensor.samsung_m2020_series_1921681137_toner_black
below: 10
action:
- service: notify.telefoni
data:
message: "È quasi finito il toner della stampante Samsung M2020, ricordati di comprarlo"
- alias: Test Notifica
initial_state: False
trigger:
platform: state
entity_id: automation.test_notifica
to: 'on'
action:
- service: notify.firetv
data:
title: "TEST"
message: "Test Notifica"
- service: notify.ios_davides_iphone
data:
message: "Test Notifica iOS"