Your Home Knows You're Home

by Gordon Meyer

I'm often looking for ways to improve my home automation system. A few days ago, a post at Hackszine drew my attention to Jesse David Hollington's article on Bluetooth Proximity Detection on Mac OS X. And more recently, Bruce Stewart wondered how else proximity detection might be used, with Jeff Harrell's comment about the problematic range of Bluetooth, approximately 40 feet, echoing the problems I've had in trying to incorporate Bluetooth into my home automation system.

I quickly learned that using Bluetooth to determine if I am at home (as inferred by the presence of my cell phone) was simply not going work to my satisfaction. The problem was that if I wandered too far from my home office, yet still within my home, the Bluetooth connection would drop and my automation system would decide that I'd left. That's not such a big deal if all this does is activate your password-protected screen saver; it's a different story when it causes your home to completely switch operating modes.

Perhaps I should back up a little. One of the cornerstones of my home's automation is that it behaves differently depending upon who is at home. For example, if someone is home at sunset, inside lights are turned on for them. If the house is empty at sunset, a different set of lights, and the porch light, are turned on instead.

During the middle of the night, if the system detects that someone is walking in the upstairs hallway, the lights in the kitchen are turned on very low, if that's the direction they're heading. However, if nobody is at home, and there's motion upstairs, the house goes into full "intruder alert" mode!

This sort of thing isn't hard to set up, and it starts to put the smart in "Smart Home," but it only works correctly if the information about who is currently at home is trustworthy. Yes, it's "garbage in, garbage out" all over again. I concluded that Bluetooth proximity detection, used for this purpose, would mostly result in "garbage in."

But after finding out about the intriguing Home Zone application, I was willing to try it again, and this time I had a new idea. Instead of using Bluetooth to figure out if I have departed, I would use it only for determining that I have arrived.

I guess it seems obvious in retrospect, but this realization made all the difference for me. I've been playing with the idea for a few days now, and I'm quite pleased so far.

When I leave the house I press a button, located near the front door, that tells the automation system that I'm departing. This is similar to turning on an alarm system and is an easy habit to get into. (In fact, if I'm the last person to leave, it does turn on the alarm system. For full details on how all this works, see "Hack #70-Know Who's Home" in Smart Home Hacks.)

Normally, when I arrive home I press the button again so the system knows I'm back. Now, I can eliminate that step by using Home Zone (or Salling Clicker , or Proximity, et al). This is accomplished by having the monitoring software execute the following AppleScript when my phone's Bluetooth signal is detected.

tell application "XTension"

if (status of "Gordon Home") is false then

turnon "Gordon Home"

end if

end tell

This script works by asking XTension, one of the home automation software programs I use, if it believes that I am currently at home. (Represented by the variable "Gordon Home.") If XTension already knows that I am home, the Bluetooth detection event has offered no new information, so it is ignored.

However, if XTension believes that I am gone, the detection of my phone's Bluetooth signal is significant, so the variable that tracks my presence is changed. (Which causes other things to happen, depending upon the time of day and other conditions.) When I first got this working it was an almost magical moment; shortly after walking in the front door I heard my computer announce that I had missed four telephone calls while I was gone, and the lights in the entryway turned on by themselves.

For me, the key to successfully using Bluetooth to detect presence, for home automation purposes, is to track only the first appearance of a device, and even then, only in specific contexts. Inferring meaning from the lack of a Bluetooth signal is difficult; there are many reasons why a signal could vanish. But, the arrival of a new Bluetooth device is unlikely to be spurious, and it gives you concrete, actionable information that is easily incorporated into home automation routines.


2007-03-24 07:46:52
Why are you trying to use Bluetooth for home automation purposes, when there is a wireless technology DESIGNED for such uses? I'm referring to Zigbee , a low-power low-cost technology designed to be used for sensing and control applications.

Bluetooth, on the other hand, is designed to replace the wires that connect gadgets together, such as headsets and personal audio devices, or mice and computers. It is not intended to operate over other than short distances, and is in fact designed NOT to have a range of more than a few meters.

A reasonable way to use Bluetooth to detect whether you are at home or not is to place Bluetooth sensors on all your doorways, and use Zigbee to relay the data received to a central computing facility. A better way is to inject yourself with an RFID chip and track yourself that way.

Gordon Meyer
2007-03-24 08:31:40
Hi, "Constantnormal," thanks for your comment. Yes, I'm quite familiar with ZigBee. Unfortunately, it's not really within reach of home automators; but it's something to consider for commercial applications.

I think there are two points that might not have been clear, however. First, this is all about adapting technology you already have to do new things. Going out and buying specialized, dedicated sensors is an entirely different approach, and a valid one, but not an apt comparison. Secondly, while ZigBee devices do have a better range, thanks to their mesh networking, a longer range can actually be more problematic for some applications. See the comments on Bruce's post that I referred to above.

Greg Smith
2007-03-24 13:00:19
I tried using Bluetooth proximity detecting with Sailing Clicker many years ago and it didn't work out well fore me. It was really annoying when bluetooth would deplete the battery in my phone, causing the house to do things I didn't want it to do.

I instead define "main entry points" and use door sensors. If a door closes and it's a main entry point, and no interior motion detector fires in a minute, then I must be away. I have some additional logic in place to determine if someone is in bed asleep and for security, those I won't reveal here.

Gordon Meyer
2007-03-24 18:25:30
Hi, Greg, good to see you around these parts. I think your technique is great, and I'd use it myself, but I want to know _who_ is at home, not just that _someone_ is home. One nice advantage of your method is that there's nothing to remember, it all just happens automatically.