Skip to content

Navigation Menu

Sign in
Sign up

Soil moisture level in irrigation controller #5

Answered by brianhanifin
Klarstein asked this question in Q&A
Discussion options

First of all: awesome project! I would like to know if you're interested in helping me with integrating a soil moisture sensor into the equation. It's a Vegetronix which simply outputs a value from 0-3.3v, depending on the moisture-level of the soil.

I'm perfectly comfortable with getting the output of the sensor available for ESPHome(by the ADC converter) and filter the results while adding some hysteresis with a template sensor. Either by using the Sonoff ADC pin, or pickup the value from a separate ESP through MQTT or Home Assistant. What I don't know is how to make that value prevent a scheduled irrigation to run.

Simply put: if the ADC voltage is equal or higher than a certain level between 0-3.3v -> don't run.

I think the most logical insertion point is in the automation:
- lambda: |- if (scheduled_runtime(id(irrigation_zone1_next).state.c_str())) { id(irrigation_zone1).turn_on(); } if (scheduled_runtime(id(irrigation_zone2_next).state.c_str())) { id(irrigation_zone2).turn_on(); } -
But how would you include the for example "soil_moisture state =>' 2" statement into that lambda code?

You must be logged in to vote

Very cool addition! It sounds like you are on the right track. You need add an "and" to your if statement. It would be something like:

if (scheduled_runtime(id(irrigation_zone1_next).state.c_str()) and irrigation_zone1_soil_moisture.state < 2) {
 id(irrigation_zone1).turn_on();
}

P.S. Sorry for the late answer. I hope you figured out the solution already.

Replies: 1 comment 2 replies

Comment options

Very cool addition! It sounds like you are on the right track. You need add an "and" to your if statement. It would be something like:

if (scheduled_runtime(id(irrigation_zone1_next).state.c_str()) and irrigation_zone1_soil_moisture.state < 2) {
 id(irrigation_zone1).turn_on();
}

P.S. Sorry for the late answer. I hope you figured out the solution already.

You must be logged in to vote
2 replies
Comment options

No need for excuses! Your solution works perfectly, thank you!

I found one flaw in the (otherwise rock solid) performance of the controller. If -by whatever event- the power shuts down during an scheduled irrigation, the controller resumes to the state it was in before it was shut down. Except for the remaining time left. Instead of the scheduled duration the duration is set to about 38.000 minutes: the same state a button press would end up in.

This is a serious issue if there isn't any other control mechanism like soil moisture or maximum run time, potentially flooding your lawn (or in my case: indoor green wall and with that, the floor ;))

Comment options

I'm wondering if this is by design. The script carefully stores remaining_time1 and remaining_time1_previous. But do those values survive a reboot?

Answer selected by Klarstein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /