-
Notifications
You must be signed in to change notification settings - Fork 20
/
pool.yaml
152 lines (127 loc) · 3.79 KB
/
pool.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
---
substitutions:
friendly_name: Pool Sensors
id: pool
hostname: pool
ip:
air_temp_gpio: GPIO19
#led_status_gpio: GPIO02
pool_level_for_duration: 1sec #2min
pool_level_full_gpio: GPIO23 # Yellow Wire/OK Float
pool_level_low_gpio: GPIO22 # Red Wire/Low Float
pool_temp_gpio: GPIO21 # Yellow Wire/Data Wire
<<: !include common/esphome/esp32_nodemcu.yaml
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Using these as a precaution to ensure solid WiFi connectivity.
power_save_mode: none
manual_ip:
static_ip: 10.0.20.19
gateway: 10.0.20.1
subnet: 255.255.255.0
<<: !include common/ota.yaml
<<: !include common/logger.yaml
<<: !include common/api.yaml
# output:
# <<: !include common/outputs/status_led_esp32.yaml
# light:
# <<: !include common/lights/status_led.yaml
binary_sensor:
- !include common/binary_sensors/status.yaml
# ============================================================================= #
# Pool level physical float switches. State changes update sensor.pool_level
# (states: LOW, OK, FULL).
#
# FULL = Top Float Switch Up
- platform: gpio
id: pool_level_full
pin:
#inverted: True
mode: INPUT_PULLUP
number: $pool_level_full_gpio
# Pool switches must remain in the same state for several minutes before the state is updated.
# This avoids waves constantly flooding Home Assistant with state changes.
filters:
- delayed_on: $pool_level_for_duration
- delayed_off: $pool_level_for_duration
# Set the pool_level sensor to "FULL" when this is ON.
on_press:
then:
- text_sensor.template.publish:
id: pool_level
state: FULL
# Set the pool_level sensor to "OK" when this is OFF.
on_release:
then:
- if:
condition:
binary_sensor.is_off: pool_level_low
then:
- text_sensor.template.publish:
id: pool_level
state: OK
# LOW = Bottom Float Switch Down
- platform: gpio
id: pool_level_low
pin:
inverted: True
mode: INPUT_PULLUP
number: $pool_level_low_gpio
# Pool switches must remain in the same state for several minutes before the state is updated.
# This avoids waves constantly flooding Home Assistant with state changes.
filters:
- delayed_on: $pool_level_for_duration
- delayed_off: $pool_level_for_duration
# Set the pool_level sensor to "LOW" when this is ON.
on_press:
then:
- text_sensor.template.publish:
id: pool_level
state: LOW
# Set the pool_level sensor to "OK" when this is OFF.
on_release:
then:
- if:
condition:
binary_sensor.is_off: pool_level_full
then:
- text_sensor.template.publish:
id: pool_level
state: OK
dallas:
- pin: $pool_temp_gpio
sensor:
- !include common/sensors/uptime.yaml
- !include common/sensors/wifi_signal.yaml
- platform: dht
pin: $air_temp_gpio
model: AM2302
temperature:
name: Pool air temperature
device_class: temperature
state_class: measurement
unit_of_measurement: "°C"
accuracy_decimals: 1
humidity:
name: Pool air humidity
device_class: humidity
state_class: measurement
unit_of_measurement: "%"
accuracy_decimals: 0
- platform: dallas
address: 0x720119380145BF28
id: pool_temp
name: Pool temperature
icon: mdi:pool-thermometer
device_class: temperature
state_class: measurement
unit_of_measurement: "°C"
accuracy_decimals: 1
switch:
- !include common/switches/restart.yaml
text_sensor:
# Pool level states: LOW, OK, FULL
- platform: template
id: pool_level
name: Pool level