-
Notifications
You must be signed in to change notification settings - Fork 0
/
greenhouse.yaml
243 lines (231 loc) · 5.71 KB
/
greenhouse.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
---
substitutions:
device: greenhouse
name: Greenhouse
update_interval: 10min
esphome:
name: ${device}
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret lan_domain
power_save_mode: none
manual_ip:
static_ip: 192.168.0.66
gateway: 192.168.0.1
subnet: 255.255.255.0
esp32_ble_tracker:
<<: !include common/api.yaml
<<: !include common/ota.yaml
<<: !include common/web_server.yaml
<<: !include common/text_sensors.yaml
logger:
level: VERBOSE
logs:
ads1115: DEBUG
sensor: WARN
i2c:
ads1115:
- address: 0x48
mcp23017:
- id: "mcp23017_hub"
address: 0x20
switch:
- !include common/switch/restart.yaml
- platform: gpio
id: mcp23017_pin_0
name: "Greenhouse Valve 1"
icon: mdi:water-pump
pin:
mcp23017: mcp23017_hub
# Use pin number 0
number: 0
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
- platform: gpio
id: mcp23017_pin_1
name: "Greenhouse Valve 2"
icon: mdi:water-pump
pin:
mcp23017: mcp23017_hub
# Use pin number 1
number: 1
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
- platform: gpio
id: mcp23017_pin_2
name: "Greenhouse Valve 3"
icon: mdi:water-pump
pin:
mcp23017: mcp23017_hub
# Use pin number 2
number: 2
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
- platform: gpio
id: mcp23017_pin_3
name: "Greenhouse Valve 4"
icon: mdi:water-pump
pin:
mcp23017: mcp23017_hub
# Use pin number 3
number: 3
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
- platform: gpio
id: mcp23017_pin_4
name: "Window 1 UP"
pin:
mcp23017: mcp23017_hub
# Use pin number 4
number: 4
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
internal: true
- platform: gpio
id: mcp23017_pin_5
name: "Window 1 DOWN"
pin:
mcp23017: mcp23017_hub
# Use pin number 5
number: 5
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
internal: true
- platform: gpio
id: mcp23017_pin_6
name: "Window 2 UP"
pin:
mcp23017: mcp23017_hub
# Use pin number 6
number: 6
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
internal: true
- platform: gpio
id: mcp23017_pin_7
name: "Window 2 DOWN"
pin:
mcp23017: mcp23017_hub
# Use pin number 7
number: 7
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: false
internal: true
sensor:
- !include common/sensor/wifi-signal.yaml
- !include common/sensor/uptime.yaml
- platform: bme280
temperature:
name: "Greenhouse Temperature"
id: bme280_temperature
oversampling: 16x
pressure:
name: "Greenhouse Pressure"
id: bme280_pressure
humidity:
name: "Greenhouse Humidity"
id: bme280_humidity
address: 0x76
update_interval: 60s
- platform: xiaomi_hhccjcy01
mac_address: 80:EA:CA:89:0E:A2
temperature:
name: "Greenhouse Zone 3 Temperature"
moisture:
name: "Greenhouse Zone 3 Moisture"
illuminance:
name: "Greenhouse Zone 3 Illuminance"
conductivity:
name: "Greenhouse Zone 3 Soil Conductivity"
battery_level:
name: "Greenhouse Zone 3 Battery Level"
binary_sensor:
- !include common/binary_sensor/status.yaml
#- platform: gpio
- platform: homeassistant
entity_id: binary_sensor.serre_raam_1
id: window_1_state
# pin:
# number: GPIO16
# mode: INPUT_PULLUP
name: "Greenhouse Window 1"
# filters:
# - delayed_on: 100ms
device_class: "window"
internal: true
#- platform: gpio
- platform: homeassistant
entity_id: binary_sensor.serre_raam_2
id: window_2_state
# pin:
# number: GPIO4
# mode: INPUT_PULLUP
name: "Greenhouse Window 2"
# filters:
# - delayed_on: 500ms
device_class: "window"
internal: true
cover:
- platform: template
name: "Greenhouse Window 1"
id: window_1
lambda: |-
if (id(window_1_state).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
open_action:
- switch.turn_off: mcp23017_pin_5
- switch.turn_on: mcp23017_pin_4
# Failsafe: Turn off motors after 2min if endstop not reached.
- delay: 2 min
- switch.turn_off: mcp23017_pin_4
- cover.stop: window_1
close_action:
- switch.turn_off: mcp23017_pin_4
- switch.turn_on: mcp23017_pin_5
# Failsafe: Turn off motors after 2min if endstop not reached.
- delay: 2 min
- switch.turn_off: mcp23017_pin_5
- cover.stop: window_1
stop_action:
- switch.turn_off: mcp23017_pin_4
- switch.turn_off: mcp23017_pin_5
- platform: template
name: "Greenhouse Window 2"
id: window_2
lambda: |-
if (id(window_2_state).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
open_action:
- switch.turn_off: mcp23017_pin_7
- switch.turn_on: mcp23017_pin_6
# Failsafe: Turn off motors after 2min if endstop not reached.
- delay: 2 min
- switch.turn_off: mcp23017_pin_6
- cover.stop: window_2
close_action:
- switch.turn_off: mcp23017_pin_6
- switch.turn_on: mcp23017_pin_7
# Failsafe: Turn off motors after 2min if endstop not reached.
- delay: 2 min
- switch.turn_off: mcp23017_pin_7
- cover.stop: window_2
stop_action:
- switch.turn_off: mcp23017_pin_6
- switch.turn_off: mcp23017_pin_7