I am programming my vertical garden automation and wonder if there is an easy way to run something for a certain time.
I can see time triggers so I can run the water pump at every hour. But I want to run the pump for only 5 minutes. So I have to add another automation that switches the pump off at 05 after the hour.
Or is there a setting inside MQTT to make relais sort of one-shot with a delay? I cano do that in the Ralay control panel, but I don't like that I have to do things in separate systems...
On the other hand, if HA misses the shut off trigger, the pump won't run 1h minimum.
What would you do?
#Automation that starts on time and runs for certain time
1 messages · Page 1 of 1 (latest)
you could use a simple delay so
trigger -> switch on -> delay -> switch off
which is functional but is also a "long running automation" which i generally discourage but for 5 mins its probably fine tbh
or you could have a 2 triggers with id's then choose what to do based on which trigger happened.
trigger: on the hour
trigger: switch for 5 mins
then turn on / off based upon which trigger happened
this way you could also have backups succh as "switch on for 10 mins" and "switch on for 15 mins" to catch failure to switch off at 5 mins
Yes, was thinking about that. The relay box I use can do delayed action on its own. So setting the relays to their specified delays would be a better idea. However, I cannot find how to set the MQTT to not use the on/off trigger but the delayed trigger to send to the relay board
if you know the details on how to call it with mqtt then you can use the mqtt.publish action to send it manually
I have no idea what to send but I can rtyt to find out
ESP32-based 4-channel WiFi relay with Ethernet support. Works with Domoticz, Home Assistant, and OpenHAB for smart automation.
I am using that thing and even with my limited knowledge it went up in HA pretty snuggly
And a problem with that trigger event on the trigger event (if relay was set, wait for 5 minutes and switch it off) is, that I also use a button to directly control the relay in case of cleaning and servicing the vertical garden
there are ways of detecting if it was switched on by automation or something else.
so it could be
if on for 5 mins then check to see if was turned on by automation and if so then turn it off, else ignore
i think this is one of those things where there's 100 solutions. you just gotta work out what one works for you
Actually, taking into account that you normally not run the pumps manually for longer times it is quite sufficient to trigger that 5min countdown also on the button. Especially as the button can switch it off at any shorter time
And if the kids are in and pressing buttons, just because there are buttons, the system settles itself again.
The only thing I don't like on these relay boards is, that you cannot tap into the relay control lines. That would be an easy thing to control the LED ring of the switch. So I have to solder something on the board
Okay, ordered some mechanical parts missing to get that project closed for now.
if it's important that the pump gets turned off again even if home assistant is restarted, consider having your "turn on" automation start a timer helper (with persistent mode enabled) and then have an automation triggered by the timer finishing which turns the the pump off.
if you have e.g. a button to manually start it, you could have the automation which handles that start the timer, too, so it has the same turn off behaviour.
this also lets you do things like extending the timer if the button is pushed again while it's already running, for example.
Yes, I opted for that route. The button now can locally toggle the pumps on and off, but if forgotten, the same rules apply and the pumps are switched off after 5 minutes delay.