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

add support for ESP32-C3 Super Mini, soil moisture sensors and automated watering (mother box)

parent b547cbe1
Branches
No related tags found
No related merge requests found
Pipeline #1273 failed
substitutions:
devicename: "mombox"
comment: "Mother Box Controller"
# Propbox Nodes
hostname_light: "${devicename}-light.${domain}"
hostname_fan: "${devicename}-fan.${domain}"
# Overrides
fan_script: "fan_control_power"
packages:
base: !include packages/base.yaml
esp32c3: !include packages/esp32c3.yaml
time: !include packages/time_schedule.yaml
air_bme280: !include packages/air_bme280.yaml
soil_moisture: !include packages/soil_moisture.yaml
water_pump: !include packages/water_pump.yaml
watering: !include packages/watering.yaml
yyac32: !include packages/yyac3s.yaml
fan_settings: !include packages/fan_settings.yaml
fan_power: !include packages/fan_power.yaml
fan_scripts: !include packages/fan_scripts.yaml
light_power: !include packages/light_power.yaml
light_settings: !include packages/light_settings.yaml
......@@ -9,3 +9,6 @@ i2c:
wifi:
power_save_mode: none
substitutions:
yyac3s_pin: GPIO13
\ No newline at end of file
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: arduino
esphome:
platformio_options:
board_build.flash_mode: dio
i2c:
sda: GPIO3
scl: GPIO4
wifi:
power_save_mode: none
substitutions:
yyac3s_pin: GPIO5
\ No newline at end of file
......@@ -8,6 +8,7 @@ pump1_ml_sec: "2.15" # millilitre per second
pump1_dose_ml: "1" # millilitre per dose
pump2_ml_sec: "2.15" # millilitre per second
pump2_dose_ml: "1" # millilitre per dose
water_pump_sec: "3"
mqtt_username: ""
mqtt_password: ""
mqtt_host: ""
sensor:
- platform: adc
id: soil_moisture
name: "Soil Moisture"
pin: GPIO0
update_interval: 5s
unit_of_measurement: "%"
attenuation: 12db
filters:
- median:
window_size: 7
send_every: 3
send_first_at: 1
- calibrate_linear:
- 1.03 -> 100.00
- 2.22 -> 0.00
- lambda: |
if (x < 0) return 0;
else if (x > 100) return 100;
else return (x);
accuracy_decimals: 0
globals:
- id: water_pump_sec
type: float
initial_value: !secret water_pump_sec
switch:
- platform: gpio
id: water_pump
name: "Water Pump"
pin: GPIO7
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
- then:
- delay: !lambda return id(water_pump_sec) * 1000;
- switch.turn_off: water_pump
switch:
- platform: template
id: watering_enabled
name: "Watering"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
select:
- platform: template
id: watering_min
name: "Watering: Min. Value"
options: ["10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75"]
initial_option: "50"
optimistic: true
restore_value: true
interval:
- interval: 15min
then:
- script.execute: watering
script:
- id: watering
then:
- lambda: |-
if (id(watering_enabled).state)
{
if (id(soil_moisture).state < atof(id(watering_min).state.c_str()))
{
ESP_LOGI("watering", "Soil moisture too low (%.2f < %.2f)", id(soil_moisture).state, atof(id(watering_min).state.c_str()));
id(water_pump).turn_on();
}
else
{
ESP_LOGI("watering", "Soil moisture high enough (%.2f >= %.2f)", id(soil_moisture).state, atof(id(watering_min).state.c_str()));
}
}
output:
- platform: ledc
pin: GPIO13
pin: ${yyac3s_pin}
id: fan_dimmer
frequency: 223Hz
min_power: 0.36
max_power: 0.78
max_power: 0.75
zero_means_zero: true
fan:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment