-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomations.yaml
278 lines (261 loc) · 6.68 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
- alias: Toggle lights via switch
trigger:
- platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d0001839fab
click_type: single
- platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d000210a4fb
click_type: single
- platform: event
event_type: ios.action_fired
event_data:
actionName: Toggle lights
action:
service: light.toggle
entity_id: all
- alias: Turn off lights via switch
trigger:
- platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d0001839fab
click_type: long_click_press
- platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d000210a4fb
click_type: long_click_press
action:
service: light.turn_off
entity_id: all
- alias: Turn off AC via front door switch
trigger:
- platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d0001839fab
click_type: long_click_press
action:
- service: climate.turn_off
entity_id: climate.thermostat
- alias: Turn on night lights on motion
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d000122955e
to: 'on'
condition:
condition: numeric_state
entity_id: sensor.illumination_34ce0088f666
below: 500
action:
- service: light.turn_on
entity_id:
- light.gateway_light_34ce0088f666
- light.under_bed
data:
transition: 10
brightness_pct: 100
color_name: red
- alias: Turn off night lights after motion
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d000122955e
to: 'off'
for:
seconds: 30
action:
service: light.turn_off
entity_id:
- light.gateway_light_34ce0088f666
- light.under_bed
data:
transition: 90
- alias: Turn on bathroom vent
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001830feb
to: 'on'
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001830feb
to: 'off'
action:
service: switch.turn_on
entity_id: switch.plug_158d0001640e49
- alias: Turn off bathroom vent
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001830feb
to: 'on'
for:
minutes: 15
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001830feb
to: 'off'
for:
minutes: 15
action:
- service: switch.turn_off
entity_id: switch.plug_158d0001640e49
- alias: Xiaomi Cube - Brightness [Rotate]
trigger:
- platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_158d000231e4b8
action_type: rotate
action:
- service: light.turn_on
entity_id: all
data_template:
brightness_step_pct: "{{ trigger.event.data.action_value }}"
- alias: 'AQI warning'
trigger:
platform: numeric_state
entity_id:
- sensor.aqi
above: 25
for: "00:10:00"
action:
- service: tts.google_translate_say
entity_id: media_player.living_room_speaker
data:
message: 'Hazardous atmospheric conditions detected'
- alias: 'AQI control'
trigger:
platform: time_pattern
minutes: '/1'
action:
- service: xiaomi_miio.fan_set_favorite_level
entity_id: fan.air_purifier_2
data_template:
level: "{{ [[(states('sensor.aqi') | int / 2) | int, 2] | max, 14] | min }}"
- service: fan.set_preset_mode
entity_id: fan.air_purifier_2
data:
preset_mode: Favorite
- alias: AC on
trigger:
platform: state
entity_id: input_boolean.ac
to: 'on'
action:
- service: remote.send_command
entity_id: 'remote.remote'
data_template:
command: "ac_auto_{{ (state_attr('climate.thermostat', 'temperature'))|int }}"
- alias: AC off
trigger:
platform: state
entity_id: input_boolean.ac
to: 'off'
action:
- service: remote.send_command
entity_id: 'remote.remote'
data:
command:
- 'ac_off'
- alias: 'Sync thermostat with AC'
trigger:
platform: state
entity_id: sensor.target_temperature
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.ac
state: 'on'
action:
- service: remote.send_command
entity_id: 'remote.remote'
data_template:
command: "ac_auto_{{ (state_attr('climate.thermostat', 'temperature'))|int }}"
- alias: 'Sync thermostat off temperature with AC'
trigger:
platform: state
entity_id: sensor.target_temperature
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.ac
state: 'off'
action:
- service: remote.send_command
entity_id: 'remote.remote'
data:
command:
- 'ac_off'
- alias: 'Sync thermostat off with AC'
trigger:
platform: state
entity_id: climate.thermostat
condition:
condition: and
conditions:
- condition: state
entity_id: climate.thermostat
state: 'off'
action:
- service: remote.send_command
entity_id: 'remote.remote'
data:
command:
- 'ac_off'
- alias: Notify when door is opened
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_158d0002b6e9f4
to: 'on'
condition:
- condition: state
entity_id: person.dmytro_sadovnychyi
state: away
action:
- service: notify.notify
data:
message: 'Front door has been opened'
- alias: Google Cloud Platform Alert
trigger:
- platform: webhook
webhook_id: !secret gcp_webhook
action:
- data:
volume_level: 1.0
entity_id: media_player.living_room_speaker
service: media_player.volume_set
- service: tts.google_translate_say
entity_id: media_player.living_room_speaker
data:
message: 'Warning: Google Cloud Platform Alert Triggered'
- service: light.turn_off
entity_id: all
- delay:
seconds: 1
- service: light.turn_on
entity_id: all
data:
color_name: red
- delay:
seconds: 1
- service: light.turn_off
entity_id: all
- delay:
seconds: 1
- service: light.turn_on
entity_id: all
data:
color_name: red
- delay:
seconds: 1
- service: light.turn_off
entity_id: all
- delay:
seconds: 1
- service: light.turn_on
entity_id: all
data:
color_temp: 200