Skip to content
Snippets Groups Projects
Commit 9b2d49b1 authored by Jan Grewe's avatar Jan Grewe
Browse files

replace BLE with BME280

add temperature/humidity hysteresis
add Dallas DS18B20 for water temperature
parent 84ea61af
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,6 @@ substitutions:
hostname_light: "propbox-light.${domain}"
hostname_fan: "propbox-fan.${domain}"
# Sensors
ble_sensor_mac: "A4:C1:38:47:14:50" # 'PropBoxBLE'
# Schedules
#schedule_grow_on: "0 0 3 * * *"
#schedule_grow_off: "0 0 21 * * *"
......@@ -24,15 +21,23 @@ substitutions:
temperature_max: "27"
temperature_min: "21"
temperature_hysteresis: "2"
humidity_max: "70"
humidity_min: "40"
humidity_hysteresis: "5"
<<: !include common.yaml
esp32:
board: esp32dev
esp32_ble_tracker:
i2c:
sda: 21
scl: 22
dallas:
- pin: GPIO23
update_interval: 5s
http_request:
id: http_request_data
......@@ -52,26 +57,33 @@ sensor:
### Specific Sensors
- platform: pvvx_mithermometer
mac_address: ${ble_sensor_mac}
battery_level:
id: ble_battery_level
name: "BLE Battery Level"
battery_voltage:
id: ble_battery_voltage
name: "BLE Battery Voltage"
- platform: bme280
address: 0x76
update_interval: 5s
temperature:
id: ble_temperature
id: temperature
name: "Temperature"
accuracy_decimals: 2
on_value:
then:
- script.execute: fan_control
humidity:
id: ble_humidity
id: humidity
name: "Humidity"
accuracy_decimals: 2
on_value:
then:
- script.execute: fan_control
pressure:
id: pressure
accuracy_decimals: 2
name: "Pressure"
- platform: dallas
index: 0
id: temperature_water
name: "Water Temperature"
accuracy_decimals: 2
text_sensor:
!include include/text_sensors.yaml
......@@ -99,6 +111,8 @@ select:
id(schedule) = index.value();
switch:
- platform: restart
name: "Restart"
- platform: template
id: propbox_light
name: "Light Status"
......@@ -170,17 +184,18 @@ script:
// 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(temperature).state >= ${temperature_max} && id(humidity).state >= ${humidity_min}) ||
(id(humidity).state >= ${humidity_max} && id(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
// switch fan off when temperature and humidity are below the limits minus hysteresis
else if (
id(propbox_fan).state &&
id(ble_temperature).state <= ${temperature_max} && id(ble_humidity).state <= ${humidity_max}
id(temperature).state <= ${temperature_max} - ${temperature_hysteresis} &&
id(humidity).state <= ${humidity_max} - ${humidity_hysteresis}
) {
id(propbox_fan).turn_off();
id(propbox_fan).publish_state(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment