Skip to content

Instantly share code, notes, and snippets.

@idserda
Last active April 28, 2024 10:07
Show Gist options
  • Save idserda/7b84d2022b6ed8b3582c4f21c49b80fb to your computer and use it in GitHub Desktop.
Save idserda/7b84d2022b6ed8b3582c4f21c49b80fb to your computer and use it in GitHub Desktop.
ESPHome config for ESP32 DHT11 + soil moisture sensor (like https://nl.aliexpress.com/item/1005003192739181.html)
esphome:
name: plantsensor
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: NONE
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "<ssid>"
password: "<password>"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Plantsensor Fallback Hotspot"
password: "<hotspot password>"
captive_portal:
web_server:
port: 80
mqtt:
broker: <mqtt broker host>
birth_message:
will_message:
sensor:
- platform: dht
pin: GPIO22
temperature:
name: "Air temperature"
humidity:
name: "Air humidity"
update_interval: 8s
- platform: adc
pin: GPIO32
name: "Soil Moisture"
update_interval: 60s
unit_of_measurement: "%"
attenuation: auto
filters:
- calibrate_linear:
- 1.46 -> 100.00
- 2.85 -> 0.00
- lambda: |
if (x < 0) return 0;
else if (x > 100) return 100;
else return (x);
accuracy_decimals: 0
deep_sleep:
run_duration: 5s
sleep_duration: 5min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment