Presence (Occupancy) Detection: Different Approach Using Smart Door Locks

I have been reading some posts about how to setup presence detection in a smart home environment and I always feel like the alternatives are insufficient.

Most approaches refer to the use of a set of triggers in order to identify whether someone is home or not. These triggers usually fall into 3 categories:

  1. Motion sensors (including cameras)
  2. Manual actions done by a user on the system, in a pre-defined time, such as turning on a light in the last 5 minutes.
  3. Personal mobile devices connected to the Wi-Fi router.

However, even when combined, I believe this approach has some deficiencies, such as:

  • When the inhabitant(s) don’t move for a while (reading? Sleeping?).
  • When the movement is outside the range of the sensors.
  • When devices get disconnected from the network (airplane mode at night? Out of battery?).

I’ve been thinking that the question “Is there someone home?” (Regardless of whom) can be more accurately answered by using connected door locks.

It would work as follows:

  • IF lock is manually engaged directly on the lock’s keypad (should be done by the last person to leave the house)THEN Occupancy turns OFF.
  • IF Occupancy is OFF AND lock is disengaged in any way THEN Occupancy turns ON
  • IF Occupancy is ON AND lock is engaged from the inside, automatically or digital medium: No change (Occupancy stays ON)

Requirements:

  • The lock has a way to be manually engaged from outside.
  • The lock can provide detailed information to OH on the way in which it was engaged/disengaged (manual outside, manual inside, app)
  • Lock should only be manually engaged by the last person to leave the house

It’s far simpler than creating a rule to take into account all the sensors and items, the time when they were last activated or active, etc.

I’m aware this approach can’t answer the question “Who’s home?”, but the alternatives are not that accurate either.

I don’t currently own a connected lock, so I don’t know if it’s possible to know whether it was locked or unlocked using the passcode/keypad or not. As I think this would be needed in order for this method to work.

I tried to find the answers in the documentation of the Zwave binding, but since it’s general for all kind of Zwave devices, I didn’t find it.

I wonder what do those who have implemented some sort of presence detection think about this approach.

Related posts:

https://community.openhab.org/t/generic-presence-detection/

https://community.openhab.org/t/presence-tutorial-my-implementation/

One minor correction. The Z-Wave binding currently supports security but not S2 security. S2 devices fail back to the lower security though.

The binding is currently being rewritten and will possibly get officially certified.

I own a Zwave connected lock. Here is the relevant stuff it tells you for this.

  • locked state
  • which code was used to unlock (if any)
  • when the lock is opened or closed

I don’t think it will work.

  1. you don’t enter a code to lock it
  2. there is no difference in the events between turning the lock from inside to lock it, pressing the lock button outside, or the lock automatically closing
  3. the event for unlocking the door with the key and turning the knob from inside is the same

Given these I just don’t see how this can work. There is no way to tell the difference between the door being locked from the inside and locked from the outside. Therefore there is no way to tell that everyone is gone. Let’s say you receive a package. You unlock the door, open it, get the package, close the door and relock it.

The events would be

unlock -> open -> close -> lock

Now you are the last person to leave the house

unlock -> open -> close -> lock

You can’t tell the difference between getting a package and leaving the house using the lock alone.

You could use this with a wasp-in-the-box algorithm but you still need all those other sensors too. Presence detection is hard. There are no shortcuts.

2 Likes

You’re right @rlkoshak, this approach mainly requires the system to be able to identify whether the lock was engaged by an action physically performed on the external hardware (e.g., a button or code on the keypad), and users would need to get used to physically locking the door. I believe this could even remove the need for a separate alarm kit.

In this case, if someone is accepting a package and unlocks the deadbolt using the UI, it could be assumed that nobody is leaving the house.

Maybe even the case when the status of the presence item is OFF (home alone), disengaging the lock from the UI could mean there will be someone home.
Although the example of remotely opening the door for a delivery guy may complicate this scenario.

In my experience, that requirement means the idea is doomed to failure. Any approach that provides more than one way to do something to your users but only one way is the “right” way will not work, especially if the “right” way is more complicated/more work (e.g. using the UI) than the intuitive way (e.g. turning the knob).

Sure, you will remember to do it right, but if you tell your family or guests “no, you can’t just turn the knob, you have to use the UI to unlock the front door or the house will think you’ve left” has a dismally low WAF (I always hated that phrase, it’s sexist, but I don’t know of a replacement that conveys the same meaning, anyone have ideas?). This is actually a very important thing with home automation. One of the reasons why it has a low reputation (e.g. “why can’t you just flip the switch?”) is because of user interface approaches like this.

2 Likes

Humans are unquestionably the downfall of presence detection, because we are so bad at following rules (even ones we set for ourselves).

The question I have is, what do you want to accomplish with presence detection? If you just want to know when no one is home, then the simplest thing is for humans to activate an “Away Mode” when they know the house is empty. That takes all of the complexity out of the system and puts it on the humans. It’s no different than activating the alarm system, and places no limitations on the convenience of your smart lock.

Yeah, I hate that too. Maybe “Human interference factor”?

It depends on what you are trying to accomplish as Russ said. My presence detection is to turn the lights and tv on when I get home and turn them off when I leave. With a door contact on all the entry doors and motion sensors inside, it is pretty easy to know when someone is home.

2 Likes

That depends if the rules are build on our habbits or require us to change habitts. The second otpion is almost impossible for human beeings :smiley:

I think anyone can change their habits very easily if they are sufficiently motivated to do so. It’s only difficult when we don’t perceive significant benefits and/or consequences.

Regardless, my point wasn’t that we struggle with change, but that we struggle with repetition. There are lots of times where I’ve been instructed to do one thing and not another, but when the time comes I can’t remember which was which. That’s particularly the case when a lot of time elapses between instruction and action, or when I’m preoccupied with other thoughts.

1 Like

I know what you meant… My comment was meant as a small joke. And I agree with you.
Another problem is, what may seem to work for me in our house, maybe doesnt work for the rest of the family. But the rules cant tell the difference.

1 Like

Yet life is full of these situations. This is one of the reasons why we have rules. But I do see your point, making something harder will decrease the acceptance rate.
Nonetheless, I wouldn’t make them use the UI, I’d make them use a button on the keypad to lock the door when the last person leaves. That’s all. If you think about the alternative (not having a connected lock), people still have to lock the door when the last person leaves by using a key. The user experience is not that different; besides, it’s slightly improved: you don’t need to find your key, just go out and press the button.

Definitely agree.

What do I want to accomplish? To know when the home is inhabited or empty. Most of my rules are based on this concept and right now I do it manually myself (via the HABPanel) and asking my family to do it as well has always been out of the question as “humans” wouldn’t do it, because it complicates their lives, as @rlkoshak mentioned . But if I could make it work with a lock, they would be locking the door, which automatically would activate the Away Mode.

It can be coded in a “simple” but inaccurate way.

True.

Indeed. See https://en.wikipedia.org/wiki/Desire_path for what happens though when you set such rules but there is another easier way to do it. The concept applies to more than walking paths, it’s pretty universal. People are going to to what is most convenient or easiest to them regardless of your rules. This is human machine interface design 101 type stuff. And you will be presenting your users a less convenient harder way to lock the lock because you have to use the UI.

As I said above, at least with my model lock, the event that occurs when you press the lock button on the key pad is not different from the event when you lock it using a key, turn the knob, or the lock automatically locks. They would have to use the UI or you can’t tell the difference between someone locking if from the inside or from the outside. Without that distinction you can’t tell if someone left or not.

I understood this and it provided me with a path to further investigate. Maybe the information is already provided by the manufacturers but the current bindings don’t support it. Maybe only a few manufacturers provide it, or maybe none (most probably this is the status quo)

Assuming in the future (near or far) the lock provides a way to identify these events, do you foresee any additional issue? Do you still think it will generate friction for end-users?
From my side, I can see that remotely giving temporary access to a person will need more brainstorming.

This approach would work well for those with only one exterior door. It becomes more complex if you have multiple exterior doors, especially if there isn’t a smart lock on one of them.

Take me for instance. I have a front door and a back door both with smart deadbolts. But I also have a garage door which doesn’t have a smart deadbolt. We rely on the garage door opener for that security during the day and manually lock it at night. For us, needing to unlock the garage door every time we come home was not justified by the overall risk of someone trying to enter the house through the garage doors. We have sensors on the garage doors, camera in the garage, and two dogs. The inconvenience of the deadbolt isn’t justified. Trying to track presence using the locks alone would be nigh impossible.

So at best, this approach would only be feasible in very specific situations where all exterior doors are protected with a smart deadbolt. And the complexity of the algorithm goes up the more exterior doors you have.

1 Like

Okay, that helps me a lot. Your original post read broadly as “here’s an approach that fixes the flaws of other methods of presence detection”, which you may or may not have intended. However, the effectiveness of presence detection is very dependent on individual circumstances. As Rich noted, the number of entryways is a major factor.

Assuming that you only have one entryway, I’m interpreting that you’re looking for the following lock states:

  1. Locked by keypad (assumed to be “leaving the house”)
  2. Locked manually (assumed to be “staying in the house”)
  3. Unlocked by keypad or manually (meaning that someone is home)

My Schlage Connect lock sends different notifications based on manual or keypad locking/unlocking, so it will do this for you (assuming nothing has changed since I bought it a few years ago). The question now is, are there scenarios when someone will leave and lock the door while others are still home? I can think of a few:

  1. Someone leaves while occupants are sleeping, sick in bed, in the bath, etc.
  2. Someone leaves and doesn’t realize that others are still home
  3. Someone accidentally presses the button
  4. A child plays with the keypad
  5. A guest leaves and thinks they should lock the door

In the first two cases, you’re asking the humans to realize that they need to pull out their keys and manually lock the door instead of using the keypad. That’s your likely friction point, because you’re now asking for different behaviour that is inconvenient for users (particularly if they’re in a hurry). So now you need to determine how frequently this will happen in order to determine if the risk is acceptable. Some families are in the habit of always locking the door, while others leave their houses unlocked whenever someone’s home.

The only thing you can do for cases 3-5 is accept that they’ll probably happen every once in awhile. But if you want to manage/minimize the risk, you combine multiple inputs. Per wasp-in-a-box, it’s about confidence levels.

Every time your lock is triggered by keypad, you could have your rule wait a few minutes and then check if specific devices are still connected to WiFi. When you combine “locked by keypad” and “no devices on WiFi”, the confidence level is higher than for each of these individually. With each sensor you add, the confidence (and complexity) theoretically go up.

I live on my own in a single-entry condo, so presence detection is easy. I tell Google that I’m leaving, and OH pre-emptively unlocks my door while turning off the lights and TV. After five minutes (in case I forget something and have to come back inside) it goes into Away Mode. If the door is unlocked while Away Mode is on, the lights turn on automatically.

I could have OH detect when I’ve locked my door using the keypad (I do that 99.9% of the time), but I prefer to know that everything has been turned off before I leave the house. That’s just a personal comfort level. If/when I live with someone else again, I’ll likely change my approach.

I hope this helps! Here are a couple of threads that were very helpful for setting up my lock.


2 Likes

These are great news. That’s means it depends on the manufacturer.

I see cases 1 and 2 as rare exceptions, just like the other 3. Nonetheless, I expect that things like this will happen and obviously the system cannot be programmed to consider every possible scenario, but just the most common and impactful ones.

Thank you all very much for all the information and insight provided, specially to @rlkoshak and @rpwong

I wonder if there are other brand of locks that provide detailed event information, or if there are other people with connected locks that can tell us what event information do their lock provide.
@rlkoshak do you mind if I ask what’s the brand of the lock(s) you have?

It’s a Kwickset 910 I think.

Hello

This is a very nice conversation about the interest of home automation.

Thank you @rlkoshak and @rpwong to clarify the need of defining the needs, specifying the UI.
I have a long experience in industrial automation and I know that there is no universal way of thinking .
There are always compromise to be done between standardisation ( based on the mist common habits) and special needs…
Standardisation simplify the task for the programmer but make to UI more complex.
Hope automation has to be managed in the same way…
You have two options :
you decide alone how the UI will be done and the risk is that your automation is not working well
You try to find a compromise with different users… you validate the UI with the users …and you program an simple task that can help most users in most case…

There are always exceptions

I am quite new to openhab and I am just thinking about what I plan to manage with this system.
For now, I just have a domintell scenario triggered by a push button to turnnoff all lights when leaving the house.
I also need to activate the alarm before to leave…
I finally need to open and close the garage doors, same for the gate…

But one or two times per year, I forget to shutdown the light or even activate the alarm… is it really critical ?

I would just appreciate to receive a message on my phone when something strange and I can decide what to do …

This our usual practice in industrial control system… if some abnormal situation appear, just inform people and they will decide what to do in particular case…

I would appreciate that openhab just check if I leave home without activating the alarm and let me decide what to do…

Let’s take an example… if I am mowing the garden, does I really need to activate the alarm if nobody is at home at that time?

For me the home automation based on event with message seems nice but will be always limited because message are not flexible, you cannot personalize the message for your need, you have to follow the main use… and you depend on change by the supplier.
I prefer action based on sensor that check continuously the status.
We often have this case also in industrial automation, we then define clearly a state machine ( SFC chart) that will give keep in the machine memory the status based on detectors.
This can be applied to home automation also but this will only manage the normal case.
When abnormal situation appear … just inform human sothat they can decide what to do…
Most common case of abnormal situation is wrong use of UI and defect of sensors…
The more complex rule you define… the more risk you get that some strange action appears …
The more sensor you use in one sequence, the more risk on unavailability you get because of a sensor defect…
So my conclusion is this : keep it simple even we like the idea that this would be so nice…that every thing is done automatically without need to push button…

Another example…
I heat my house with a combination of wood burning, thermic solar panels, electricity…
The wood burning is quite cheep and nice but I need to put the wood in the boiler.
My automation task there is that the pump start automatically when the burner start to heat and stop when there is no energy to get from the boiler…
I am working for an oven company, most of our oven heat with gas burners… we use automated system to start the burner with flame and a lot of safety monitoring…
10 years ago, a colleague of mine installed a wood boiler at home and had the nice idea to use an automated igniter of his wood boiler by using a small automated pilot gas burner.
One year later, his house completely burned…

My conclusion: all automatic systems need a strong abnormality detection with reporting to human.

In an openHAB context you are the supplier. You can create the messages and make them as personalized or customized as desired. If you are using something like Telegram with the Telegram binding, I think you can even carry on a two way conversation with OH so, for example

openhab: DR_Pierre, you appear to be away and the kitchen light is on, shall I turn it off?
you: yes

openHAB then turns off the light.

Keeping things simple should always be a goal. But sometimes there is simply no way to achieve a requirement without more complexity. For example, I’m not convinced it is feasible for all but the simplest of cases to reliably determine presence using only the state of a dead bolt/door lock alone. It requires more sensors and complexity to achieve that.