RM 4.0 Rule Questions and Optimizations


#1

Since RM 4.0 is a change in how to build rules, I thought I would start a threat so we could help each other make our rules better. Here's one to start.

I have a rule which turns some lights on when it's overcast or when it's evening. I also don't want it to run until after 9:00 in the morning. It runs as it should and that's great. When I first created it, my logs would get a lot of entries since the rule would fire even though the lights were already on. Following one of Bruce's example's, I included the Private Boolean so it wouldn't continue to run when it was already true. This worked and it didn't fire after it became true.

The glitch is that while it's false, it's filling up the logs. Any ideas how to slow that down?



#2

Have you enabled the trigger logging option? Would be interesting to see what is triggering the rule. I assume it is the illuminance sensor.

I do something similar but have it still in 2 Rule setup to debounce some things.... It is still on my todo list to migrate.


#3

In you "ELSE" part, you could add a conditional check to only send the Off command if the scene is actually on

ELSE
IF SECENE == ON THEN send command OFF: Scene
END IF


#4

Sometimes posting something makes you think about it a little differently. I modified the rule slightly and put a restriction to only allow it to run between 9:00 AM and 10:30 PM (that's when the house moves to "night" mode). So far the logging has stopped.

@dan.t That is a pretty cool trick. I like that better than using restrictions and will change it now.


#5

What I have done is defined some virtual switches that turn on and off at certain Lux levels. I have 6 of them.
I then use the virtual switch being on or off in my rules as one of the conditions.
For me this serves 2 purposes.
My lighting rules are not re-evaluated every time Lux value changes, only the virtual switch rule is evaluated.
Secondly if I change the Lux level to turn the virtual switches on and off or change the device that measures Lux values, I only have one rule to change not several.
I'm sure this could help with your issue but maybe not.
Just an idea for you to think about. :wink:


#6

While I was recreating the rule to include the "ELSE IF Scene" it dawned on me that the the restriction of only running between 9:00 AM and 10:30 should be a condition (doh). So now I've rewritten the rule. I was so focused on not having the lights come on when I was sleeping in that it blinded me (bad pun intended) to the obvious. Go figure.

25%20AM


#7

I have a question about terminology for @bravenel . And I've chundered up the other thread, so I'll give this one a go.

With Rule 4, I notice that evaluate rule is no longer available. I presume that run rule actually evaluates the RM4 rule (as if it was triggered), since there is no "true" side to auto action.


#8

@bravenel After I changed the rule above, I cloned it to cover other parts of my house. When I did, the Private Boolean didn't stay as "This Rule." They pointed to the original rule. Is this by design?

44%20AM


#9

No, Rule Rule Actions runs its actions. Note that Run Rule Actions is effectively the same as triggering it, since triggering it causes its actions to run.

There is no rule to evaluate in 4.0.


#10

Yes, references to rules are based on the app id of the referenced rule. These don't change. You can even change the name of the referenced rule (on its own app page), and the reference stays intact.


#11

That's kind of odd though in a rule clone. If you clone a rule, and the original had a reference to itself.... Shouldn't the cloned rule also reference itself instead of the original?

It makes sense that non-self references would remain the same in the cloned, though.

I get that isn't how it works today. Just thinking out loud how I think it should work.


#12

Meh, you have to modify a cloned rule, and this is just something that has to be modified. I've been gradually changing how self reference rule actions (PB, et al) work, so this may change in the future.


#13

No worries. It isn't a big deal - just something for users to remember to do after cloning. 10000x better than no clone option at all! :+1:

(10000x is based on an informal poll of users named @JasonJoel )


#14

another stupid question, how do I check presence state? I only see "changed" for any presence device. I basically want to have (if presence.present then do A else do B)


#15

You are not on the lastest hub software. There was a bug that was fixed yesterday. Check for updates under settings


#16

Am I the only one that preferred rule machine 3.0 over 4.0?


#17

Probably not. They certainly offer two different ways of thinking about automations. There are some Rules in particular (Rule-3.0 meaning of Rule) that are hard to do in 4.0 but relatively easy in 3.0.

Your opinion matters. This is one reason that 3.0 is still available.


#18

Why not have both abilities built into 4.0? Advance rule creation and standard rule creation.

I’m seeing the flexibility of rule machine 4.0, but I can also see people running the other direction because of it. New customers for instance...


#19

What I'm finding is that different people think in different ways. For some people, the form of RM-3 is very confusing, and they have a hard time getting it. Yet, they get RM-4 very easily. The opposite is undoubtedly going to be true also.

When you add more choices to an app, it introduces confusion about which one to use. But, you might be right. I'll think about it.


#20

I definitely fall under the category of "different" :roll_eyes: And while I did find RM 4.0 confusing at first, I think it had to do with the fact that I opted to convert most of my existing rules and attempt to combine them when possible. When building a new rule, especially a complex one, RM 4 is definitely more powerful!

When I first started using smartthings I found it super easy to work with, until I wanted something more than just a way to automatically turn on/off a light with motion.

This brought me to WebCore, which was infinitely more powerful, but far more challenging to fully understand at first.

Rule Manager 2.x was a step back requiring multiple rules to achieve anything close to what I had become accustomed to.

Rule Manager 3.x was a step forward in flexibility and RM 4.x is just the icing on the cake! I'm currently at the point where I don't miss WebCore anymore, my automations are just the way I like them.

For those that hate the change, I think a 24-hour test drive is too short, get to know it a little longer, I bet it will grow on you.