Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GrowSmart - ESPHome
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Grewe
GrowSmart - ESPHome
Commits
a8362afb
Commit
a8362afb
authored
May 26, 2022
by
Jan Grewe
Browse files
Options
Downloads
Patches
Plain Diff
fan control
parent
0c2b556f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
propbox.yaml
+76
-86
76 additions, 86 deletions
propbox.yaml
with
76 additions
and
86 deletions
propbox.yaml
+
76
−
86
View file @
a8362afb
...
@@ -10,7 +10,7 @@ substitutions:
...
@@ -10,7 +10,7 @@ substitutions:
hostname_fan
:
"
propbox-fan.${domain}"
hostname_fan
:
"
propbox-fan.${domain}"
# Sensors
# Sensors
ble_sensor_mac
:
"
A4:C1:38:47:14:50"
ble_sensor_mac
:
"
A4:C1:38:47:14:50"
# 'PropBoxBLE'
# Schedules
# Schedules
#schedule_grow_on: "0 0 3 * * *"
#schedule_grow_on: "0 0 3 * * *"
...
@@ -22,10 +22,10 @@ substitutions:
...
@@ -22,10 +22,10 @@ substitutions:
schedule_bloom_on
:
"
0
*
*
*
*
*"
schedule_bloom_on
:
"
0
*
*
*
*
*"
schedule_bloom_off
:
"
30
*
*
*
*
*"
schedule_bloom_off
:
"
30
*
*
*
*
*"
temperature_
fan_on
:
"
27
.0
"
temperature_
max
:
"
27"
temperature_
fan_off
:
"
2
1.0
"
temperature_
min
:
"
2
3
"
humidity_
fan_on
:
"
60"
humidity_
max
:
"
60"
humidity_
fan_off
:
"
4
0"
humidity_
min
:
"
5
0"
<<
:
!include
common.yaml
<<
:
!include
common.yaml
...
@@ -34,6 +34,11 @@ esp32:
...
@@ -34,6 +34,11 @@ esp32:
esp32_ble_tracker
:
esp32_ble_tracker
:
http_request
:
id
:
http_request_data
useragent
:
esphome/${devicename}
timeout
:
10s
sensor
:
sensor
:
### Default Sensors
### Default Sensors
...
@@ -58,55 +63,15 @@ sensor:
...
@@ -58,55 +63,15 @@ sensor:
temperature
:
temperature
:
id
:
ble_temperature
id
:
ble_temperature
name
:
"
Temperature"
name
:
"
Temperature"
on_value_range
:
on_value
:
-
above
:
${temperature_fan_on}
then
:
-
switch.turn_on
:
propbox_fan
# then:
# - if:
# condition:
# and:
# - lambda: return (x > ${humidity_fan_off});
# - switch.is_off: propbox_fan
# then:
# - switch.turn_on: propbox_fan
-
below
:
${temperature_fan_off}
then
:
then
:
-
switch.turn_off
:
propbox_fan
-
script.execute
:
fan_control
# then:
# - if:
# condition:
# and:
# - lambda: return (x < ${humidity_fan_on});
# - switch.is_on: propbox_fan
# then:
# - switch.turn_off: propbox_fan
humidity
:
humidity
:
id
:
ble_humidity
id
:
ble_humidity
name
:
"
Humidity"
name
:
"
Humidity"
on_value_range
:
on_value
:
-
above
:
${humidity_fan_on}
then
:
-
switch.turn_on
:
propbox_fan
# then:
# - if:
# condition:
# and:
# - lambda: return (x > ${temperature_fan_off});
# - switch.is_off: propbox_fan
# then:
# - switch.turn_on: propbox_fan
-
below
:
${humidity_fan_off}
then
:
then
:
-
switch.turn_off
:
propbox_fan
-
script.execute
:
fan_control
# then:
# - if:
# condition:
# and:
# - lambda: return (x < ${temperature_fan_on});
# - switch.is_on: propbox_fan
# then:
# - switch.turn_off: propbox_fan
text_sensor
:
text_sensor
:
!include
include/text_sensors.yaml
!include
include/text_sensors.yaml
...
@@ -133,45 +98,11 @@ select:
...
@@ -133,45 +98,11 @@ select:
auto index = id(select_schedule).active_index();
auto index = id(select_schedule).active_index();
id(schedule) = index.value();
id(schedule) = index.value();
http_request
:
id
:
http_request_data
useragent
:
esphome/${devicename}
timeout
:
10s
interval
:
-
id
:
propbox_light_state
interval
:
1min
then
:
-
lambda
:
|-
HTTPClient http;
bool state = false;
http.begin("http://${hostname_light}/switch/power");
if (http.GET() == 200) {
DynamicJsonDocument doc(200);
deserializeJson(doc, http.getString());
state = (doc["state"] == "ON") ? true : false;
}
id(propbox_light).publish_state(state);
http.end();
-
id
:
propbox_fan_state
interval
:
1min
then
:
-
lambda
:
|-
HTTPClient http;
bool state = false;
http.begin("http://${hostname_fan}/switch/power");
if (http.GET() == 200) {
DynamicJsonDocument doc(200);
deserializeJson(doc, http.getString());
state = (doc["state"] == "ON") ? true : false;
}
id(propbox_fan).publish_state(state);
http.end();
switch
:
switch
:
-
platform
:
template
-
platform
:
template
id
:
propbox_light
id
:
propbox_light
name
:
"
Light
Status"
name
:
"
Light
Status"
optimistic
:
true
turn_on_action
:
turn_on_action
:
-
http_request.post
:
-
http_request.post
:
url
:
http://${hostname_light}/switch/power/turn_on
url
:
http://${hostname_light}/switch/power/turn_on
...
@@ -181,6 +112,7 @@ switch:
...
@@ -181,6 +112,7 @@ switch:
-
platform
:
template
-
platform
:
template
id
:
propbox_fan
id
:
propbox_fan
name
:
"
Fan
Status"
name
:
"
Fan
Status"
optimistic
:
true
turn_on_action
:
turn_on_action
:
-
http_request.post
:
-
http_request.post
:
url
:
http://${hostname_fan}/switch/power/turn_on
url
:
http://${hostname_fan}/switch/power/turn_on
...
@@ -188,6 +120,14 @@ switch:
...
@@ -188,6 +120,14 @@ switch:
-
http_request.post
:
-
http_request.post
:
url
:
http://${hostname_fan}/switch/power/turn_off
url
:
http://${hostname_fan}/switch/power/turn_off
interval
:
-
interval
:
1min
then
:
-
script.execute
:
propbox_light_state
-
interval
:
1min
then
:
-
script.execute
:
propbox_fan_state
time
:
time
:
-
platform
:
sntp
-
platform
:
sntp
id
:
sntp_time
id
:
sntp_time
...
@@ -222,3 +162,53 @@ time:
...
@@ -222,3 +162,53 @@ time:
id(propbox_light).turn_off();
id(propbox_light).turn_off();
id(propbox_light).publish_state(false);
id(propbox_light).publish_state(false);
}
}
script
:
-
id
:
fan_control
then
:
-
lambda
:
|-
// switch fan on when temperature/humidity is above the limit, unless humidity/temperature is below the limit
if (
!id(propbox_fan).state &&
(id(ble_temperature).state >= ${temperature_max} && id(ble_humidity).state >= ${humidity_min}) ||
(id(ble_humidity).state >= ${humidity_max} && id(ble_temperature).state >= ${temperature_min})
) {
id(propbox_fan).turn_on();
id(propbox_fan).publish_state(true);
}
// switch fan off when temperature and humidity are below the limits
else if (
id(propbox_fan).state &&
id(ble_temperature).state <= ${temperature_max} && id(ble_humidity).state <= ${humidity_max}
) {
id(propbox_fan).turn_off();
id(propbox_fan).publish_state(false);
}
-
id
:
propbox_light_state
then
:
-
lambda
:
|-
HTTPClient http;
bool state = false;
http.begin("http://${hostname_light}/switch/power");
if (http.GET() == 200) {
DynamicJsonDocument doc(200);
deserializeJson(doc, http.getString());
state = (doc["state"] == "ON") ? true : false;
}
id(propbox_light).publish_state(state);
http.end();
-
id
:
propbox_fan_state
then
:
-
lambda
:
|-
HTTPClient http;
bool state = false;
http.begin("http://${hostname_fan}/switch/power");
if (http.GET() == 200) {
DynamicJsonDocument doc(200);
deserializeJson(doc, http.getString());
state = (doc["state"] == "ON") ? true : false;
}
id(propbox_fan).publish_state(state);
http.end();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment