Hello, good day,
I have created an automation in which a GPIO switch is switched on when a threshold value is exceeded. Everything works as hoped.
Is there a way to determine how long this GPIO switch remains switched on, or do I have to switch it off again via automation (the trigger would then be the start of this automation).
Although you can set how long the threshold must remain exceeded for the action to start, you cannot set how long the GPIO switch stays on. At least I haven’t seen such an attitude.
My wish in this regard is that the GPIO switch remains switched on for a maximum of 2 seconds and then is LOW again.
You can set a delay in the automation actions, although this is not ideal as it can stop counting down if rebooted or some such like. You can use a timer helper and trigger that that to count down the time and then action whatever when it finishes. You could no doubt also do this with a template but I don’t know how or why you would.
OK, it’s harder than I thought.
First of all:
I simulate moisture by touching the soil moisture sensor between thumb and index finger → value: ~1,180V. If I let it go I get a value of ~2.108V. For testing purposes, I then set the threshold to 1,300. Therefore, the trigger is initiated when the threshold value is undershot.
Explanation:
The automation is supposed to start a 5V pump, which then pumps water to irrigate a plant.
However, since it would take too long to wait for the water to reach the sensor, I only want to water for 2 seconds, and if the sensor value is still below the threshold value the next time it is polled, then it will water for another 2 seconds, and so on …
I thought my automation (now including delay, thanks, works great) would do this exactly.
Unfortunately it doesn’t. If the threshold value is undercut for the first time during a query, the pump runs for 2 seconds. So far so good. If the sensor value falls below the threshold value in the subsequent query, then nothing happens. The pump does not start even with further queries. I hold the sensor between my thumb and forefinger the whole time.
If I let go of the sensor, a value of 2,196 is displayed, which is also good. If I then touch the sensor again, it falls below the threshold value and the pump runs - only once.
It looks like the threshold needs to be exceeded again before the automation starts again. This is not good.
How do I get the pump to run for 2 seconds for EVERY query that falls below the threshold?
Trigger on any change of the sensor and build the parameters in the condition section.
Or in the action section with choose statements.
Avoid delay because if HA is reset in the middle of that, it might leave the pump on forever.
(Might) want a second watchdog automation that triggers when the thing is on say over 4 seconds or whatever is appropriate so that there is a backup. That would be a trigger. If things are going right, that is never used. I would also add a notify in that automation so that if it actually triggers, it lets you know there is a problem.
hi, thank you.
uff… a lot stuff for a little thing. Why the automation only starts once?
which parameters in the condition section ? You mean the threshold parameter?
what instead of delay ?
You mean a notification for the watchdog automation ?
I assume this is something specific to your needs. Is the idea to slowly water (over and over) until it’s watered enough based on the sensor?
I would approach it as “trigger when it needs water” i.e. when the sensor is low then run the pump some amount of time to make sure it’s “watered”. That’s what I do manually - stick my finger in the soil and if dry dump some water on it. Repeat in a few days.
Otherwise you have to time poll, and that always feels odd to me in HA vs. triggering on an event.
It’s impossible to help if you don’t post your code. I don’t even know if your automation is on esphome or HA.
In case you use esphome sensor component with on_value_range, the behavior is exactly like you described. It triggers only when it enters the range.
In that case you need to use on_value automation with conditions.
Hello,
specifically tailored to my needs, hmm, I don’t think so.
There are many reasons why I want to do it this way (2 second pour).
Of course I can test how long the pump has to run to pump exactly the amount of water, but why?
I just wanted to check the humidity every 10 minutes. If the threshold is exceeded, please water as often as necessary for 2 seconds.
I don’t want to water the neighbors’ heads
It’s my first automation and i followed the docs - more or less…
i build the automation in the automation section of HA and i configure it over esphome builder.
is it the only solution to build this automation directly in esphome ?
Only two seconds if the threshold is underbiten… every check
if you would put your two answers together so i can mark these as solution. if not, only one would get the mark - i think the first one, because it is closer to the title…