Rule machine - as per the app developer, this app is no longer available for new installs, distribution, or support

Try an experiment, and instead of using the virtual dimmer, use one of those bulbs as the trigger dimmer. See what happens when you dim the one being tracked through the mobile app, does the other follow suit?

If I’m remembering correctly, action for true fires based on conditions (time of day, presence, inactive motion). False would mean not that time of day, no presence, and motion detected.

Perhaps set it up to be something like if my presence is detected and it’s between 5 and 9 pm and motion is detected, dim the light to 30 with a delayed off of 5 minutes.

EDIT: or listen to @bravenel, it’s like he knows how to use this thing or something. :stuck_out_tongue:

1 Like

Careful! The negation of a truth statement isn’t always obvious.

A AND B AND C negated is !A OR !B OR !C. So false would mean its either not that time of day, or the presence is not there, or motion is active – Does that work?

1 Like

I learned something!


clearly I’ve not gotten anywhere close to this complex yet. :slight_smile:

Triggered rules are the most likely thing to mess people up, because people assume that the rule will still act like a rule. But really, its more like a trigger with conditions (and a rule about their relationships). These are completely different than a rule (conditions and rule, but no triggers). A rule is cool because it evaluates every time something happens to one of its conditions. But a triggered rule, or a conditioned trigger, if we call it that, is just a fancy trigger that does something when it is triggered.

1 Like

Would all this be in one single rule?

No, three separate rules.

This was fairly interesting. Notice how there is an extra AND/OR choice available right above the last “End of Sub-Rule?”. That makes sense because you could have kept adding terms to the sub-rule. Then there is another AND/OR choice after the last “End of Sub-Rule?”, because you could keep adding terms at that level also. Nice. I’m glad you found that bug, because that code is very hard to think through, as it’s recursive. It took me a bit to see where I was missing the end sub-rule offer.

You really have to watch how the rule builds to be sure you have it right.

If I do it as 3 seperate rules,then wouldnt #2 always fire anytime I am in that room when I didnt actually arrive home from work (say on a weekend or just a random day off) and have the lamp on? For example I turn on the lamp cause I want to vaccum the room but motion starts so it turns off the lights in 5min? Or I want to replace the lamp on my projector.

@bravenel, I am using your Rule machine and it is great. I want to implement an override feature. So in an automation (example, if I use Motion Sensor to turn ON a light), I want the ability to flip a virtual switch and have the rule stop at that point. So if the light in ON and I flip the Virtual switch, the light stays in that position until I flip the Switch back. Same when the light is OFF. I know there is a “Switch to disable Rule when ON” feature. Would that do what I need? If so, can you support a “Switch to disable Rule when OFF” feature. What I would like to be able to do is tell Alexa to “Alexa turn ON/OFF Living Room automation”. So ON will enable the automation and OFF will disable the automation.

Well, yes it would. So this is more complicated.

If you want to condition subsequent events on the fact that you just arrived home, then you’re going to have to know that’s the condition you are in. Sounds like another virtual switch. But maybe the one can do both jobs.

If the switch that you turn on from #3 is used as a condition for #2, then you should be good. Just make #2 a rule with 2 conditions: virtual switch is on (turned on by arrival) and motion active. Actions for true would be to turn off both the lamp and the virtual switch. Also, at 9pm, turn off the virtual switch. So the only time #2 or #3 would happen is if you arrived. Any other time, those would both fail.

I have this situation in my house. When my granddaughters take a nap, I can say, “Alexa, turn on Girls in Bed”. Girls in Bed is the disable switch. Later, I can say, “Alexa, turn off Girls in Bed”.

So I understand what you’re saying. I will look at extending that feature to allow Off. Stay tuned


OK, I made that change. The price for getting to use it is that you have to test it for me!! :grinning:

I pushed it to Github, V 1.6.9c.

1 Like

Thanks. It will be tested tonight when I get home.

Thanks Bruce. I’ll try to get my head around everything you said tonight and put it into triggers and rules.

How would I set up this rule.
I am using Vacation Lighting Director to turn on my light randomly at night when I am not home. The issue is the apps need to have two modes to work correctly. One mode awayday and another away night. The lights will only turn on at night while I am away.
Current I am using two simulated switches: One switch is on when I am away during the day and the other is off and vice versa.
Does anyone have a alternative.

I have routine that set move to away when we leave.

Rules/triggers I have
#1
Condition:sunset-sunrise and (Mode Away or Awaynight)
True: turn on AwayDay switch and turn off AwayNight switch
#2
trigger Daytimeaway (On)
Action: change mode to AwayDay
#3
Condition sunrise(+1)-sunset(-1) and Mode is Away or Away day
True: Turn off AwayDay switch, turn on Away night switch.
#4
Trigger Awaynight switch(On)
Action: Change mode to Awaynight

Just started using Rule Machine and I have to say, I’m blown away by how robust it is.

I’m having an issue with the only rule I’ve made so far, and I’m hoping someone here could figure out what’s going on. I think my logic is correct, but maybe not.

Expected Behavior
My girlfriend and I both use Sleep as Android for sleep tracking and alarm clock. When we put our phones into sleep mode, an individual virtual switch is turned on (amongst other things). I would like Rule Machine to run a Routine that puts SmartThings in Night mode if everyone who is present is also “asleep”. So, if we are both home, Rule Machine only runs when both of the virtual switches are turned on. If I am the only person home, Rule Machine runs as soon as my virtual switch is turned on, regardless of if my girlfriend’s switch is on or off. Etc.

Actual Behavior
Rule Machine runs when both of us are home and both of our switches are turned on, but if only one of us is home and their sleep switch is turned on, Rule Machine stays false.

Current Setup



I will see if I can reproduce this. It looks to me like it should work. If it doesn’t work, I’d sure like to know why!

The definition is showing up as False.

Just can’t tell why. Based on the Conditions all being True that are used (6P Present, S3 not present, Sleeping - Clayton on), it should be True since it meets that 2nd group (middle OR statement).

What happens if you take out the first and third groups in the definition (all present and all asleep, and 6P Not present one)?
Does it go to True?

Good idea, but no joy. Changes to the state of the tracked dimmer (bulb) have no effect on the other bulb. I’m going to try the same technique with another brand of bulbs that I’ve got; I’m starting to suspect a problem with the driver for these Sylvania BR30s, even though the “work with SmartThings”.