Repeat light off and on on a looping timer?

I have a heater for my lizard aquarium. Is there a way to turn a switch on for 10 min then off for 10 min and to keep repeating this indefinitely? I was looking to set up a rule but cant seem to figure out this situation. Any help is appreciated. Thanks

Hi, you can program an IF rule with a nested THEN that that never stops: Light On, waits 10 minutes and then Light Off and waits other 10 minutes and repeat, also create a virtual switch that triggers this rule but stop it too via the virtual switch when its necessary.

1 Like

I’m having a bit of trouble following. I make one. If light is on for 10 minutes then turn off. Then I make a second if light is off for 10 minutes then turn on? All in one rule?

I think this is what @Carlos_Juarez suggested:

  • Trigger: When the light/heater is changed to “on”
  • Flow: Delay 10 minutes, turn light/heater/ “off”, delay another 10 minutes, and turn light/hearer “on” (this last action will trigger this rule again, and loop.)

And you can add an IF_Condition using a Variable or Virtual Switch in the beginning of the Flow to control if you actually wants to “disable” all the activities in the flow. So if you don’t want it to be turn off 10 minutes later and loop, you flip this Variable or Virtual Switch so none of the activities will be executed.

Please note that we Do NOT recommend any life/health supporting automation to be run on smart home technologies.

2 Likes

@James That makes sense now. I see how its working. Thanks for the help/

2 Likes

Hi, I’m trying to do something new with this similar effect. But its a diffuser that releases a nice smell. I want it to turn on for 5 min but off for 2 hours and repeat. but the new thing is that I want it to only do that between the hours of 9am and 9pm. SO its not running at night. but kicks back on in the morning to repeat the cycle. This is what I have but I’m not sure its correct.Any help is appreciated thanks

@Tony_Matejek, the rule looks alright most parts. I assume the issue was the diffuser doesn’t get turned off after running for 5 minutes? You should add a Diffeuser off command as shown in the screenshot below. Or let me know if this is not the issue you are trying to resolve.

Thanks for the quick response! In this case is the very first trigger to turn the diffuser on necessary, since thats the first action after the “if condition” in the flow?

Hmm, just want to make sure I understand your setup correctly:

  1. Is the Diffuser and Plug the same device? If not, then you need to keep the action to turn Diffuser on in the THEN path as you already did. (Or please help me understand what is the Plug for if I missed something here.)

  2. What do you mean by the very first trigger? (This rule’s trigger is when the Plug is turned on.) Or do you mean the very first action?

P.s I thought the Plug is just a Simulated/Virtual Switch and is used here to recursively triggering the rule but let me know if this is not the case.

The difussor is plugged into a smart plug outlet which I can control manually in smart things. Smarrthings does let you turn on and off automatically but only 3 times during a 24hr period, so dumb.

So the difusser is always set to on and plugged in the smart outlet plug. What we are trying to do is use the smart plug to kick on for 5 minutes then turn off, and wait 2 hours before turning on again for another 5 minutes and repeat. But only do this between the hours of 9am and 9pm. The difussor is very strong and only needs to be on a few min to be effective.

The very first even trigger is to turn the outlet plug on. but the next if condition also has it set to on. I wasn’t sure if the was redundant since both tell it to turn on. If you have a suggestion on how to redo the whole thing I’m all ears. but the idea is to have it do the on and off repeat but just between certain hours. if that makes sense.

@Tony_Matejek thanks for the clarification. So if I understand correctly. the diffuser is always on, and is working as long as the Plug device is switched on, and there is no need to control the Diffuser device directly in the rule then.

I would suggest to create a True/False variable as shown in the screenshot below.

Then use this variable as the trigger, and only turns on the Plug device when it’s during 9am-9pm. The logic is very much like what you have, but just use the variable as the looping mechanism, then turn the Plug on/off accordingly.

Then you just need to manually update this variable to true to kick off the rule.

1 Like

ok. I think I understand whats happening here. The first true variable turns it on and as it follows the rules down it ends up at the false variable after the 300 seconds. and that next variable triggers the 2 our wait time. Then the next variable going back to true is what restarts the process and the loop continues. Starting to get a bit complex but I think I get it. We will see how it goes and if it keeps the house smelling great! Thanks @James I really appreciate the help. Love this tool and what its capable of. Even added a tile to turn it on manually when needed.

hmmmm.somethings not quite right. it runs for 5 minutes but does not tun itself off. I may need to start from scratch and think about this in a different way.

Have you checked the Rule Log and see what how the rule was executed? Did you turn the Plug on manually, instead of turning the variable to TRUE to trigger the rule? If you turned the Plug on, it won’t be turned off 5 minutes later because the rule is simply not triggered.
One other thought is to create a rule to be triggered when the Plug is turned on, and then delay 5 minutes, and then turn the Plug off. Then in my example rule, you can remove the 5 minutes delay and action of turning Plug off, because it will be handled in the other rule. The benefit of doing this is no matter the Plug is turned on by rule, physically or by dashboard tap, it will always be turned off 5 minutes later.

1 Like