Rule Machine, Multiple Actions?

I would like to run a rule and then wait for something to happen and then run the inverse of the rule. Is this not possible with a single rule in Rule Machine? Do I need to create two stand-alone rules? One to turn it on and one to turn it off? Seems like it could get messy if there are multiple, related rules listed in RM?

If 2 rules are required, is there a way to "group" or "associate" them together so it doesn't get messy?

I need Rule Machine because in Basic Rules, there isn't a trigger for date/time.

Here is what I'm trying to accomplish.

I have a Hub Variable called "Is Halloween". It's defaulted to false. I'd like that hub variable to be true on 10/31 (every year) at midnight, and get set back to false on 10/31 (every year) at 11:59 PM.

I am using this inside a Rule Lighting App to disable the time-based activation if it's Halloween.

Is there another recommended way to accomplish this?

RM has Wait for Event, which can be a future time/date.

You could also use two triggers in the same rule to get the result:

Triggers: Time and Date (10/31 at 12:00AM and 10/31 at 11:59pm)
Actions: If time is 12:00am, set variable true; Else, set variable false

Got ya! Both of those make sense! What I was missing was the "wait" action. I was trying to find it in a different spot in the UI.

I think I will go with @bravenel solution. One question, if the hub gets rebooted in the middle of the wait command, would it still work when the hub comes back up or would that wait command get lost? I am trying to make this as bulletproof as possible so my "Is Halloween" Hub Variable is always accurate and doesn't have the ability to get inversed/out of sync.

For @JB10 solution, I would be concerned for the same thing to happen. With an if/else, it's essentially a toggle. If something happens where the variable gets set to the wrong setting, I would essentially just be doing an inverse toggle.

After talking this out more, maybe it would be more robust to create 2 separate rules? One that runs at midnight and another that runs at 11:59 PM every night and sets the variable based on a date conditional?

This whole workaround is because I don't see any easy option to disable my Room Lighting sunset-based activation so it doesn't run on Halloween. That's why I went the Hub Variable route. Am I missing something? There has to be an easier way to accomplish this?

For this, I wouldn't bother with a Hub Variable. Instead, use a virtual switch that gets turned on and off using either of the two options that have been provided. The wait command would survive a hub reboot. The same thing with my suggestion as it is based on triggers rather than a wait. Both rules would survive a reboot fine as long as the reboot didn't happen at 11:59pm on October 31 (or 12:00am on October 31).

The reason to use a virtual switch is that you could disable Room Lighting with the switch turning on and re-enable with the switch turning off. Then if something was to happen (like a trigger being missed for any reason), it's really easy to just manually adjust the virtual switch if you need to.

It would still work unless the time passes while the hub isn't running.

1 Like