Rule Machine - What am I doing wrong?

I have what I think should be a simple rule but it just isn't working right.
Scenario - Check both garage doors (tilt sensor) every 15 minutes after dark (Night mode) and notify me if either is open.
I've eliminated the restriction for testing and also added a "Action for False". However, regardless of both door positions, it ALWAYS executes the "Action for True". What am I doing wrong?

I created just a regular rule (not triggered every 15 minutes) and it works just fine, speaking the correct state on every truth change.

This is nuts.... I created a trigger to run every 15 minutes to call the rule in post #2 that is working as intended. This doesn't work either, ALWAYS coming back True. Is it something with the "periodic" that I'm missing?

I tried to simulate, but sadly, it worked fine for me. I'm on v1.1.2(121)

I split the Rule in Two, just to make testing easier... I could set the interval to 2 mins instead of 15, so I'd go thru more iterations.


Then I used Private Boolean in the "speak" Rule:

There's probably better ways of doing this but I was really looking to test your "Is it something with Periodic..." I have Pushover messages showing Open and Closed exactly on the minutes specified.

No, it's a good thing it worked for you. It means, clearly, that it's something on my end and not a problem in the platform. Other than using the Private Boolean (which I don't think should make a difference), I see that you also listed the two doors separately in your conditions rather than both in an "any" condition (which also shouldn't make a difference... but we'll see). I'll give that a spin when I get home.

I am able to reproduce this, so I'd say there is a bug somewhere in RM. Will investigate...

1 Like

OK. Found the bug, and indeed it has only to do with Periodic. Now fixed and will be in the next release.


So, question for you: Why do this only every 15 minutes? Why not just have a rule that fires when either garage door opens at night? I suppose one answer might be so that you can run the dog out or something, as long as you get it into the 15 minute window.

We have a rule that runs when our mode becomes Night that tells us if a garage door is open, This mode happens when we go to bed, or at some late hour.

Good questions, I'm totally open to better ideas!

The thought is that if the door is open for 15 minutes after dark, it's most likely because someone forgot to close it. Perhaps there's a better way to detect a forgotten open door?

Also, with 3 teenagers: 1) could happen multiple times after dark, so one check isn't adequate and 2) there's a higher likelihood of "someone" forgetting to close the garage. :wink:

It seems to me that if your garage door opens at 2:03 AM you'd like to know about it right then, not at 2:15. Also, if it opens at 2:03 and closes at 2:05, you won't know that happened (I've raised teenagers -- it's debatable whether you want to know all of their comings and goings or just sleep through some of it :open_mouth:). You could write a rule that notifies you only if it's been left open for x minutes, using a delay that cancels on truth change.

1 Like

Here's a simple rule I use to try to keep us from leaving the area without at least closing the back door! This will notify immediately when the rule is TRUE, so you could change the switch ON action to a delay before ON, pending cancellation. Change the repeat frequency to whatever you want, and then just create a virtual switch and a RM Trigger for speaking "Garage Door Open". That is what you will turn on every X minutes.

Just be sure to add the "Garage Door Open" switch to the action for False so that it will be turned off if the rule is False, otherwise it will keep repeating "Garage Door Open" until something turns off the switch!

Definitely some good ideas here. Thanks guys!

@SmartHomePrimer, if you are using the built in virtual switch, you can now have the delayed off set in the driver itself rather than RM (acts like a momentary switch that way).

1 Like

Thanks Stephan. I know about the delayed OFF. I asked @mike.maxwell to add it, and he kindly obliged. :smiley:

Sometimes I double-purpose a switch, so I've decided not to use the built-in delay off in that way for everything. I instead use it for a virtual switches that I need to be momentary, but I'm primarily triggering outside of RM, such as via Homebridge. Those are almost always single purpose switches, so for that I'm thankful not to have to create a separate rule any longer, in order to turn them OFF 1 second later. :crazy_face:

1 Like

I am trying to get my head around some of the more complex aspects of Rule Machine. Well, maybe it's not really complex but I sometimes have trouble comprehending!

So in your example, suppose I didn't want to use a switch...can I just announce "Back Door left open" in the actions for true? Will that repeat every minute until false? I am not completely understanding the "Repeat every minute" part of the rule.

I'm not aware of anyway to make TTS repeat more than once, unless I trigger a switch repeatedly that speaks the phrase I want. If you don't want it to repeat a phrase every x amount of time, then no virtual switch and RM trigger is needed. I've chosen to repeat every minute in this case, because I'm hoping we will see the notification (I'm using IFTTT so I don't have the fancy stuff) before we drive really far from the house. One notification might easily be missed in the car.

I would also have thought that if the rule was False, it would stop repeating the action in my example, but it doesn't. Needs the switch set to OFF when the rule is False, or just keeps on, keeping on! :wink:

1 Like

Whoa, you are making this much more complicated that it needs to be!

  1. It is possible to repeat anything, including a spoken notification or Pushover notification

  2. You can stop repetitions using the Stop Actions action -- so that could be in the False part of a rule that starts a repetition.

  3. If you use Pushover, you can send an "emergency" notification with "[E] door left open". That will repeat until you acknowledge it.

1 Like

Correct. I'm not sure why I had that temporary lapse of reason. I in fact do repeat spoken phrases in other rules. Sorry for the misinformation @denise.grider

I use that one too in a triggered rule. Forgot to mention it. I'm not clear as to why even a rule that becomes False does not stop a repetition when that is part of the action for True. Is it a separate process that starts outside of RM and must be killed?

I know Pushover has cool features. I'll cave someday probably. For now, it's a personal choice not to use it.

What I think would really help me with regards to Rule Machine and its capabilities, is a place where there were a lot of examples of "If you want to do this"...when I read through the Rule Machine intro and instructions, my eyes start to glaze over. I must be getting old :wink:


Stopping repetition on truth change is an option for rules. But not for triggered rules, as there is no such thing as truth change per se.