Rule Machine - Get peer assistance here with setting up rules

According to my Location in the IDE it’s 6:30
Weather Sunrise 6:33 AM (copied from my IDE)

So where is Sunrise coming from and/or being calculated from?


Go into the IDE / My Locations / List SmartApps / and click on this rule. It will show you the Scheduled Jobs, and perhaps past jobs. See if that sheds any light on what’s happening.

Sunrise time comes from a lookup with your location’s time zone and zip code, a platform service.

Thanks Bruce for that tip, you shared that with me a couple weeks ago which fixed my issue then, just didn’t remember it this morning.

At this time, the startHandler(s) are always 6:30 am, which is good
The stopHandler is random from 7:00 to 7:19, never 60 mins past startHandler
Next scheduled stopHandler is 7:11am

The random time of turning off the lights is not a huge issue since we use it to avoid waking up to a dark house, it’s just annoying is all


To me, these kinds of “rules” - at this time, do this, then after some delay, undo it or do something else - are more intuitively implemented as (conditional) triggers. In this case, trigger at sunrise, turn on the switch, then turn off the switch after a 60 minute delay. Maybe you could try that approach and get more consistent results?

I changed any reference of open or closed to unlocked and locked.
It is possible I missed something but I doubt it as I searched for the two words.

Well after consolidating my rules I’ve run into an issue & stupid me should’ve fully read Bruce’s rule machine documentation. Rule machine - as per the app developer, this app is no longer available for new installs, distribution, or support

everyone should be aware your schedules will fail if your trying to do to much at once here is the excerp from the manual I’ve since corrected this issue by putting in delay cancel on truths.

So if you have things failing check you schedules & make sure your not creating loops or to many rules running at once.

“Limitation: Due to limits of the SmartThings platform, it is possible to ask Rule Machine to schedule too many future jobs, and thus fail. The platform only allows 4 jobs to be scheduled at any one time. If you use a Time of Day condition, that schedules two jobs, a Time of Day condition with sunrise / sunset schedules three jobs, a At Certain time trigger based on sunrise or sunset schedules two jobs, and a Days of Week condition or At Certain time with a time each schedules one job. Delay These Actions, Switches to turn on/off after a delay, and Switches to turn on/off after a delay pending cancellation, each require one scheduled job. Rule Machine does not attempt to manage this limitation, that is up to you.”

This is a per rule limitation, not all rules combined.

1 Like

Yes there is & I really pushed the limits lmao. One rule of mine was doing 8 things at once :confused:

OK, so I changed it to a conditional trigger with a delay for off. Tested it at current to with 2 min delay and it’s working as designed. I will see how it goes tomorrow morning

Thanks chickwebb


After I set my lightbulbs to a certain color manually with the Smartthings app, (Hue, and saturation), is there a way that I can then capture the state of those bulbs and then have those settings restored when motion is triggered using rule machine?

Thank you very much.

Dang, didn’t work this morning

I tested a conditional trigger yesterday at approx 3:40PM to turn on some lights, then 2 mins later turn them off. It worked fine. I changed the start time to 7:00AM and the delay from 2 mins to 60 mins.

This morning at about 7:15 the lights were not on.
The IDE says it fired at and is now waiting

What did I miss?


Yes, you can use Capture and Restore actions. Capture captures the switch state, hue, saturation and level. Restore puts them back. However, Capture and Restore have to be in the same rule. So you’re going to need two rules. The first rule should be a conditional trigger, like this:

Trigger event: Pick something that makes sense
Condition: Private Boolean true
Rule: Private Boolean true
Actions for true: capture switches, set private Boolean false
Actions for false: restore switches

Then you would have your motion rule, like this:

Condition: motion active
Rule: motion active
Action for true: evaluate rule [first one above]
Action for false: turn off after x minutes, cancellable

When the second rule evaluates the first one, it’s going to be false, so it’s going to do the restore then. The way this is setup, you could only capture the settings once. Being a bit more clever, you could figure out from this starting point how to be able to recapture again (it would entail setting first Rule’s private Boolean to true again).

Are you sure that’s what it said? Odds are that it didn’t run at 7:00. Try a time not on the top of the hour, but a few minutes offset. ST still has lots of schedule failures.

You can go into the IDE / My Locations / List SmartApps / click on your rule, and you can see it’s scheduled jobs. If it has a scheduled job in the past, that would explain it, and the rule needs to be updated. You can update it right from the IDE, or by hitting Done in the rule itself.

Yes. Use rule machine. You can set it up by using the capture option in actions for true and the restore option in actions for false.

Thanks Bruce, here is what my IDE shows

Seems to me that it was scheduled for 7:00.01 and ran at 7:00.7.558

I went ahead and did an update


Actually, that shows that it probably didn’t run. The good news is that it is scheduled for tomorrow.

Look at the Delay and Execution times for this morning. ST kills an app after 20 seconds, and this one ran for 43.792 seconds. That’s why you should move it to a few minutes earlier or later.

So I moved it to 6:55AM, went into the IDE, updated it and the new time shows, yet it still says the next schedule is tomorrow when in RM it’s set to only Sat/Sun. I have a different rule for M-F


So you’re saying that I should set my bulbs how I want them, let’s say at 11:57 PM. And then set a trigger for 11:58 PM that will capture the bulbs?

So if I turn on my bulbs how I want them at 11:57 PM, make 1158pm the trigger for capture?

I guess I don’t understand how I’m going to capture the settings. After I manually set my color hue and saturation, how do I go about capturing that?

I want this motion rule to only happen in night mode

What is your trigger going to be for capture and restore?

This is an example of how I set up mine for capture/Restore. It works wonderfully for me. I am using the Phillips white bulbs, I have not tried this on the color bulbs.

Yes, this can be done with only one rule.
I use multiple rules in my programming. I have found to achieve almost perfect stability and reliability this way. My only problems have been from the ST scheduler failing me.

Rule #1 - This one performs the capture and restore functions. It also uses private Boolean to turn on/off the second rule.

Rule #2 - This rule sets the bulbs to a desired setting after the capture has been performed. It is triggered by the action of the first rule changing the private Boolean.