MiguelRipoll23 / homebridge-securitysystem

Homebridge plugin that creates a security system accessory that can be triggered by HomeKit sensors.
https://www.npmjs.com/package/homebridge-securitysystem
MIT License
151 stars 13 forks source link

Double Knock #87

Closed ashpole closed 3 years ago

ashpole commented 3 years ago

Hi,

On other security systems I’ve used what I think is called Double Knock to cut down on false alarms: When a sensor triggers an alarm, the system waits a predefined number of seconds to see if it gets another sensor trigger (including the original one again) before considering it a definite alarm condition and sounding the bell/siren. If there’s no second trigger then the system reverts to waiting for another first trigger.

I don’t think your (excellent, by the way) Security System has this facility unless it’s hidden in the “siren_sensor” functionality?

Cheers,

Mike

MiguelRipoll23 commented 3 years ago

Hey there,

That’s a helpful feature indeed, I’d like to ask you some questions in order to implement it the best way.

Most HomeKit sensors allow you to set the amount of time that should pass for them to trigger again, in your case what’s the minimum time that is set?

How much time should pass to revert back to two triggers? Should it be editable by the user or it’s pretty much standard?

I did my little research on commercial security systems but I missed this kind of features that fit well under HomeKit limitations so I really appreciate these suggestions coming up.

ashpole commented 3 years ago

Hi,

Thank you for getting back to me, I really appreciate it.

Let me answer your second point first. This should be somewhere between a sensor’s cool down period (the minimum time before it can trigger again, as you say normally set by the manufacturer or a sensor’s design) and the maximum time you want to look for a real intruder to activate the same or a different sensor - the higher this figure, the more likely a faulty sensor will still trigger a false alarm.

In my experience, I’ve seen maximum times to look for a second sensor trigger between 1 and 5 minutes - it’s unlikely an intruder would not trigger a sensor twice within 1 to 2 minutes, so 1 to 5 minutes would be a good window for the user to be able to select, perhaps defaulting to 90 seconds. That said, the longer times are usually on systems where the first sensor CANNOT be used to confirm a second trigger; and shorter windows used on systems where the first sensor CAN be used for confirmation.

With regard to your first question, I don’t think you need worry about that - unless I’ve missed something.

Within your system I would envisage:

  1. Function as present;
  2. Checkbox enables Double Knock, defaults to 90 second window for ANY second trigger;
  3. Advance setting (or in Config file) to allow Double Knock window to be set between 60 and 300 seconds.

Old type intruder alarms used to have this facility but it became redundant on most systems with passive infra sensors because those manufacturers started to build it into the sensor. Therefore, when a sensor activated it was far more likely to be a true activation and not a bug or spider!

Does that all make sense? Please say if I’ve not explained something.

Mike

ashpole commented 3 years ago

I should have mentioned that I implemented a crude workaround!

I set up a dummy switch in Homebridge that turns off after 60 seconds of being turned on. When a sensor activates, a check is done on the dummy switch, if it’s off it is turned on; if it’s on then your security system is triggered!

Mike

MiguelRipoll23 commented 3 years ago

Thank you so much for the information.

There's an upcoming update that will introduce some minor under the hood improvements from a major TypeScript rewrite of the plugin that I'm working on in parallel, it will be available someday next week on the release channel.

I'll try to add this on the beta channel next weekend 🙂

ashpole commented 3 years ago

No problem, happy to be of help. I’m retired now so don’t get much chance to stretch my brain!

Looking forward to the beta.

MiguelRipoll23 commented 3 years ago

I just added this feature to a new beta update that you can install using the following command:

npm install -g homebridge-securitysystem@beta

The option is available under the Advanced Options > Sensors section but in the near future there will be a new section which would consist of basic features. Be free to submit any feedback during the beta phrase to improve the implementation if it doesn't fit your needs yet.

Thanks!

ashpole commented 3 years ago

That was quick, thank you.

I'm having a problem moving to the beta. I'm going into Homebridge, selecting Terminal, running npm install -g homebridge-securitysystem@beta and then restarting Homebridge.

When it restarts it's still at v3.7.0 latest.

What am I doing wrong?!?

Cheers,

Mike

MiguelRipoll23 commented 3 years ago

Are you using Homebridge or HOOBS?

ashpole commented 3 years ago

Homebridge.

On 20 Feb 2021, at 09:45, Miguel Ripoll notifications@github.com wrote:

Are you using Homebridge or HOOBS?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/87#issuecomment-782596594, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS3BWUHS6BVEFTJQMGYRCHLS76AB7ANCNFSM4XTEAF3A.

MiguelRipoll23 commented 3 years ago

Can you try again like this?

npm install -g --unsafe-perm homebridge-securitysystem@beta

ashpole commented 3 years ago

That didn’t fix it directly, but I have fixed it now by uninstalling the latest version and then loading the beta!

Thanks for your help.

Mike

On 20 Feb 2021, at 09:51, Miguel Ripoll notifications@github.com wrote:

Can you try again like this?

npm install -g --unsafe-perm homebridge-securitysystem@beta

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/87#issuecomment-782597449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS3BWUAZ7OEVNY6RRV6OA23S76A23ANCNFSM4XTEAF3A.

ashpole commented 3 years ago

Suggested change to description:

Requires the same sensor or other ones to be triggered twice within a time window.

"Requires any two sensors to be triggered within the time window to activate the siren."

Not sure about the last word (siren), needs to be the same as you use elsewhere for single sensor trigger.

Mike

On 20 Feb 2021, at 09:51, Miguel Ripoll notifications@github.com wrote:

Can you try again like this?

npm install -g --unsafe-perm homebridge-securitysystem@beta

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/87#issuecomment-782597449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS3BWUAZ7OEVNY6RRV6OA23S76A23ANCNFSM4XTEAF3A.

MiguelRipoll23 commented 3 years ago

Unfortunately HomeKit doesn't allow you to know which sensor triggered your accessory due to security, that's why I worded it like that.

It means that the same sensor could still trigger it again as we can't know the source.

ashpole commented 3 years ago

I've read my words again and don't like them! Your's are more accurate - I'll go back to sleep now ;)

ashpole commented 3 years ago

Testing so far:

When setting system to Away, single sensor activations are ignored if left to time out ie no double knock.

Double sensor activations within time window result in alarm being triggered correctly. But, I let the system revert to set mode, ie Away, it seems to require just a single sensor activation to trigger the alarm.

Also, the Siren switch seems “very sticky” and reluctant to turn off. When the system reverted to Away the Siren switch did not move to off; and even turning OFF the Security System left the Siren switch turned on.

MiguelRipoll23 commented 3 years ago

What do you mean by revert? Trying to set a mode and cancelling the mode change before it gets armed?

I will try to reproduce, thanks for the testing.

ashpole commented 3 years ago

Here’s some logs, I set Away, trigger the system with a double knock, it stays in Alarm until it resets, then I activate one sensor and the alarm goes off.

[2/20/2021, 11:48:47 AM] [Security system] Target mode (Away) [2/20/2021, 11:48:47 AM] [Security system] Sensor (Not armed) [2/20/2021, 11:48:52 AM] [Security system] Current mode (Away) [2/20/2021, 11:49:16 AM] [Security system] Sensor (Knock) [2/20/2021, 11:49:18 AM] [Security system] Sensor (Triggered) [2/20/2021, 11:49:28 AM] [Security system] Current mode (Triggered) [2/20/2021, 11:50:05 AM] [Security system] Sensor (Cancelled) [2/20/2021, 11:50:05 AM] [Security system] Target mode (Off) [2/20/2021, 11:50:05 AM] [Security system] Sensor (Knock) [2/20/2021, 11:50:05 AM] [Security system] Current mode (Off) [2/20/2021, 11:50:12 AM] [Security system] Target mode (Away) [2/20/2021, 11:50:17 AM] [Security system] Current mode (Away) [2/20/2021, 11:50:47 AM] [Security system] Sensor (Knock) [2/20/2021, 11:50:58 AM] [Security system] Sensor (Triggered) [2/20/2021, 11:51:08 AM] [Security system] Current mode (Triggered) [2/20/2021, 11:52:08 AM] [Security system] Sensor (Knock) [2/20/2021, 11:52:08 AM] [Security system] Current mode (Away) [2/20/2021, 11:52:27 AM] [Security system] Sensor (Triggered) [2/20/2021, 11:52:37 AM] [Security system] Current mode (Triggered) [2/20/2021, 11:53:37 AM] [Security system] Sensor (Knock) [2/20/2021, 11:53:37 AM] [Security system] Current mode (Away) [2/20/2021, 11:53:57 AM] [Security system] Sensor (Reset) [2/20/2021, 11:53:57 AM] [Security system] Target mode (Off) [2/20/2021, 11:53:57 AM] [Security system] Sensor (Knock) [2/20/2021, 11:53:57 AM] [Security system] Current mode (Off) [2/20/2021, 11:54:17 AM] [Security system] Sensor (Reset)

ashpole commented 3 years ago

What do you mean by revert? Trying to set a mode and cancelling the mode change before it gets armed?

I will try to reproduce, thanks for the testing.

Revert —> After “Reset Delay Minutes”

MiguelRipoll23 commented 3 years ago

Thank so much for the logs, can you try again with the latest beta?

ashpole commented 3 years ago

Will do, might have to be in the morning (UK).

📤 Sent from my iPad Pro

On 20 Feb 2021, at 5:13 pm, Miguel Ripoll notifications@github.com wrote:

 Thank so much for the logs, can you try again with the latest beta?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MiguelRipoll23 commented 3 years ago

I've moved some sections outside the advanced options section and added descriptions to clarify what they do, trying to improve the learning curve for new users 😛

ashpole commented 3 years ago

That’s always a good idea, and for old farts like me 😂 I’ve been busy so far today, I’ve got beta3 installed but not tested.

📤 Sent from my iPad Pro

On 21 Feb 2021, at 3:34 pm, Miguel Ripoll notifications@github.com wrote:

 I've moved some sections outside the advanced options section and added descriptions to clarify what they do, trying to improve the learning curve for new users 😛

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

beatpaul commented 3 years ago

Hi! Thanks for the great Plugin - especially the new double knock feature seams to be great. I have one more idea für for this feature: would it be possible to set it up separately for AWAY und NIGHT mode? The reason is, that e.g. for my -> night mode the Door Sensor is the only sensors (that will probably not be triggered twice by a thief :) -> no double knock for me) -> away mode there are more Sensors (Motion, Door, etc. -> so double knock is great)

Paul

ashpole commented 3 years ago

Double knock is used to help minimise false alarms. In the case of a home system, it might be considered acceptable to not have DK enabled during the Night as you’re there to react. So perhaps, at a system level, DK should be enabled in Away mode only.

I have internal door sensors and some motion sensors active at night so DK at Night works for me but I could live without it.

📤 Sent from my iPad Pro

On 21 Feb 2021, at 7:30 pm, Beatpaul notifications@github.com wrote:

 Hi! Thanks for the great Plugin - especially the new double knock feature seams to be great. I have one more idea für for this feature: would it be possible to set it up separately for AWAY und NIGHT mode? The reason is, that e.g. for my -> night mode the Door Sensor is the only sensors (that will probably not be triggered twice by a thief :) -> no double knock for me) -> away mode there are more Sensors (Motion, Door, etc. -> so double knock is great)

Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MiguelRipoll23 commented 3 years ago

You're right, I will deliver another beta update soon to only use double-knock if the Away mode is selected.

MiguelRipoll23 commented 3 years ago

Just published the new beta update, enjoy!

ashpole commented 3 years ago

Great, I will!

Thank you for all your hard work.

📤 Sent from my iPad Pro

On 22 Feb 2021, at 5:49 pm, Miguel Ripoll notifications@github.com wrote:

 Just published the new beta update, enjoy!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MiguelRipoll23 commented 3 years ago

It's now out of beta and live on the release channel, looks good.

ashpole commented 3 years ago

It does look good, I haven’t found any bugs in DK.

Again, thank you for your hard work and you’re fast too!

📤 Sent from my iPad Pro

On 23 Feb 2021, at 7:36 pm, Miguel Ripoll notifications@github.com wrote:

 It's now out of beta and live on the release channel, looks good.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.