-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwaterflowkit.yaml
309 lines (276 loc) · 7.23 KB
/
waterflowkit.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
#Name of device
substitutions:
device_name: waterflowkit
friendly_name: WaterFlowKit
waterflowkit_software_version: "2024.01"
#Esphome start
esphome:
name: ${device_name}
friendly_name: ${friendly_name}
project:
name: "smarthomeshop.waterflowkit"
version: ${waterflowkit_software_version}
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
#Enable Over the Air updates
ota:
- platform: esphome
dashboard_import:
package_import_url: github://smarthomeshop/waterflowkit/waterflowkit.yaml@main
wifi:
# remove leading '#' and fill in your wifi details
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}
password: ${device_name}
captive_portal:
web_server:
port: 80
# Switch to restart the waterflowkit
switch:
- platform: restart
id: switch_restart
name: "${friendly_name} Restart"
output:
- platform: ledc
pin: GPIO16
id: output_led_green
- platform: ledc
pin: GPIO17
id: output_led_red
- platform: ledc
pin: GPIO04
id: output_led_blue
light:
- platform: monochromatic
id: light_led_green
output: output_led_green
- platform: status_led
id: light_led_red
output: output_led_red
- platform: monochromatic
id: light_led_blue
output: output_led_blue
i2c:
sda: GPIO21
scl: GPIO22
# Time for uptime
time:
- platform: homeassistant
id: time_homeassistant
on_time_sync:
- component.update: sensor_uptime_timestamp
- platform: sntp
id: time_sntp
sensor:
#Wifi signal
- platform: wifi_signal
name: "${friendly_name} WiFi Signal"
update_interval: 300s
id: sensor_wifi_signal
# Uptime Sensor
#
# The uptime sensor allows you to track the time the ESP has stayed up for in
# seconds. Time rollovers are automatically handled.
#
# https://esphome.io/components/sensor/uptime.html
#
#
# WARNING! DO NOT USE THIS SENSOR IN HOME ASSISTANT!
#
# I see many of you using this sensor in Home Assistant, but please, don't.
# There is no need to have an update of the uptime, just send the timestamp
# of when the device started ONCE. It will have the same effect and saves
# you system tons of processing and recording.
#
- platform: uptime
id: sensor_uptime
# Uptime Timestamp Sensor
#
# This sensor is an alternative for the uptime sensor, which only sends the
# startup timestamp of the device ONCE! Instead of sending updates to
# Home Assistant constantly.
#
# This saves you tons of updates to be processed and, if recorded/stored in the
# Home Assistant database, many many less rows.
#
# This sensor can be triggered manually and will only update the status once!
#
- platform: template
id: sensor_uptime_timestamp
name: "${friendly_name} Uptime"
device_class: "timestamp"
accuracy_decimals: 0
update_interval: never
lambda: |-
static float timestamp = (
id(time_homeassistant).utcnow().timestamp - id(sensor_uptime).state
);
return timestamp;
#HDC1080 temp & hum sensor
- platform: hdc1080
temperature:
id: sensor_temperature
name: "Temperature"
filters:
offset: -4.5
humidity:
id: sensor_humidity
name: "Humidity"
filters:
offset: 12
update_interval: 60s
#Waterflow sensor 1 temp
- platform: ntc
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 50kOhm
name: Flow1 Water Temperature
accuracy_decimals: 1
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: UPSTREAM
resistor: 50kOhm
internal: true
name: Flow1 Temperature resistance
- platform: adc
id: source_sensor
pin: GPIO36
update_interval: 5s
name: Flow1 Temperature voltage
attenuation: 11db
internal: true
#Waterflow sensor 2 temp koud water
- platform: ntc
sensor: resistance_sensor2
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 50kOhm
name: Flow2 Temperature
accuracy_decimals: 1
- platform: resistance
id: resistance_sensor2
sensor: source_sensor2
configuration: UPSTREAM
resistor: 50kOhm
internal: true
name: Flow2 Temperature resistance
- platform: adc
id: source_sensor2
pin: GPIO39
update_interval: 5s
name: Flow2 Temperature voltage
attenuation: 11db
internal: true
#Flow1 total
- platform: pulse_counter
pin:
number: GPIO26
mode:
input: true
pullup: true
unit_of_measurement: 'L/min'
id: water_usage
name: "Flow1 Current water usage"
icon: "mdi:water-pump"
update_interval: 5s
filters:
- multiply: 0.00172 # Updated multiplier based on calibration
total:
id: sensor_pulse_meter_total
name: "Flow1 Total Consumption"
icon: "mdi:cube-outline"
unit_of_measurement: "L"
state_class: total_increasing
device_class: water
accuracy_decimals: 3
filters:
- multiply: 0.00163
# on_value:
# then:
# - light.turn_on:
# id: light_led_blue
# flash_length: 1s
# - platform: integration
# name: "Sens1 Total Water Usage L"
# unit_of_measurement: 'L'
# sensor: water_usage
# time_unit: min
# - platform: integration
# name: "Sens1 Total Water Usage M3"
# unit_of_measurement: 'm³'
# sensor: water_usage
# time_unit: min
#Flow2 total
- platform: pulse_counter
pin:
number: GPIO14
mode:
input: true
pullup: true
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
unit_of_measurement: 'L/min'
id: sens2_water_usage
name: "Flow2 Current water usage"
icon: "mdi:water-pump"
update_interval: 5s
filters:
- multiply: 0.00172 # Updated multiplier based on calibration
total:
id: sens_2_sensor_pulse_meter_total
name: "Flow2 Total Consumption"
icon: "mdi:cube-outline"
unit_of_measurement: "L"
state_class: total_increasing
device_class: water
accuracy_decimals: 3
filters:
- multiply: 0.00163
# on_value:
# then:
# - light.turn_on:
# id: light_led_green
# flash_length: 1s
# - platform: integration
# name: "Sens2 Total Water Usage L"
# unit_of_measurement: 'L'
# sensor: sens2_water_usage
# time_unit: min
# - platform: integration
# name: "Sens2 Total Water Usage M3"
# unit_of_measurement: 'm³'
# sensor: sens2_water_usage
# time_unit: min
text_sensor:
# WiFi info #
- platform: wifi_info
ip_address:
name: "${friendly_name} IP address"
icon: "mdi:network-outline"
ssid:
name: "${friendly_name} Connected SSID"
bssid:
name: "${friendly_name} Connected BSSID"
- platform: version
id: text_sensor_version
name: "${friendly_name} ESPHome Version"
- platform: template
id: text_sensor_waterflowkit_version
name: "${friendly_name} Software Version"
update_interval: 5h
lambda: |-
return {"${waterflowkit_software_version}"};