I recently created a webhook to enable a POST trigger a heating source. The idea is a button is pressed on the wallpanel and the automation switches on the heating for 60 minutes (a boost, if you will) and then switches off. However, if the automation is triggered and sits in the WAIT block, I can’t see a way to cancel it (say for example the button was pressed by mistake etc).
The means that I need to wait for the 60 minutes before I can use this again. ( I manually switch on the source but trigger fills the log with “Webhook already running”
Any ideas? Still relatively new with HA so perhaps I have the workflow all wrong.
thanks
Try using a Timer rather than doing wait in the automation.
HA is event-based, so, generally speaking, loops or waits in automation should be avoided (imo).
Another option is to turn the heater on with the automation, as you have it now but do not wait for 60 minutes.
Instead, write another automation that is triggered if the heater has been onfor 60 minutes that turns the heater off
This has the advantage of not needing to restore the timer after a Home Assistant restart. Though the 60 minutes will begin counting again after the restart.
If you do go with the timer, here is a great post on how to restore them:
I realize this is an old post, but incase anyone ends up here a solution for “I want something to work for x time after I do y, and restart the x time every time I do y, even if its already running” is to change the trigger mode to restart. That’s exactly what it’s for.
Thank you Mr Drake! 3 years on from the previous post, this was very helpful. Would have saved me an hour in doing any of the above! This community is awesome.