DEV Community

Xingliao Smart Home
Xingliao Smart Home

Posted on

Why Your Smart Lock Cannot Tell You Whether the Door Is Actually Locked

Ask any smart lock what state it is in and you get one boolean back: locked or unlocked. Almost every installation discovers sooner or later that this single bit answers neither of the two questions a homeowner actually cares about.

Two independent facts, one bit

There are two separate physical facts at a door, and they are not the same fact:

  1. The bolt is thrown — the deadbolt has extended into the strike.

  2. The door is closed — the door leaf is seated in the frame.

"A locked door" only exists when both are true. A single reed switch or a single plunger reports one of them, and almost every product quietly reports whichever one was cheapest to fit.

The failure is not exotic. It is the Tuesday morning scenario: you extend the bolt to air out the room, walk away, and ten minutes later something pulls the door open. If the only sensor in the loop is reading bolt position, your dashboard still says "Locked." The bolt is indeed still thrown. It is thrown into empty air.

This is why the honest answer is three states, not two:

  • Locked (bolt thrown and door closed)

  • Unlocked and closed

  • Bolt thrown but door open — this is the one nobody implements, and it is precisely the case that means someone forgot to close the door

That third state is the entire point of the exercise. It is also the one you cannot derive from any single sensor, no matter how you calibrate it.

Why the magnet next to a steel bolt drifts

The tempting fix is a magnet on the bolt and a reed switch or Hall sensor in the strike plate. Do not put a magnet on, or immediately beside, a steel deadbolt.

Steel is a magnetic conductor. Put a magnet against it and you give the flux a low-reluctance path that does not go anywhere near your sensor. From the sensor's point of view the field strength drops, and worse, it drops unevenly depending on how far the bolt has travelled and how the latch has worn its groove in the strike.

The consequence people report as "it got flaky after a year or two" is rarely the sensor dying. It is this:

  • The bolt settles a fraction of a millimetre deeper into the strike as it wears in, changing the geometry

  • Temperature cycles change both magnet strength and the steel's permeability

  • Any nearby screw, strike plate or steel door frame re-routes some of the flux

So instead of a clean threshold you get a slowly wandering one. You compensate by widening the hysteresis, and then the thing starts missing genuine half-throw states. Hall-effect sensors have the same exposure — better resolution does not fix a field that is being shunted.

What survives: mechanical contact with supervision

If you want a signal that is still honest in five years, sense the bolt mechanically.

  • Use a plunger microswitch rated for overtravel. The bolt must push the actuator past its operating point and keep going. A switch that bottoms out will be destroyed by the bolt, or destroy itself trying to stop it.

  • Debounce in software, 100-200 ms. A deadbolt driven by a motor arrives with a bang. Anything faster than that and you log three transitions where there was one.

  • Wire it normally-closed with an end-of-line resistor. This is the part that actually matters for safety. A supervised loop fails to "not locked" when a wire breaks, a connector pulls out, or someone cuts it. Fail-open wiring — normally-open, no supervision — fails to "locked," which is the one answer you must never get by accident.

If you want door-closed sensing at the same time, a separate contact in the frame or a small magnet in the wooden/polymer door leaf away from any steel works fine. Just keep the two inputs separate in software and AND them explicitly rather than trying to find one magical sensor that answers both.

A note on retrofit kits

Retrofit position sensors that ride on the thumbturn inside the house have their own compromise: they read the thumbturn angle, not the bolt. Most of the time those are the same thing. When the mechanism binds, or when someone uses a key from outside, or when the tailpiece slips, they are not — and the device will confidently report "locked" with the bolt parked halfway out.

None of this is an argument against smart locks. It is an argument for treating "locked" as derived from two independent, supervised inputs, and for being suspicious of any product whose app cannot show you the difference between a thrown bolt and a closed door.

I work on the manufacturing side of this category, so I am biased toward the boring mechanical solution. But the boring one is the one that still reads correctly after the novelty wears off.

If you are weighing architectures, the trade-offs of mechanical versus magnetic sensing come up in the same way across every smart door lock we build, and the supervision wiring is not negotiable in any of them.


Xingliao Smart Home builds smart switches, video doorbells and security cameras on Tuya WiFi and Tuya ZigBee, and runs OEM/ODM programmes from Shenzhen. Factory and ODM capability.

Top comments (0)