Door lock

2020-07-29

Contact sensors are useful for reporting when doors and windows are opened or closed, but depending on the size of your living space it is often easier just to look in the general direction of the door or window. Case closed. (Or open). However, they can still be useful for identifying if a door or window is locked or unlocked, which is much more valuable when leaving the house or heading to bed.

Xiaomi's Mijia contact sensors are compact and power efficient, so I've been finding more opportunities to use them recently. This project involves using the contact sensor to detect the "locked" and "unlocked" states based on the rotation of the thumb turn of the lock.

In Action

The contact sensor is toggled when the magnet rotates around the thumb turn.

Components

The small part of the contact sensor just contains a cylindrical magnet which, once removed from its original case, fits snugly into the base of the lock mount. An important failsafe of this design is that the contact sensor only registers the door as "locked" when the magnet is nearby, so if the thumb turn mount fails or is removed, the contact sensor will register the door as being "unlocked". I can use this lock state to create Home Assistant automations to alert me

This article is part of the Home automation set.


Feedback? Questions? Email me