-
Notifications
You must be signed in to change notification settings - Fork 0
/
skylightgreenhouse.yaml
166 lines (150 loc) · 3.78 KB
/
skylightgreenhouse.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
# $Id: skylightgreenhouse.yaml,v 1.1 2022/06/22 03:26:57 jason Exp jason $
#
substitutions:
dry: "3.05"
wet: "1.95"
my_update_interval: 60s
my_nickname: SG
# for use with deep sleep
# my_update_interval: 25s
# awake_time: 1min
# snooze_time: 29min
esphome:
name: skylightgreenhouse
platform: ESP32
board: esp32dev
packages:
wifi: !include common/wifi.yaml
captive_portal:
#deep_sleep:
## run_duration: 1min
## sleep_duration: 9min
# run_duration: ${awake_time}
# sleep_duration: ${snooze_time}
# wakeup_pin: GPIO25
# wakeup_pin_mode: KEEP_AWAKE
binary_sensor:
- platform: gpio
pin:
number: GPIO25
mode: INPUT_PULLUP
inverted: true
name: "SG water low"
device_class: problem
- platform: status
name: "SG connectivity"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret skylightgreenhouse_api_password
ota:
password: !secret skylightgreenhouse_ota_password
time:
- platform: homeassistant
id: homeassistant_time
# enable i2c for temperature sensor - 2022-06-21
i2c:
id: bus_a
sda: 21
scl: 22
scan: true
# Enable Web server.
web_server:
port: 80
# Exposed switches.
switch:
- platform: restart
name: "SG restart"
sensor:
- platform: uptime
name: "${my_nickname} uptime"
# plant1 : farthest, green signal wire
# air: 3.14 / water: 1.76 / wet soil: 1.82 / 100% wet on standalone: 2.04
- platform: adc
pin: GPIO34
name: "plant1"
unit_of_measurement: "%"
attenuation: 11db
update_interval: ${my_update_interval}
icon: "mdi:water-percent"
device_class: "humidity"
filters:
- lambda: |-
if (x > ${dry}) {
return 0;
} else if (x < ${wet}) {
return 100;
} else {
return (${dry} - x) / (${dry} - ${wet}) * 100.0;
}
#
# plant2 : second from end : white->yellow/black signal wire
# air: 3.22V / water: 1.74V / wet soil: 1.93 / 100% wet on standalone: 2.01
- platform: adc
pin: GPIO35
name: "plant2"
unit_of_measurement: "%"
attenuation: 11db
update_interval: ${my_update_interval}
icon: "mdi:water-percent"
device_class: "humidity"
filters:
- lambda: |-
if (x > ${dry}) {
return 0;
} else if (x < ${wet}) {
return 100;
} else {
return (${dry} - x) / (${dry} - ${wet}) * 100.0;
}
#
# plant3 : third from end : white->green/black signal wire
# air: 3.28V / water: 1.73V / wet soil: 2.05 / 100% wet on standalone: 1.94
- platform: adc
pin: GPIO32
name: "plant3"
unit_of_measurement: "%"
attenuation: 11db
update_interval: ${my_update_interval}
icon: "mdi:water-percent"
device_class: "humidity"
filters:
- lambda: |-
if (x > ${dry}) {
return 0;
} else if (x < ${wet}) {
return 100;
} else {
return (${dry} - x) / (${dry} - ${wet}) * 100.0;
}
#
# plant4 : single: yellow signal wire
# air: 3.28 / water: 1.70 / wet soil: 1.90V / 100% wet on standalone: 1.85
- platform: adc
pin: GPIO33
name: "plant4"
unit_of_measurement: "%"
attenuation: 11db
update_interval: ${my_update_interval}
icon: "mdi:water-percent"
device_class: "humidity"
filters:
- lambda: |-
if (x > ${dry}) {
return 0;
} else if (x < ${wet}) {
return 100;
} else {
return (${dry} - x) / (${dry} - ${wet}) * 100.0;
}
# added 2022-06-21
- platform: tmp102
name: "${my_nickname} temperature"
update_interval: ${my_update_interval}
unit_of_measurement: "°F"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
filters:
- lambda: return x* (9.0/5.0) + 32.0;