-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyysprinkler_system.yaml
280 lines (258 loc) · 6.27 KB
/
yysprinkler_system.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
esphome:
name: sprinkler_system
platform: ESP32
board: esp-wrover-kit
on_boot:
priority: -10 # Run after all internal things done
then:
- delay: 2s
#- switch.turn_on: power
#- delay: 500ms
- switch.turn_off: power
on_shutdown:
then:
- switch.turn_off: power
wifi:
#power_save_mode: light # power reduced from ?.?w to ?.?w
#fast_connect: true
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
hidden: True
manual_ip:
static_ip: !secret ip_sprinkler_system
gateway: !secret ip_gateway
subnet: 255.255.255.0
ap: # Enable fallback hotspot (captive portal) in case wifi connection fails
ssid: "Sprinkler Fallback Hotspot"
password: !secret password
captive_portal:
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
password: !secret mqtt_password
#reboot_timeout: 0s # Dont reboot..
# Enable logging
logger:
# baud_rate: 0 # So we can use the RX and TX pins
# Enable Home Assistant API
api:
password: !secret password
reboot_timeout: 0s # Dont reboot..
ota:
password: !secret password
#status_led:
# pin: 16
switch:
- platform: gpio
name: "Sprinkler Zone 4 - West Grass"
pin:
number: GPIO13
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone1
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone2
- switch.is_off: zone3
- switch.is_off: zone4
- switch.is_off: zone5
- switch.is_off: zone6
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler Zone 1 - Front DRIP"
pin:
number: GPIO25
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone2
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone1
- switch.is_off: zone3
- switch.is_off: zone4
- switch.is_off: zone5
- switch.is_off: zone6
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler Zone 5 - North DRIP"
pin:
number: GPIO26
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone3
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone1
- switch.is_off: zone2
- switch.is_off: zone4
- switch.is_off: zone5
- switch.is_off: zone6
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler Zone 3 - East Grass"
pin:
number: GPIO27
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone4
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone1
- switch.is_off: zone2
- switch.is_off: zone3
- switch.is_off: zone5
- switch.is_off: zone6
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler Zone 2 - Mid Grass"
pin:
number: GPIO14
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone5
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone1
- switch.is_off: zone2
- switch.is_off: zone3
- switch.is_off: zone4
- switch.is_off: zone6
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler Zone 6 - Spare"
pin:
number: GPIO32
inverted: True
icon: "mdi:water-pump"
restore_mode: ALWAYS_OFF
id: zone6
on_turn_on:
if:
condition:
- switch.is_off: power
then:
- switch.turn_on: power
on_turn_off:
if:
condition:
- switch.is_off: zone1
- switch.is_off: zone2
- switch.is_off: zone3
- switch.is_off: zone4
- switch.is_off: zone5
then:
- switch.turn_off: power
- platform: gpio
name: "Sprinkler - 24v AC Power"
pin:
number: GPIO33
inverted: True
restore_mode: ALWAYS_OFF
id: power
# internal: True
on_turn_on:
- delay: 90min
- switch.turn_off: power
- platform: gpio
name: "Pond Pump"
pin:
number: GPIO15
inverted: True
icon: "mdi:fountain"
restore_mode: ALWAYS_OFF
id: pond
# internal: True
on_turn_on:
- delay: 120min
- switch.turn_off: pond
## https://esphome.io/components/sensor/xiaomi_miflora.html
#esp32_ble_tracker:
# scan_parameters:
# active: false
# #duration: 5s
#
sensor:
# - platform: xiaomi_hhccjcy01
# mac_address: C4:7C:8D:6A:AF:ED
# temperature:
# name: "Flora Temperature"
# moisture:
# name: "Flora Moisture"
# illuminance:
# name: "Flora Illuminance"
# conductivity:
# name: "Flora Soil Conductivity"
## #battery_level:
## # name: "Flora Battery Level"
# https://community.home-assistant.io/t/using-esphome-to-build-a-water-flow-rate-meter/119380/12
# https://community.home-assistant.io/t/using-esphome-to-build-a-water-flow-rate-meter/119380/29
- platform: pulse_counter
pin: GPIO2
name: "Sprinkler Water Flow"
update_interval: 30s
unit_of_measurement: "L/hr"
icon: "mdi:water"
accuracy_decimals: 1
filters:
- lambda: return ((x / 100.0) * 60);
# - lambda: return ((x / 8.0) * 60); #F=(8*Q-4)±5%,F:frequency Q:L/Min
# Capacitive Analog Soil Moisture Sensor
# https://esphome.io/components/sensor/adc.html?highlight=attenuation
- platform: adc
pin: GPIO34
name: "Soil Moisture Level"
update_interval: 300s
unit_of_measurement: "%"
icon: "mdi:flower-outline"
accuracy_decimals: 4
attenuation: 11db #can measure 3.9v
# filters:
# - calibrate_linear:
# - 0.38 -> 100
# - 0.7 -> 0