[UPDATED] Rule Machine with Triggers

Thanks - I originally had it like this but am too OCD to keep all those virtual devices around so I thought I could get rid of it. :wink:

Maybe I need to look into creating a virtual device which allows for multiple things (BOOLs, numbers, …) to be stored (à la key-value storage, preferably with the ability to rename the keys to something meaningful). This way I wouldn’t have to create a virtual switch for each “global” variable I would want to carry around. But then Rule Machine would need to know about accessing that device as well.

Been there, tried to do that, gave up. Pointless in the end.

We’ve been round and round this bush. It all boils down to having more global variables, available to SmartApps. For that to work you would have to have new Capabilities. ST has not gone in the direction of creating abstract Capabilities, nor of allowing us to create our own. We are stuck with theirs.

With Rule Machine, just as a curiosity, you can test the dimmer level of a dimmer, which could be a virtual dimmer. So, you could use that to pass 6 bits of information, or whatever 0…99 gets you. Or you could use a virtual power meter, which takes a real number; you could encode just about anything into that!

But, don’t be shy about virtual switches. When you need one, you need it. I put them in the room they act in.

Automations like yours, that vary based on the prior state of a switch that is to be controlled, are always tricky to do. Some are impossible to do, e.g. disabling motion within its response zone with a switch controlled by the motion. They usually require a virtual switch helper to carry the state information needed for the automation.

1 Like

Interesting idea - however, without math (addition and subtraction or OR/AND/XOR/…) I don’t quite see how to extract/set/unset single bits from it.

LOL. A dimmer maybe. A real, forget it, just joking. My point is that this isn’t a path with value, IMHO.

It is rare to need a virtual switch. Sometimes as a disable switch; in my case that’s 2 or 3 automations out of 70 or so. But, that’s irrelevant because everyone’s use case is different. I can imagine an automation situation where more virtual devices were needed, as state holders and glue. A virtual device is free. Partake, enjoy…

I am having an issue with using two rules in combination to create a third rule. I have the following setup.

Rule A = False
Rule B = False
Rule C = Rule A or Rule B = True

When I look at Rule B, it will show false, but when I look at Rule B from within Rule C, it shows true for some reason. I deleted the rule and recreated it yesterday which took care of the problem until the rule turned true and back to false again. Not sure why the rule would say false in one and true in the other.

When you enter a condition, including a rule condition, it looks at the current state of whatever the condition is. That’s what is displayed there. So if that state should change, that display isn’t updated until the screen is refreshed. That’s a momentary glance at the state. You really need to look at the logs to see what’s going on with your rule truths, and when they change.

Maybe I am misunderstanding but the current state of Rule B is false. It is a simple time span rule for on and off. When I go into Rule B that is exactly what it shows in Rule Machine. But when I go into Rule C, the Rule B condition shows as true for some reason. I can’t make sense of it from a logical standpoint if it is simply pulling from Rule B. The page has definitely been refreshed. I can take some screenshots and post them if that would help. BTW, I just wanted to say thanks for the App itself and all of the help. I don’t know how you find the time to work on it and help all the rest of us with it. It really is a function that Samsung should have developed natively.

It’s also possible that you have stepped on a bug. Did you read the part of the documentation that says this:

Ah hah. I will try it as a trigger and see how that works. Thanks yet again!

Edit - Forgot that I can’t compare the two rules with a trigger. Also, Rules A & B should not be changing states at the same time. Rule A is a time rule that turns on from Sunset - 23 til 10:25. Rule B is a similar rule that turns on at 5AM til Sunrise +23.

I was using A or B to turn on/off the lights.

I’m wondering if your response here @bravenel and my issues are connected as well. I’m trying to setup a rule to fire off a better ‘automatically perform’ routine than what smartthings has built in. What I included in the Rule was a ‘disarm’ command for the SHM as well as the Routine itself (that within it has a Disarm) command. So what happened this morning is the Rule worked fine, it disarmed per the rule requires, but never then issued the routine afterwards?

If your response isn’t the issue, should I setup a delay or something to give the hub time to work first before firing the routine command? Thanks for your help.

You’d have to show us a screen shot of your Rule to understand what you’re doing.

I think this may be folly. At the end of everything you do, both “automatically perform” and Rule Machine simply schedule something to happen at some time. If that is failing, it’s the scheduling that fails, upon which both Routines and Rule Machine depend to function properly. I don’t think “better” comes into play here.

Apologies. Here’s the example I meant.

And I suppose when I say ‘better’ I meant more control with Rule Machine. Currently, in this example there is no ‘automatically performing’ going in within the Weekend Morning routine itself. Hope that helps.

There is no reason that I can think of why the Routine wouldn’t run. Is the name of the Routine “1 - Weekend Morning!”?

Yes sir. Hmm. Could it be how it handles spaces and/or characters like ‘- OR !’ maybe?

This might not be related but I noticed your “Push” was empty. I noticed that on mine before so I had to go back in and switch the push switch off/on to get the Push message to show. My thinking is if the message is empty, the True action doesn’t execute all the way through.

There is a new release of Rule Machine, and it has more integrated Triggers in Rules.


Hey Hey.

The use case sounds suspiciously familiar!

Love this app.

1 Like

Not sure if this a a bug or I am doing something wrong. Setting up new rule with condition #1 Time of day. I get a required input that I can not fill out. shows no devices to connect. The next input I can set the time conditions just fine

I am running the latest version as of last night. Let me know if I missing something. thanks all the work on this.

This bug has been fixed, and pushed to Github.

1 Like