Door knock rule?


#1

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.

image

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


#2

I suggest to change the rule to a trigger.


#3

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


#4

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


#5

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.


#6

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!


#7

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?


#8

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.


#9

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


#10

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.


#11

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).


#12

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


#13

And then there was 2...LOL

Great work bro!