#Cancel triggered actions with a delay

1 messages · Page 1 of 1 (latest)

topaz spire
#

Hi I have an automation setup with 4 triggers.

  1. Shower On
  2. Shower Off
  3. Fallback to turn fan of just in case
  4. Fallback to turn fan of just in case

The use case that I would like to solve is as follows:

Shower On is triggered
Shower Off is triggered
Shower On is triggered again before Shower Off action is executed because I use a delay of 25 minutes and some else took a shower shortly after.

What happens is that Shower Off is executed to soon. So functionaly the second Shower On should stop the running Shower Off action.

A solution I could come up with is to not use a delay in the action but to change the trigger to trigger when shower off happens 25 minutes (the delay) ago.

Unfortunatly I can't figure how to do this.

Here is my automation:
https://hastebin.com/share/aseboyixed.yaml

terse marsh
#

i think your problem could be solved by changing the automation mode to restart instead of single. That way if the "shower on" trigger happens while it's in the "shower off" delay, the current run will be cancelled without waiting for the delay and a new one will be started with the new trigger.

#

you could also consider using my favourite helper, the timer: https://www.home-assistant.io/integrations/timer/ - every time the shower on trigger happens, you start the timer (which will reset it if it was already running), and then trigger on the timer to do the shower off actions. Timers can be made persistent, so this means the shower off actions will still happen even if home assistant is restarted.