Limit # of activations within a certain period of time?

I am creating a rule to control my doorbell. Door bell is just a single button Zigbee device. Essentially, a rule called "Doorbell Activator" was created for this purpose. You press the button and it plays chime on Google/Nest Mini Speakers. I added a required expression to limit the times of day that this rule is activated so that the chime wont play at silly times like 2AM. So far, easy.

What I'd like to do next is put a limit on how many times pressing the button will sound the chime before the rule is disabled for a pre-defined period of time. For example, how could I create a condition or expression with the effect of: "if this button is pressed more than 3 times in any given 30 second period, disable the rule for 5 minutes."

Is something like this possible?

Untested, but you should be able to do something like this. Create a hub variable...let's call it "doorbell_count" of type number.

Create your first rule to keep count.

Trigger: Doorbell pushed
Action:
Set doorbell_count+1
Wait for event: 30 seconds
Set doorbell_count to 0

Create a second rule to disable your main doorbell rule:

Trigger: Doorbell_count = 3
Action:
Pause main doorbell rule
Wait for event: 5 minutes
Resume main doorbell rule
2 Likes

Nice!

Or, the OP could use the count of doorbell presses as a prerequisite condition on the main rule.

Always nice to have options. :sunglasses:

2 Likes

Good point.

@a.mcdear you could also skip the second rule and set your main doorbell rule to have a required expression (there's a toggle to enable this). Then you would set the required expression to:

doorbell_count < 3
2 Likes

Excellent suggestions! I will give them a try, thanks!

1 Like

@anon47916022 @ogiewon

Thanks for the suggestions. I was able to make this work exactly as intended using both of your ideas. Thank you!

5 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.