Rule to activate a relay switch multiple times with a delay?

I need help creating a rule to do this:

  1. A virtual switch is turned on (activating this rule app)
  2. The virtual switch is turned off by the rule
  3. A relay switch is turned on for 30 seconds
  4. The relay switch is turned off
  5. Wait 20 seconds
  6. Repeat lines (3),(4),(5) four more times.

I can't seem to find an easy way to WAIT and REPEAT. Can anyone help? Thanks.

The โ€œRepeatโ€ function can be found here:

One way to do this would be to delay the action to turn off by 30 seconds. The resulting rule would be:

Another would be to add a โ€œwaitโ€ command between the on and off commands, and remove the 30 second delay. The โ€œWaitโ€ commands can be found just underneath the Repeat commands.

I set the repeat to every 50 seconds in my example. It will result in:
0 seconds: Turn off Virtual Switch
0 seconds: Turn on the other switch
30 seconds: Turn off the other switch
50 seconds: Turn on the other switch (20 seconds later)
80 seconds: Turn off the other switch (30 seconds later)
Etc.

Does this help?

You may want to move step 2 to be the last action after the repeated actions, otherwise it would be possible to have multiple triggers of this rule while it is in progress. I'm assuming that you don't want two or more instances of this rule turning the relay on and off at the same time.

1 Like

For the virtual switch you can set it to auto turn off anywhere from .5 to 5 seconds on its device page. I use a few switches to activate things and prefer to have it auto off instead of the rule doing it.

1 Like

Thanks everyone for your examples and suggestions. I was able to put something together that seems to meet my needs.

1 Like