Skip to content

Instantly share code, notes, and snippets.

@wolph
Last active February 23, 2024 00:46
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save wolph/bc284ba9aeb5d1263f72d6294e239c1a to your computer and use it in GitHub Desktop.
Save wolph/bc284ba9aeb5d1263f72d6294e239c1a to your computer and use it in GitHub Desktop.
esphome:
name: plant_moisture
platform: ESP32
board: esp32dev
wifi:
ssid: "spam"
password: "eggs"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "password"
ota:
password: "password"
sensor:
- platform: dht
pin: 22
model: DHt11
temperature:
name: "plant_0_temperature"
humidity:
name: "plant_0_humidity"
- platform: adc
pin: 32
name: "plant_0_soil_moisture"
attenuation: 11db
unit_of_measurement: '%'
filters:
# 1.1v = in water
# 2.94v = dry
lambda: |-
return (2.95 - x) * 100.0 / (2.95 - 1.1);
# TTGO Higrow version with battery and deep sleep enabled. Battery life not tested yet
esphome:
name: higrow_00
platform: ESP32
board: lolin_d32
on_shutdown:
then:
- switch.turn_off: spower
switch:
- platform: gpio
pin: GPIO4
name: "Sensor Power"
id: spower
restore_mode: ALWAYS_ON
internal: true
setup_priority: 1000
binary_sensor:
- platform: gpio
pin:
number: GPIO35
mode: INPUT_PULLUP
inverted: True
name: "Wake Button"
i2c:
sda: 25
scl: 26
scan: True
id: bus_a
setup_priority: -200
deep_sleep:
run_duration: 10s
sleep_duration: 15min
sensor:
- platform: dht
model: dht11
pin:
number: 16
mode: input
temperature:
name: "HiGrow1 Temperature"
humidity:
name: "HiGrow1 Humidity"
update_interval: 15min
setup_priority: -100
- platform: adc
pin: GPIO32
name: "HiGrow1 Soil"
update_interval: 15min
attenuation: 11db
unit_of_measurement: '%'
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 3.08 -> 0.0
- 1.42 -> 100.0
- platform: adc
pin: 33
name: "HiGrow1 Battery"
attenuation: 6db
unit_of_measurement: 'V'
update_interval: 15min
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.0 -> 0.0
- 2.06 -> 1.89
- lambda: return x * 2.0;
- platform: adc
pin: GPIO34
name: "HiGrow1 Salt"
update_interval: 15min
unit_of_measurement: '%'
accuracy_decimals: 4
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.0 -> 0.0
- 1.1 -> 100.0
- platform: bh1750
i2c_id: bus_a
name: "BH1750 Illuminance"
address: 0x23
update_interval: 15min
setup_priority: -300
@wolph
Copy link
Author

wolph commented Dec 13, 2022

That looks very nice @bruvv!

@beginnersguide
Copy link

Wow, thanks a lot. Which GPIO (PIN) can I use for a relay to control a waterpump? And do you have a pinout. I don't know which pin is which GPIO.

@wolph
Copy link
Author

wolph commented Mar 30, 2023

Wow, thanks a lot. Which GPIO (PIN) can I use for a relay to control a waterpump? And do you have a pinout. I don't know which pin is which GPIO.

Maybe you have a different version but mine includes the pin numbers right next to the pins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment