-
Notifications
You must be signed in to change notification settings - Fork 0
/
brunnen.yaml
176 lines (154 loc) · 3.6 KB
/
brunnen.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
esphome:
name: esp32-brunnen
friendly_name: esp32-brunnen
platformio_options:
upload_speed: 921600
esp32:
board: nodemcu-32s
framework:
type: arduino
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
ap: {}
captive_portal:
logger:
level: DEBUG
api:
password: ""
time:
- platform: homeassistant
id: esptime
deep_sleep:
id: deep_sleep_control
run_duration: 60s
sleep_duration: 3600s # once an hour
one_wire:
- platform: gpio
pin: 5
# Enable more information logged into homeassistant
debug:
update_interval: 5s
#
text_sensor:
- platform: debug
device:
name: "Device Info"
reset_reason:
name: "Reset Reason"
sensor:
- platform: dallas_temp
name: "Temperatur Wasser"
device_class: temperature
address: "0x8f00000e7dbdd128"
- platform: dallas_temp
name: "Temperatur Gehäuse"
device_class: temperature
address: "0x5d4a131c35646128"
- platform: adc
pin: GPIO39
id: "battery_voltage"
name: "Batterie Voltage"
attenuation: auto
update_interval: 30s
filters:
- multiply: 1.3
on_value:
then:
component.update: battery_percentage
- platform: template
name: "Battery"
id: battery_percentage
unit_of_measurement: '%'
accuracy_decimals: 0
update_interval: never
device_class: battery
lambda: |-
return id(battery_voltage).state;
filters:
- calibrate_linear:
- 4.00 -> 1.0
- 2.26 -> 0.0
- clamp:
min_value: 0.0
max_value: 1.0
- multiply: 100
- round: 0
- platform: adc
pin: GPIO34
name: "Solar Voltage"
id: "solar_voltage"
attenuation: auto
update_interval: 30s
filters:
- multiply: 4.2 # depends on the used solar panel and resistors
- platform: adc
pin: GPIO35
name: "Wasserstand Voltage"
id: levelraw
attenuation: auto
update_interval: 3s
on_value:
then:
component.update: waterlevel
filters:
- clamp: # remove nonesense readings
min_value: 0.2
ignore_out_of_range: true
- sliding_window_moving_average:
window_size: 5
send_every: 5
- platform: template
name: "Wasserstand"
id: waterlevel
update_interval: never
accuracy_decimals: 0
unit_of_measurement: cm
icon: "mdi:car-coolant-level"
lambda: |-
return id(levelraw).state;
filters:
- filter_out: NAN
- calibrate_linear:
- 0.24 -> 0.0
# - 0.33 -> 0.12
# - 0.35 -> 0.23
# - 0.60 -> 1.2
# - 0.65 -> 2.2 # ??
# - 0.91 -> 3.2
- 1.32 -> 4.2
- multiply: 100
binary_sensor:
- platform: homeassistant
id: enable_deep_sleep
name: Enable Deep Sleep
entity_id: input_boolean.enable_esphome_deepsleep
publish_initial_state: true
on_state:
then:
- script.execute: consider_deep_sleep
- platform: template
id: charging
name: Charging
lambda: return id(solar_voltage).state > 4.2;
switch:
- platform: gpio
id: sensor_switch
pin: GPIO33
restore_mode: ALWAYS_ON # Enable pressure sensor
script:
- id: consider_deep_sleep
mode: queued
then:
- if:
condition:
binary_sensor.is_off: enable_deep_sleep
then:
- logger.log: 'Skipping sleep, per enable_deep_sleep'
- deep_sleep.prevent: deep_sleep_control
else:
- logger.log: 'Enable sleep, per enable_deep_sleep'
- deep_sleep.allow: deep_sleep_control