Automatic Plant Watering Issue


#1

1) Give a description of the problem
My auto-watering setup for my houseplant: Spruce soil moisture sensor, submerged aquarium pump connected to a smart outlet that pumps to, basically, a small soaker hose coiled around the base of my house plant. I’m having issues with the piston running through to completion (or at least how I intend it to complete).

2) What is the expected behaviour?
Only when mode indicates I am home and water sensor indicates wet resevoir: When soil mosture drops below 38%, I want the pump (outlet) to turn on for a certain number of seconds and wait for 3 minutes- and complete that cycle 3 times (to allow water to soak into the soil before adding more). Then wait 45 minutes and check to see if the soil moisture is below 50% (does it need more water?). If yes, water for 10 seconds and wait another 45 minutes. Check again if soil moisture is below 50%. If yes, water for another 7 seconds. If soil moisture reaches 50% OR all the watering cycles have completed, piston ends (to avoid accidental over-watering or overflow in case of faulty sensor or something). When soil mositure drops below 38%, trigger the whole process again.

3) What is happening/not happening?
Watering begins, as expected, when moisture drops below 38%. However, as soon as moisture exceeds 38%, the entire piston stops. I basically want the piston to say, "OK, once the moisture drops below a certain level, do all these things regardless of whether it rises to 39%, 40%, etc. When moisture is below 38%, check and water until it hits 50% or you’ve exhausted all the 50% checks I’ve told you to make.

I’m guessing it’s an issue with my code structure or use of triggers and conditions.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
Sorry, at work so don’t have the logs set right now.


#2

i’m busy at the moment, I’ll write more later but a quick look shows me your nested IFs are the real trouble…
and I have a feeling you didn’t intended that way.


#3

I figured that was the case. Id really appreciate any help in arranging my code properly.