forked from barrenechea/esphome-config-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
peristaltic-aux.yaml
266 lines (248 loc) · 7.05 KB
/
peristaltic-aux.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
substitutions:
pwm_frequency: 20000 Hz
esphome:
name: peristaltic-aux
esp32:
board: wemos_d1_mini32
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
output:
- platform: template
id: pump1_target_speed
type: float
write_action:
then:
- if:
condition:
switch.is_on: pump1_reverse
then:
- output.turn_off: pump1_direction_pin1
- output.turn_on: pump1_direction_pin2
else:
- output.turn_on: pump1_direction_pin1
- output.turn_off: pump1_direction_pin2
- if:
condition:
light.is_on: pump1_speed_controller
then:
- output.set_level:
id: pump1_speed_pin
level: !lambda return (0.4 + (0.6 * id(pump1_speed_controller).current_values.get_brightness()));
else:
- output.turn_off: pump1_speed_pin
- platform: template
id: pump2_target_speed
type: float
write_action:
then:
- if:
condition:
switch.is_on: pump2_reverse
then:
- output.turn_off: pump2_direction_pin1
- output.turn_on: pump2_direction_pin2
else:
- output.turn_on: pump2_direction_pin1
- output.turn_off: pump2_direction_pin2
- if:
condition:
light.is_on: pump2_speed_controller
then:
- output.set_level:
id: pump2_speed_pin
level: !lambda return (0.4 + (0.6 * id(pump2_speed_controller).current_values.get_brightness()));
else:
- output.turn_off: pump2_speed_pin
- platform: template
id: pump3_target_speed
type: float
write_action:
then:
- if:
condition:
switch.is_on: pump3_reverse
then:
- output.turn_off: pump3_direction_pin1
- output.turn_on: pump3_direction_pin2
else:
- output.turn_on: pump3_direction_pin1
- output.turn_off: pump3_direction_pin2
- if:
condition:
light.is_on: pump3_speed_controller
then:
- output.set_level:
id: pump3_speed_pin
level: !lambda return (0.4 + (0.6 * id(pump3_speed_controller).current_values.get_brightness()));
else:
- output.turn_off: pump3_speed_pin
- platform: template
id: pump4_target_speed
type: float
write_action:
then:
- if:
condition:
switch.is_on: pump4_reverse
then:
- output.turn_off: pump4_direction_pin1
- output.turn_on: pump4_direction_pin2
else:
- output.turn_on: pump4_direction_pin1
- output.turn_off: pump4_direction_pin2
- if:
condition:
light.is_on: pump4_speed_controller
then:
- output.set_level:
id: pump4_speed_pin
level: !lambda return (0.4 + (0.6 * id(pump4_speed_controller).current_values.get_brightness()));
else:
- output.turn_off: pump4_speed_pin
- platform: ledc
id: pump1_speed_pin
pin: GPIO26
frequency: $pwm_frequency
- platform: gpio
id: pump1_direction_pin1
pin: GPIO21
- platform: gpio
id: pump1_direction_pin2
pin: GPIO32
- platform: ledc
id: pump2_speed_pin
pin: GPIO18
frequency: $pwm_frequency
- platform: gpio
id: pump2_direction_pin1
pin: GPIO25
- platform: gpio
id: pump2_direction_pin2
pin: GPIO22
- platform: ledc
id: pump3_speed_pin
pin: GPIO19
frequency: $pwm_frequency
- platform: gpio
id: pump3_direction_pin1
pin: GPIO4
- platform: gpio
id: pump3_direction_pin2
pin: GPIO2
- platform: ledc
id: pump4_speed_pin
pin: GPIO23
frequency: $pwm_frequency
- platform: gpio
id: pump4_direction_pin1
pin: GPIO16
- platform: gpio
id: pump4_direction_pin2
pin: GPIO17
light:
- platform: monochromatic
id: pump1_speed_controller
name: "Aux Pump 1"
output: pump1_target_speed
default_transition_length: 0s
gamma_correct: 0
- platform: monochromatic
id: pump2_speed_controller
name: "Aux Pump 2"
output: pump2_target_speed
default_transition_length: 0s
gamma_correct: 0
- platform: monochromatic
id: pump3_speed_controller
name: "Aux Pump 3"
output: pump3_target_speed
default_transition_length: 0s
gamma_correct: 0
- platform: monochromatic
id: pump4_speed_controller
name: "Aux Pump 4"
output: pump4_target_speed
default_transition_length: 0s
gamma_correct: 0
switch:
- platform: restart
name: "Peristaltic Aux Restart"
- platform: gpio
pin: GPIO27
name: "Enable Aux Pumps 1-2"
- platform: gpio
pin: GPIO33
name: "Enable Aux Pumps 3-4"
- platform: template
name: "Aux Pump 1 Reverse"
id: pump1_reverse
turn_on_action:
- output.turn_off: pump1_direction_pin1
- output.turn_on: pump1_direction_pin2
- switch.template.publish:
id: pump1_reverse
state: ON
turn_off_action:
- output.turn_on: pump1_direction_pin1
- output.turn_off: pump1_direction_pin2
- switch.template.publish:
id: pump1_reverse
state: OFF
- platform: template
name: "Aux Pump 2 Reverse"
id: pump2_reverse
turn_on_action:
- output.turn_off: pump2_direction_pin1
- output.turn_on: pump2_direction_pin2
- switch.template.publish:
id: pump2_reverse
state: ON
turn_off_action:
- output.turn_on: pump2_direction_pin1
- output.turn_off: pump2_direction_pin2
- switch.template.publish:
id: pump2_reverse
state: OFF
- platform: template
name: "Aux Pump 3 Reverse"
id: pump3_reverse
turn_on_action:
- output.turn_off: pump3_direction_pin1
- output.turn_on: pump3_direction_pin2
- switch.template.publish:
id: pump3_reverse
state: ON
turn_off_action:
- output.turn_on: pump3_direction_pin1
- output.turn_off: pump3_direction_pin2
- switch.template.publish:
id: pump3_reverse
state: OFF
- platform: template
name: "Aux Pump 4 Reverse"
id: pump4_reverse
turn_on_action:
- output.turn_off: pump4_direction_pin1
- output.turn_on: pump4_direction_pin2
- switch.template.publish:
id: pump4_reverse
state: ON
turn_off_action:
- output.turn_on: pump4_direction_pin1
- output.turn_off: pump4_direction_pin2
- switch.template.publish:
id: pump4_reverse
state: OFF