RM Example - Rule Machine, run once then stop for a period of time

I have a contact sensor on my mailbox but it usually runs 2 or 3 times when the mail lady swings by. When she opens it then when she closes it ... it seems to always fire twice - understandable.

What I want to do is have it fire once and then not fire again no matter what happens for 2 minutes then enable it again.

Is something like that possible?

May have answered my own question - here is what I am setting up - let me know if this sounds like the best way to accomplish this:

  1. Setup a Virtual Switch called Mailbox Switch
  2. Setup RM Rule to do the following

1 Like

That should work. Alternatively, you could go without the virtual switch by using two RM apps with private Boolean, or use custom monitoring in HSM with the alert once every xx days/minutes option too. More than one way skin a cat mailbox.

If you want your Rule Machine trigger to only fire once in a set period, go to the Trigger's "Select Actions" then "Set Rule Boolean, Run Rules, Run Actions, Stop Actions, Pause Rules, Resume Rules". There set "Set Private Boolean True for these rules" to "This Rule" and set "Set after a delay?" to 1, or however many minutes you want; and set "Set Private Boolean False for these rules" to "This Rule".

I found this method the simplest, as it doesn't require creating any extra rules.

3 Likes

I experienced the same issue and this what I did. Plus my neighbor was interested in getting a text too when mail arrived and I didn’t want him to get multiple. Our deliveries have been so sporadic in the last year we grew tired of checking for mail :joy:

Here is how I solved it:


Triggered rule when the mailbox contact opens. First it sends me a pushover message and also sets the rule private Boolean of the rule to false. You also need to set the private Boolean restriction too.

I didn’t want another alert to go out when my family got the mail or if I put something in the mailbox in the morning. So I setup a periodic trigger to run at 9 AM to reset the private Boolean. This time works for me since mail is never delivered this early but adjust to your schedule. Idea is mail comes at 6 PM and no alerts will happen until 9 AM the next day so between those times my family can get mail and add outgoing mail, between those times with no alerts.

@ElectronicFur

Does this look correct?

I would define it as a Trigger rather than a Rule.

I'm not sure that a rule with PB false can reset itself to true...might need to do that part in a different rule. Also make sure you have PB restriction enabled.

Final update - works like a charm (Enabled Private Boolean "PB") as well.

It can. A Trigger can set its Public Boolean to False, and set its Public Boolean to True with a delay. I have triggers running like that, to ensure they are disabled for a minute after being called. I use it for my door bells, so that if someone pulls/pushes them several times, I don't get multiple notifications.

1 Like

It's still more complicated than you need. You don't need a Triggered Rule, you only need a Trigger. The Trigger Events would be the same, there would be no Conditions or Rule, and your Actions would be the same.

Can you expand on that a bit ..

Nevermind @bravenel I think this is what you're talking about:

2 Likes

Yes, that will do it.

Starting to learn this stuff and what it all means ... feel like I'm starting to "control" some stuff ...

Thanks!! Hopefully others will learn along the way.

2 Likes

Doing the trigger, will the delayed action be canceled when the private boolean gets set to false? Or does the schedule persist even if the rule is disabled by private boolean?

The rule with False/True definitely wouldn't work since the false part wouldn't fire since the rule is disabled by private boolean.

No, the delayed setting of Private Boolean is not cancelled by the trigger being disabled by PB. That wouldn't make sense, as it could never be re-enabled.

@bravenel As a change request, I think it would be more flexible if the delay could be specified in seconds rather than minutes. Eg for some things I would prefer a shorter delay than 1 minute.

But it would be if you put the re-enable in the false part of a rule, right?

Yes, I agree. It's on the list.

2 Likes