Help with rule

I need some help here. Can anyone of you tell me why this outlet comes on in the daytime? Also, it does not turn off at all. I have a screenshot of "In use by" for this outlet. In use by Alexa and there are no routines that use this outlet. HSM uses it only of there is an intrusion. Turn off when leaving group only turns it off. Only thing left is this rule. What am I missing?
Screen Shot 2021-06-16 at 2.54.19 PM
Screen Shot 2021-06-16 at 2.55.52 PM

Can you accomplish the same thing using the Motion and Mode Lighting app? Sounds like it would be doable and easier.

I'll take a guess though...

The logical operator AND takes precedence over OR. Assuming RM follows this same order, and it likely does, your conditional will be true under two conditions:

(1) Mode is Home
(2) Mode is Night and time is between sunset-30 and sunrise+30

In other words if mode is home the light will come on if the rule is triggered.

1 Like

I think your condition as written is evaluated as:
Mode is Home OR (Mode is Night and Time between...)

You can put parentheses in your conditions and write is as
IF ((Mode is Home OR Mode is Night) AND Time between...) THEN

3 Likes

:+1:

Much easier, and I think it will do what you want it to.

Like the others said, your current rule will trigger on "Mode is Home" and also "Mode is Night and...".

1 Like

Thanks for the info guys, but I don’t use anything but rule machine. The reason I do this is because if you have anything but a basic home automation system you will at some time need to use rule machine. If you use it for everything you are bound to get better, and I need all the help I can get. But that is just me, you may think differently.
I do think I solved my problem by changing the home and night to NOT away. It will take some further testing but I think I have solved the problem.

That works, too! If you only have two conditions, the order of evaluation doesn't really matter (in RM on Hubitat, at least). The issue, as mentioned above, is that AND and OR are evaluated left to right with equal precedence, so the value of your entire expression had an unexpected value (you can see this in the UI: "T" and "F" are evaluations for individual conditions, and "TRUE" or "FALSE" is the evaluation of the entire thing), which could also have been fixed with one of the solutions proposed above.

But don't be afraid of the built-in apps, either. Simple Automation Rules (originally written with lighting in mind) and Motion Lighting are both pretty powerful apps with lots of options, so you may not need RM to get what you want. They are also likely smaller and may load/execute marginally faster as a result (but are certainly faster and easier to set up, in any case!). I use Rule Machine only when I can't find something else to do what I want--though I confess that in my case that includes a few custom apps that I wrote since RM gets tedious to use for some things and there weren't any built-in options.

1 Like

Thanks for the info. I have been at this a couple years and I did not know what the T&F vs True & False meant. I kinda figured out the T&F but the True & False eluded me. I guess I am not as smart as I thought I was.

It's an interesting approach with lots of merit overcoming the not insignificant RM learning curve.

My approach has always been try the simplest approach, then the next more complex, and so on, arriving at Rule Machine second to last and custom Groovy code of your own creation at the bottom of the list. And since I don't actually know Groovy, I never get that far!

1 Like