-
Notifications
You must be signed in to change notification settings - Fork 6
/
higrow_dht.yaml
210 lines (186 loc) · 5.39 KB
/
higrow_dht.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
###################################################
# LilyGo HiGrow board code for ESPHome #
###################################################
# Slapped together by BeardedTinker April 2022 #
# YouTube: https://www.youtube.com/BeardedTinker #
# GitHub: https://github.com/BeardedTinker/ #
# Twitter: https://twitter.com/BeardedTinker #
# #
# This version is for DHT version of board witout #
# additional DS18B50 sensor #
###################################################
#
# This is used to set sensor name (device name) and friendly name for each sensor board
# Using _ in device name will result in warning!
# setup_priority needs to be specified for some components to work
substitutions:
devicename: "schefflera_arboricola"
upper_devicename: Schefflera Arboricola
awake_duration: 6s # set how long to stay awake - NOT less then 10sec
sleep_duration: 90min # set how long to sleep in minutes
update_interval: 5s
fixed_ip: 192.168.2.50
gateway_ip: 192.168.1.1
subnet_mask: 255.255.252.0
#############################################
##### Nothing to change after this line #####
##### Except for calibration data if #####
##### want to do it! #####
#############################################
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_key
manual_ip:
static_ip: ${fixed_ip}
gateway: ${gateway_ip}
subnet: ${subnet_mask}
# fast_connect: enable
esphome:
name: "${devicename}"
platform: ESP32
board: esp32dev
on_boot:
then:
- script.execute: consider_deep_sleep
ota:
on_end:
then:
- logger.log: 'OTA successful - flipping switch'
- homeassistant.service:
service: input_boolean.turn_off
data:
entity_id: input_boolean.${devicename}_prevent_deep_sleep
api:
#mqtt:
# broker: mqtt_ip
# username: mqtt_user
# password: mqtt_password
logger:
i2c:
- id: bus_a
sda: 25
scl: 26
scan: true
setup_priority: -200
# Power switch
switch:
- platform: gpio
pin: GPIO4
name: "${upper_devicename} Power Sensors"
id: spower
restore_mode: ALWAYS_ON
internal: true
setup_priority: 1000
### Sensors section
binary_sensor:
- platform: homeassistant
id: ${devicename}_prevent_deep_sleep
name: 'Prevent sensor Deep Sleep'
entity_id: input_boolean.${devicename}_prevent_deep_sleep
sensor:
# Temperature and humidity
- platform: dht
pin: 16
model: dht11
temperature:
name: "${upper_devicename} Temperature"
unit_of_measurement: "°C"
icon: "mdi:thermometer"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
humidity:
name: "${upper_devicename} Humidity"
unit_of_measurement: "%"
icon: "mdi:thermometer"
device_class: "humidity"
state_class: "measurement"
update_interval: ${update_interval}
setup_priority: -100
## Soil humidity raw data - needed just for calibration
# - platform: adc
# pin: 32
# name: "${upper_devicename} Soil Moisture raw"
# attenuation: 11db
# unit_of_measurement: 'V'
# Soil humidity %
- platform: adc
pin: 32
name: "${upper_devicename} Soil Moisture"
attenuation: 11db
unit_of_measurement: '%'
filters:
# 1.410v = in water
# 2.834v = dry
lambda: |-
return (2.834 - x) * 100.0 / (2.834 - 1.410);
update_interval: ${update_interval}
# Lux sensor
- platform: bh1750
i2c_id: bus_a
name: "${upper_devicename} Lux"
address: 0x23
unit_of_measurement: "lx"
icon: "mdi:white-balance-sunny"
device_class: "illuminance"
state_class: "measurement"
setup_priority: -300
update_interval: ${update_interval}
# Fertilizer sensor
- platform: adc
pin: GPIO34
name: "${upper_devicename} Salt"
unit_of_measurement: '%'
accuracy_decimals: 4
filters:
# Map 0.0 (from sensor) to 0.0 (true value)
- calibrate_linear:
- 0.0 -> 0.0
- 1.1 -> 100.0
update_interval: ${update_interval}
# Battery V
- platform: adc
pin: 33
name: "${upper_devicename} Battery"
attenuation: 11db
unit_of_measurement: "V"
icon: "mdi:battery-high"
device_class: "voltage"
state_class: "measurement"
accuracy_decimals: 3
# filters:
# # Map 0.0 (from sensor) to 0.0 (true value)
# - calibrate_linear:
# - 0.0 -> 0.0
# - 2.06 -> 1.89
# - lambda: return x * 2.0;
id: ${devicename}_voltage
update_interval: ${update_interval}
# Battery %
- platform: adc
pin: 33
name: "${upper_devicename} Battery %"
unit_of_measurement: '%'
filters:
- lambda: |-
return ((id(${devicename}_voltage).state - 2.76) / 0.379 * 100.00);
# (current - minimum) / difference between max & mix * 100
update_interval: ${update_interval}
# Deep sleep section
deep_sleep:
id: deep_sleep_control
sleep_duration: ${sleep_duration}
# Script section
script:
- id: consider_deep_sleep
mode: queued
then:
- delay: ${awake_duration}
- if:
condition:
binary_sensor.is_on: ${devicename}_prevent_deep_sleep
then:
- logger.log: 'Skipping sleep, per prevent_deep_sleep'
else:
- deep_sleep.enter: deep_sleep_control
- script.execute: consider_deep_sleep