/
nursery.yaml
311 lines (296 loc) · 9.38 KB
/
nursery.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
input_boolean:
nap_mode:
name: Nap Mode
initial: on
icon: mdi:sleep
scene:
- name: nursery_led_on
entities:
light.nursery_led_strip:
state: "on"
brightness_pct: 100
rgb_color: [255, 191, 0]
color_temp: 311
- name: nursery_led_on_low
entities:
light.nursery_led_strip:
state: "on"
brightness_pct: 80
rgb_color: [255, 127, 0]
- name: baby_nap_on
entities:
switch.nursery_white_noise:
state: "on"
light.nursery_led_strip:
state: "off"
light.nursery_light:
state: "off"
- name: baby_nap_off
entities:
switch.nursery_white_noise:
state: "off"
switch.nursery_fan:
state: "off"
switch.nursery_humidifier:
state: "off"
automation:
- alias: Nap Mode Button Toggle
trigger:
- platform: event
event_type: zha_event
event_data:
device_ieee: "00:15:8d:00:03:50:26:b5"
command: "attribute_updated"
args:
value: 1
- platform: event
event_type: ios.action_fired
event_data:
actionID: nap_time
sourceDeviceID: michaels_iphone
action:
- service: homeassistant.toggle
entity_id:
- input_boolean.nap_mode
- delay:
seconds: 1
- alias: Nursery LED On
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: "00:0d:6f:ff:fe:a6:af:1d"
command: "on"
action:
- wait_template: '{{ not is_state("light.nursery_led_strip", "unavailable") }}'
- choose:
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "off"
sequence:
- service: scene.turn_on
entity_id: scene.nursery_led_on
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
sequence:
- service: scene.turn_on
entity_id: scene.nursery_led_on_low
- alias: Nursery LED Off
trigger:
- platform: event
event_type: zha_event
event_data:
device_ieee: "00:0d:6f:ff:fe:a6:af:1d"
command: "off"
- platform: sun
event: sunrise
action:
- wait_template: '{{ not is_state("light.nursery_led_strip", "unavailable") }}'
- service: light.turn_off
data:
entity_id:
- light.nursery_led_strip
- alias: Set Nap Accessories
trigger:
platform: state
entity_id: input_boolean.nap_mode
action:
- choose:
# Turning nap on
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
sequence:
- service: scene.turn_on
entity_id: scene.baby_nap_on
# Turning nap off
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "off"
sequence:
- choose:
- conditions:
- condition: sun
before: sunrise
sequence:
- service: scene.turn_on
entity_id: scene.baby_nap_off
- wait_template: '{{ not is_state("light.nursery_led_strip", "unavailable") }}'
- service: scene.turn_on
entity_id: scene.nursery_led_on
default:
- service: scene.turn_on
entity_id: scene.baby_nap_off
- service: homeassistant.turn_on
entity_id: light.nursery_light
- alias: Toggle TV Monitor
trigger:
platform: state
entity_id: input_boolean.nap_mode
condition:
- condition: time
after: "08:00:00"
action:
- wait_template: "{{ not is_state('media_player.living_room_mi_box_s', 'unavailable') }}"
continue_on_timeout: false
timeout: "00:20:00"
- choose:
# Turning nap on
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.living_room_mi_box_s
state: "off"
sequence:
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: "POWER"
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: !secret baby_cam_adb_command
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: "adb shell media volume --set 0"
default:
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: !secret baby_cam_adb_command
# Turning nap off
- conditions:
- condition: state
entity_id: input_boolean.nap_mode
state: "off"
sequence:
- wait_template: "{{ not is_state('media_player.living_room_mi_box_s', 'unavailable') }}"
continue_on_timeout: false
timeout: "00:20:00"
- choose:
- conditions:
- condition: template
value_template: "{{ not is_state('media_player.living_room_mi_box_s', 'off') }}"
sequence:
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: "HOME"
- service: androidtv.adb_command
data:
entity_id: media_player.living_room_mi_box_s
command: "POWER"
- alias: Nursery Humidifer on evenings
trigger:
platform: state
entity_id: input_boolean.nap_mode
from: "off"
to: "on"
condition:
- condition: and
conditions:
- condition: time
after: " 17:00:00"
- condition: template
# Only care about November - March
value_template: "{{ now().month >= 11 or now().month <= 3 }}"
action:
- service: homeassistant.turn_on
entity_id: switch.nursery_humidifier
- alias: Nursey Fan On if needed
trigger:
platform: state
entity_id: input_boolean.nap_mode
from: "off"
to: "on"
action:
service: homeassistant.turn_on
entity_id: switch.nursery_fan
condition:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.temperature # Outside forecast
above: 20
- condition: numeric_state
entity_id: sensor.kid_s_room_temperature #Acutal Room Temp
above: 25
- alias: Nursey Fan on if temperature rises
trigger:
platform: numeric_state
entity_id: sensor.kid_s_room_temperature
above: 25
condition:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
- condition: state
entity_id: switch.nursery_fan
state: "off"
action:
- service: homeassistant.turn_on
entity_id: switch.nursery_fan
- service: notify.mobile_app_michaels_iphone
data:
title: "Nursery Event"
message: "Nursey Temperature Fan Trigger"
- alias: Nursey Low Temperature Warning
trigger:
platform: numeric_state
entity_id: sensor.kid_s_room_temperature
below: 18
condition:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
action:
- service: notify.adults
data:
title: "Nursery Low Temperature Warning"
message: "Temperature droped to {{ states('sensor.kid_s_room_temperature') }}"
- service: homeassistant.turn_off
entity_id: switch.nursery_fan
- alias: Turn nursery off if forgotten
trigger:
- platform: state
entity_id: binary_sensor.kid_s_room
from: "on"
to: "off"
condition:
- condition: time
after: "08:30:00"
- condition: state
entity_id: input_boolean.nap_mode
state: "off"
action:
- service: homeassistant.turn_off
entity_id: input_boolean.nap_mode
- service: homeassistant.turn_off
entity_id: light.nursery_led_strip
- delay: 10
- service: homeassistant.turn_off
entity_id: light.nursery_light
- alias: Turn off nap mode via light switch
trigger:
- platform: state
entity_id: light.nursery_light
from: "off"
to: "on"
condition:
- condition: state
entity_id: input_boolean.nap_mode
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.nap_mode