Hi,
I’m not a programmer. I’ve tried to make something but I’m stuck and I hope someone can help me.
So the thing I’m trying to do, is creating a watering system for my plants. Just for the fun of it. Now it’s measuring the water level, but not in a way that I like, and it should drive a pump. I tried to run the config with the pump attached and it absolutely drowned the soil. There is a dead plant in it so it’s really not that interesting, but there was a centimetre of water on top of the soil.
esphome:
name: watering1
esp8266:
board: d1_mini_lite
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "6c553a603767d4ce0df50a883089a58b"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Watering1 Fallback Hotspot"
password: "zH0dUNKVGQa5"
captive_portal:
sensor:
- platform: adc
pin: A0
id: source_sensor
# Added:
update_interval: never
raw: true
internal: false
filters:
- calibrate_linear:
- 500 -> 100
- 1024 -> 0
switch:
- platform: gpio
pin: D0
id: sensorEnable
restore_mode: always_off
internal: false
- platform: gpio
pin: D1
id: pumpEnable
restore_mode: always_off
icon: "mdi:water-pump"
internal: false
interval:
- interval: 5min
then:
- switch.turn_on: sensorEnable
- delay: 1s
- component.update: source_sensor
- switch.turn_off: sensorEnable
- if:
condition:
lambda: 'return id(source_sensor).state < 5;'
then:
- switch.turn_on: pumpEnable
- delay: 2s
- switch.turn_off: pumpEnable
This code spits out the following:
[D][switch:013]: 'sensorEnable' Turning ON.
[D][switch:037]: 'sensorEnable': Sending state ON
[D][sensor:124]: 'source_sensor': Sending state 38.74046 V with 2 decimals of accuracy
[D][switch:017]: 'sensorEnable' Turning OFF.
[D][switch:037]: 'sensorEnable': Sending state OFF
So that part is sort of working.
Now what do I change to get the 38.7 as a normal value, so not as a voltage and see it in HA on my dashboard? And how do I adjust it so that the pump only turns on below 5, because that doesn’t seem to be working either.
I don’t really need HA to take care of the watering, it would be nice if it stays working when out of range (the goal is to use it in my backyard).
Please keep in mind I’m a complete noob.