Conditional delay before executing an action

Hi!

I have a Wi-Fi plug that is switched on by a motion sensor using an automation, and it triggers a 1 minute timer to turn it off automatically (using another automation). The problem is that the plug (Tuya) goes into “unavailable” state often, so if it is “unavailable” when the 1 minute timer gets to 0, it won’t be switched off by the automation and it stays on all the time.

To fix this, I’d like to add an IF condition before the “plug switch off” action, that checks if the plug state is “unavailable” and if so, adds a 10 second delay (to wait for the plug to be available again), before the action that switches it off.

So it would be something like this:

  • timer gets to 0 -> automation is triggered
  • check if plug status is “unavailable” -> if so, do a 10 second delay (if not, do nothing)
  • switch off the plug

How can I do this? Should I use some template? I am not too familiar with templates sorry.

Thanks!

Hi there, instead of extending the timer, I believe you can use the wait for trigger action type to wait until the switch state is in on condition. check out the image

Thanks, I’ll give this a try @sheminasalam , although it may be a bit hard to reproduce and test it.

1 Like