Door knock rule?

Does anyone have a reliable door knock rule?
I had one in WebCore that only alerted if the door had been closed for x seconds/minutes AND the door sensor detected acceleration AND the door contact sensor remained closed for 3 seconds. Once matched, the rule would speak "Someone knocked on the xxxxx door".

I'm close with rule machine but get a lot of false positives from what I think is the door lock causing acceleration and not having (or finding) the ability to only trigger if the door has been in a closed state for x seconds/minutes prior to the rule triggering.


EDIT 4/1/2019 - See Post #12 for the full ruleset.

I suggest to change the rule to a trigger.

Bear with me here as I'm still trying to learn the nuances of RM. Could you set this up in two parts?
First part would be a trigger:
Trigger-> Either door closes
Actions-> Delay X secs/mins, Run Door Knocker rule

Wouldn't that trigger every time there was acceleration? Door opening, closing as well as someone knocking?

I'm testing the following (3 RM rules/triggers).
I created a virtual switch called Virtual-AllowDoorKnock.
I've created a RM trigger that when any of the target doors close, wait x seconds and then turn ON the virtual switch. I've configured a RM trigger that when any of the target doors open, turn off the virtual switch immediately. I've configured my door knocker rule above to use this virtual switch as a way to disable/enable the rule.

So far so good, but took 3 RM rules to convert 1 WebCore piston. I'm sure there is probably a better way than what I'm doing.

1 Like

My original thought was using the virtual switch. As I get more comfortable, my goal is to see if I can streamline. Glad you figured it out!

I'm not aware of any way to delay the evaluation of a rule truth and perform an action based on that evaluation in a single rule, you can only delay the actions. But if you create a rule that locks the door (or evaluates the state of the lock) and then delays before evaluating your Door Knocker rule, that should do what you need with just two rules.

[EDIT] Thinking this through a bit more. If you did what I suggested before, and the cause of the false alarms was indeed the door lock, then the Door Knocker rule would still be evaluated when both doors were closed and any of the accelerometers detected vibration. What you would need to do instead is make the lock condition [locked] part of the Door Knocker conditions.

However, there's still a possibility that the lock might indicate a locked condition before the mechanism finished its movement. So if that still caused false alarms, you could add either a virtual switch or set a private boolean of the Door Knocker rule as the action to in "Door is locked" rule, and then add either ON or True, respectively to the conditions of the Door Knocker rule.

Just curious about your use case. Why do both the Kitchen and the Front doors have to be closed for the rule to be true?

1 Like

I've been trying to get this to work and was getting many false positives when opening and closing the door. With your method it works perfectly. As you said though, this could be done with 1 webcore Piston...but at least we've got it working here lol.

1 Like

For every WebCoRE piston you turn in... I'll give you 10 Rules. :smiley:


I'm lazy and didn't want to write this rule for each door along with a global var for each (virtual-AllowFrontDoorKnock, virtual-AllowKitchenDoorKnock). If I have one of the two doors open, likely, Someone in my family is standing at it and can see if someone is at my home. That will not work for everyone.

1 Like

Honestly, this is a common desire/use/request for contact sensor's with accelerometer on doors. Perhaps @bravenel can come up with something better than I have written on the backend and include it built-in in a future version of Rule Machine (Door Knock Detection trigger).

Below are the 2 full rules that I am using for Door Knock detection. These are working well for me.

1 Like

And then there was 2...LOL

Great work bro!

1 Like

This is a simple rule and works hands down every time with no false alerts unless you unlock the door (which causes vibrations) and do not open it within 3 seconds, but you can always adjust that. Take note that the "dumb doorbell switch" is just a virtual switch that does nothing and is just there for the rule to take some kind of action instead of just leaving it blank.

So pleased this thread was here, saved me a ton of time trying to work out how to do this with a Smartthings multipurpose sensor.

I’ve still not delved into RM, so took the hint and created a WC piston. Having a notification of someone knocking the door is a game changer for me, as I rarely hear the knock (hence having a very loud doorbell that is rarely used).

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