Doorbell press triggers rule - then count additional presses once in rule w/o retrigger - How to do?

I'm looking for some capability in RM that I'm probably unfamiliar with.

Have a non-smart button wired/hacked into a contact which triggers a rule once depressed.

While STAYING IN THAT RULE (for say 90 seconds) I want to watch for subsequent depressions (triggering or closing of that contact) in order to increase a counter (to measure pressers urgency, tenaciousness, or testing the house when not home) before exiting the rule.

Rule is currently protected from re-triggering by a Private Boolean so that multiple rapid triggers don't prompt the initial announcement & notification actions.

Basically, I wanna monitor/poll a simple contact device for a close event while in a rule.

Thanks in advance for any ideas/pointers/suggestions.

I guess a variable could be used. First press sets it to 1, subsequent presses add 1, action before private boolean being set back to true would be to set the variable back to 0. As you're using a private boolean, it'll probably need a second rule triggered off the doorbell press and a hub variable.

Thanks.

I guess I was trying to avoid a second rule but coming at this fresh this morning it dawned on me....

""
Wait for Events allows you to specify one or more events and cause the rule to effectively pause action execution at this point.
""

This will get me there with some Conditional framework. Forgot about it, or maybe I wasn't looking at the options this way.

Try something like this.

YES !!!!! I was just headed that way. Thanks.

So just sharing the stage I'm at trying to wait, count, re-wait, count, stop.

The damn Repeat command has every complicating control option besides the one I'd like...been mentioned by others before.

And yeah, I should probably be grabbing a time stamp and decrementing the timeout_sec according to the clock. But it's too complicated already. I'm still looking at this, I know I'm probably messing up the monitoring somehow in the Repeat's time slices and my timeout decrement.


// Set desired timeout_sec wait for more presses.
Set timeout_sec to 90
Set decremented_timeout_sec to timeout_sec(90)
Set timeout_trigger to '%device%(Doorbell - Button - Frontdoor )'

// Start polling for more. The design of the Repeat command isn't on my wavelength.
While (Variable decremented_timeout_sec(90) is > 0(T) [TRUE]) Repeat 1 times every 0:00:10 (stoppable)
Wait for event: Doorbell - Button - Frontdoor contact is closed
--> timeout: decremented_timeout_sec(0:01:30)
// Bust out of Repeat if timeout is up using feature I didn't know existed, checking for 'timeout'
IF (Variable timeout_trigger(nothing) is = 'timeout' FALSE) Stop Repeating Actions
Add 1 to press_count
Add -10 to decremented_timeout_sec
END-REP

I do think that you will ever succeed using repeat.

The wait time can be a variable.

You just need to keep track of the time (in seconds) and decrement the variable.

@PunchCardPgmr Assuming 90sec window, try next post.

@PunchCardPgmr forgot last line

Man THANKS for doing the heavy lifting with the time/clock aspects.

Even tho I figured that would probably be the RIGHT thing to do, I had been avoiding going there because I am not familiar enough with it.

Let me work that into what I've got. Much appreciated.

When I tested it with a smaller time, 9 sec, I found a bug.

I think this works. :innocent:

Thanks for your time and ideas today. Diving into the time/clock stuff was helpful.

So here's what I ended up with. I didn't follow your lead as much as I probably should have since I kept the Repeat in there. I'm not ever happy with the settings I use on that damn command. It always seems like I'm just setting it to loop "enough" and yet provide a safe Exit if I error somehow. Otherwise I'm just setting it in motion and controlling Exits my way. Amateur Hour.

Posting to show you where I was heading with this and for others that might come along with a similar objective with their doorbells. OF course it's not refined/finished. Nothing ever is :wink: