Periodic on and off in a single rule?

Hi everyone. Is there a way to turn a device on for a period and then off for a period and have it repeat forever? What I want to do is turn an outlet on for an hour and then off for an hour and on for an hour and then off for an hour...lather, rinse and repeat.

I created two rules: one that turns the outlet on every even hour and another rule that turns it off every odd hour. This works, but I'm wondering if I can do this using a single rule.

I searched the forum and saw posts about periodic scheduling, but didn't come across any that were related to what I'm trying to do, but I suspect there is a way.

Thanks for the help

David

If the device exposes the “switch” capability, just set a 1 hour periodic schedule with “toggle switch” as the action.

Otherwise set a periodic schedule trigger to every 2 hours. In actions, perform one action, followed by the opposite action delayed by 1 hour.

2 Likes

4 Likes

I have a very “chatty” natural gas sensor in my garage (about 3 log entries per second when it’s enabled). So I wrote this rule to enable it only 30 seconds out of every 5 minutes:

2 Likes

That did the trick!

Thanks Bruce

Thanks for the suggestion

1 Like

Hi everyone and thanks for your help before.

I have a slightly different requirement to turn an outlet on & off, but am not sure how to handle it. What I need to be able to do is to turn the outlet on for an hour and then off for 30 minutes and then on for an hour and then off for 30 minutes...rinse and repeat.

I tried modifying the rule that I was using to cycle the outlet on/off every 30 minutes, but I don't quite have it right.

The problem I'm running into is that if I set a trigger for hourly, the rule is for the top of each hour, which is not what I need. Instead, the outlet needs to turn on for an hour and then off for 30 minutes.

So, for example, let's say it turns on at 1pm. It should then turn off at 2pm and remain off until 2:30pm - at which point it should turn back on until 3:30pm and so on.

I hope what I'm asking for makes sense - I just have found not a way to do it in Rule Machine.

Thanks for your help.

David

Tricky one I think.

Here is a rule that might work for your use case (note that I used minutes and seconds instead of hours and minutes, just to make testing easier)


The second trigger is only there to bootstrap the rule, as it needs an "off" event to get going. Once the actions have run once, the rule should keep going on its own.

Another post reminded me you could go with an explicit schedule, this way: