Blog › Access

Presence detection: the hardest problem in home automation

Nearly every disappointing smart home experience traces back to this. Understanding why it is hard makes it possible to build something that works.

Presence detection: the hardest problem in home automation

Knowing who is home sounds like it should be simple and it is the hardest problem in home automation. Nearly every disappointing smart home experience — heating that comes on late, lights that switch off while you are in the room, an alarm that arms with someone inside — traces back to presence detection being harder than the marketing suggests.

Understanding why makes it possible to build something that works.

Three different questions

People say “presence detection” and mean one of three quite different things, needing different techniques.

Is anyone in the house? The easiest, and enough for heating, security arming and away mode.

Is anyone in this room? Needed for lighting, room heating and media. Different sensors entirely.

Which specific people are here? The hardest, and required for anything personalised.

A great deal of frustration comes from trying to answer the third question with tools suited to the first. Be clear which you need, because the second is often enough.

Why phone-based detection disappoints

Geofencing — using a phone's location to decide whether someone is home — is the default approach and it fails in ways that are structural rather than fixable.

Battery optimisation. Phone operating systems aggressively limit background location to save power, so updates arrive late or not at all. This is by design and it gets stricter with each release.

Location accuracy. A phone indoors relies on Wi-Fi and cell positioning rather than satellites, with errors of tens or hundreds of metres. A tight geofence around a small property produces false exits; a loose one triggers when you walk to the shop.

Arrival lag. Even working correctly, you cross the boundary at your gate. Heating a house takes an hour, so arrival-triggered heating is always late.

Dead or absent phones. A flat battery reads as absence. A child without a phone is invisible. A guest is invisible.

The last-person problem. Deciding a house is empty requires every tracked person to be away, so one unreliable phone breaks the whole thing.

Geofencing is useful as one signal among several. As the sole basis for anything important it will let you down.

Signals that work better

Wi-Fi association. Whether a device is connected to your access point is a reliable, local, instant indicator of being physically in the house. It costs nothing, needs no app, and it is our preferred primary signal. Caveats: phones may drop off briefly to save power, so add a grace period of a few minutes, and randomised MAC addresses can complicate device identification — usually solved by setting a fixed address for your own network.

Bluetooth presence. Room-level with several receivers, and short range makes it a genuine indicator of being inside. Battery impact and reliability vary.

Motion and door sensors together. Cheap, entirely local, and surprisingly powerful. Front door opening followed by interior motion means arrival; the same door followed by no motion means departure. Two sensors give a decent occupancy signal with no phones involved.

Presence radar. Millimetre-wave sensors detect a still person in a room, which is what passive infrared cannot do. The best answer to the room-level question, and the technology that finally solves the sitting-still problem.

Direct evidence of activity. A television on, a kettle drawing power, a bathroom fan running, a lock opened with a specific code. These are unambiguous and require nothing to be carried.

Bluetooth tags or fobs for people who do not carry phones, including children and older relatives.

Building something reliable: combine and be asymmetric

The key insight is that the cost of being wrong differs by direction, so the rules should not be symmetrical.

Deciding someone is home should be quick and generous. Any single positive signal — phone associated, door opened, motion, lock code — means present. False positives cost you a little heating.

Deciding the house is empty should be slow and demanding. Require several signals to agree, and a period of no activity. A false negative here arms an alarm with someone inside or shuts off heating with a person at home, which is far worse.

Practically: mark present instantly on any evidence, and mark away only after, say, twenty minutes of no motion anywhere, no devices associated, and the last door event being an exit.

Then use presence to suppress rather than initiate wherever there is lag. Heat on a schedule, and cancel it when the house is unexpectedly empty. That avoids the arrival-lag problem entirely, because the schedule has already done the slow work.

Room level, which is a different craft

Whole-house occupancy does not tell you which room, and room-level detection has its own rules.

Radar or presence sensors for rooms where people sit still. Living rooms, offices, reading corners. Passive infrared will decide these rooms are empty.

Passive infrared for transit spaces, where movement is the normal state.

Hold on activity, not just motion. A television playing, a computer in use, a games console on — all good reasons to consider a room occupied regardless of movement.

Combine with door state. A room whose door is closed and which had motion inside is probably still occupied.

Be generous with timeouts, and fade rather than snap, so being wrong is graceful.

The multi-person household problem

Most advice implicitly assumes one or two adults with phones. Real households are messier.

Children without phones need fobs, or you need to rely on non-personal signals.

Guests are invisible to any person-tracking scheme, so the house must behave sensibly for people it does not know about. This is the strongest argument for basing important behaviour on physical evidence rather than identity.

Working from home breaks schedules that assume the house is empty on weekdays, and it changes week to week.

Shift work and irregular hours break both schedules and learning algorithms.

Our general conclusion: base important decisions on evidence of activity rather than on who is where. Identity is a nice enhancement for personalised touches; it is a fragile foundation for heating and security.

Diagnosing your own presence problems

When presence misbehaves, the cause is usually identifiable from logs rather than guesswork.

Log every presence state change with a timestamp and the signal that caused it. A week of that data shows you which signal is unreliable, and it is frequently not the one you suspected.

Look for flapping — a person marked away and home repeatedly within minutes. That is almost always a phone dropping its Wi-Fi association to save power, and the fix is a grace period rather than a different tracker.

Look for stuck states. Someone permanently home because a rule never cleared, or permanently away because a device changed its network identity. These accumulate quietly and are worth checking every few months.

Test the empty-house decision deliberately. Leave the house, watch how long it takes to decide, and confirm nothing important fired too early. Then come back and check how quickly it noticed.

Ask the household. The person who is not building the system notices the failures you have stopped seeing, and their complaints are your best test data.

A configuration that works

  1. Wi-Fi association as the primary signal, with a few minutes of grace.
  2. Door and motion sensors for arrival and departure inference, entirely local.
  3. Presence radar in rooms where people sit still.
  4. Device activity — television, kettle, computer — as occupancy evidence.
  5. Fobs for anyone without a phone.
  6. Instant to present, slow to away, requiring several agreeing signals for empty.
  7. Presence suppresses rather than initiates anything with lag.
  8. A manual away switch by the door, because sometimes you just want to tell it.

Item eight is the one experienced builders add and beginners omit. Perfect automatic detection is unattainable, and a physical button that says “we are out” is more reliable than any amount of inference.

Further reading