-
Notifications
You must be signed in to change notification settings - Fork 2
/
schedule.yaml
246 lines (240 loc) · 6.72 KB
/
schedule.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
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2023 Ilia Sotnikov
---
esphome:
platformio_options:
build_flags:
# Define the preprocessor macro indicating presence of schedule
# components so that dependent code could be conditional
- '-DHAS_SCHEDULE'
switch:
# Schedule, lawn sprinklers
- platform: template
id: lawn_sprinklers_mon
name: "Lawn sprinklers: Mon"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_tue
name: "Lawn sprinklers: Tue"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_wed
name: "Lawn sprinklers: Wed"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_thu
name: "Lawn sprinklers: Thu"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_fri
name: "Lawn sprinklers: Fri"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_sat
name: "Lawn sprinklers: Sat"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_sun
name: "Lawn sprinklers: Sun"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: lawn_sprinklers_disabled
name: "Lawn sprinklers: disable schedule"
icon: "mdi:calendar-remove"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
lambda: |-
// Prevent enabling schedule if winter mode is active
if (id(winter_mode).state)
return true;
return {};
# Schedule, flowerbed sprinklers
- platform: template
id: flowerbed_sprinklers_mon
name: "Flowerbed sprinklers: Mon"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_tue
name: "Flowerbed sprinklers: Tue"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_wed
name: "Flowerbed sprinklers: Wed"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_thu
name: "Flowerbed sprinklers: Thu"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_fri
name: "Flowerbed sprinklers: Fri"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_sat
name: "Flowerbed sprinklers: Sat"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_sun
name: "Flowerbed sprinklers: Sun"
icon: "mdi:calendar"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
- platform: template
id: flowerbed_sprinklers_disabled
name: "Flowerbed sprinklers: disable schedule"
icon: "mdi:calendar-remove"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
lambda: |-
// See above
if (id(winter_mode).state)
return true;
return {};
number:
# Schedule, lawn sprinklers
- platform: template
id: lawn_sprinklers_hour
name: "Lawn sprinklers: Hour"
icon: "mdi:clock"
entity_category: config
optimistic: true
restore_value: true
initial_value: 0
min_value: 0
max_value: 23
step: 1
mode: box
- platform: template
name: "Lawn sprinklers: Minute"
icon: "mdi:clock"
id: lawn_sprinklers_minute
entity_category: config
optimistic: true
restore_value: true
initial_value: 0
min_value: 0
max_value: 59
step: 1
mode: box
# Schedule, flowerbed sprinklers
- platform: template
name: "Flowerbed sprinklers: Hour"
icon: "mdi:clock"
id: flowerbed_sprinklers_hour
entity_category: config
optimistic: true
restore_value: true
initial_value: 0
min_value: 0
max_value: 23
step: 1
mode: box
- platform: template
name: "Flowerbed sprinklers: Minute"
icon: "mdi:clock"
id: flowerbed_sprinklers_minute
entity_category: config
optimistic: true
restore_value: true
initial_value: 0
min_value: 0
max_value: 59
step: 1
mode: box
external_components:
- source: github://hostcc/[email protected]
dynamic_on_time:
- id: lawn_schedule
rtc: ${rtc_id}
hour: lawn_sprinklers_hour
minute: lawn_sprinklers_minute
mon: lawn_sprinklers_mon
tue: lawn_sprinklers_tue
wed: lawn_sprinklers_wed
thu: lawn_sprinklers_thu
fri: lawn_sprinklers_fri
sat: lawn_sprinklers_sat
sun: lawn_sprinklers_sun
disabled: lawn_sprinklers_disabled
on_time:
- logger.log:
format: 'schedule: Waiting for water tank to be full'
tag: lawn_sprinklers
level: 'INFO'
- wait_until:
condition:
binary_sensor.is_off: ${water_tank_empty_id}
timeout: ${scheduled_start_wait_tank_full_duration}
- logger.log:
format: 'schedule: Starting full sprinkler cycle'
tag: lawn_sprinklers
level: 'INFO'
- sprinkler.start_full_cycle: lawn_sprinklers
- id: flowerbed_schedule
rtc: ${rtc_id}
hour: flowerbed_sprinklers_hour
minute: flowerbed_sprinklers_minute
mon: flowerbed_sprinklers_mon
tue: flowerbed_sprinklers_tue
wed: flowerbed_sprinklers_wed
thu: flowerbed_sprinklers_thu
fri: flowerbed_sprinklers_fri
sat: flowerbed_sprinklers_sat
sun: flowerbed_sprinklers_sun
disabled: flowerbed_sprinklers_disabled
on_time:
- logger.log:
format: 'schedule: Waiting for water tank to be full'
tag: flowerbed
level: 'INFO'
- wait_until:
condition:
binary_sensor.is_off: ${water_tank_empty_id}
timeout: ${scheduled_start_wait_tank_full_duration}
- logger.log:
format: 'schedule: Starting full sprinkler cycle'
tag: flowerbed
level: 'INFO'
- sprinkler.start_full_cycle: flowerbed_sprinklers