Door lock and unlock based on authorized user proximity

home-automationlockSecurity

I want to install an electronic lock on my office/workshop that only a specific individual(s) can unlock. I want it to lock every time the door is closed and the room is empty but I do not want to have to use a key or pin code every time I open it.

So I am thinking of designing a system that detects close proximity to the door for authorized users, and unlocks it. Allowing authorized users to walk up and open the door. The system would also need to know when an authorized user was actually in the room, and keep the door unlocked until they leave. This should be manageable with motion sensors and computer terminal usage (registering that someone is using the computer equals someone is in the room).

What kind of solution would be necessary to accomplish this?

Best Answer

I never implemented something like this but I did implement something similar with other uses. I also asked a question here for automating parts of the home based on user that entered. It can be implemented using OpenHab with the NetworkHealth binding : https://github.com/openhab/openhab/wiki/Network-Health-Binding.

There is no need to issue different hardware tokens for each users but rather have them always keep their mobile phone's WiFi on. You must know the IP their phone has in the network so as to store them in OpenHab like this:

Switch Phone_WIFI   "Phone 1"   (Status, Network)   { nh="192.168.1.101" }
Switch Phone2_WIFI   "Phone 2"   (Status, Network)   { nh="192.168.1.102" }

More details for OpenHAB: the binding will check the connection status of a given device with it's IP Address, then you can use a rule such as :

rule "Allowed user home - Unlock Door"
when
    Item Phone_WIFI received update ON
then
    // turn on all lights
    postUpdate(Door_lock, OFF)

end

and a similar code for when they leave the proximity range for

Item Phone_WIFI received update OFF

I have not tested the received update OFF code as of yet and not 100% sure it works. Also be aware as proximity and range is an issue because with several different methods (bluetooth or WiFi) the range might be longer or shorter than what you desire so router placement or bluetooth device must be very correctly placed so as the door does not unlock while you are still entering the driveway (unless that is not a problem for you).