Presence detection on zone level

I’m new to home automation. What I’ve done barely scratches the surface, but was sufficient for my old home. I had a Nest thermostat and used Skylark to toggle away mode w/ Geofencing. Lights were not an issue because in a small one-story home any lights left on could be seen from the bedroom. Just needed to get up and turn them off.

I moved into a two-story home and I got a second Nest to separate upstairs and downstairs. And it’s becoming obvious my old plan isn’t enough. Specifically:

  • Lights left on upstairs or downstairs is not obvious. I don’t want to leave lights on in rooms with nobody in them.
  • Even with geofencing the Nest, heating/cooling both upstairs/downstairs wastes energy. And with more square footage, that cost adds up more, despite better insulation in the newer house.

My goal is to be able to track my wife and I in the house and automatically turn things off in zones with no people in them. I have cats, so I need to be able to exclude them.

My plan is to have some sort of motion / trip sensor at the top and bottom of the stairs. I would like to use them in conjunction to track how many people are in each zone. So A->B means a person went from upstairs to downstairs while B->A means downstairs to upstairs. And then geofencing would take precedence.

I don’t need to turn lights on when someone enters a room. Just want to turn off things off when they are no longer needed.

Would something like this be possible to do? Would I be able to prevent a cat from being picked up from a motion sensor? Is there any laser trip sensors that could be used indoors?

Look into Zone Motion Manager to start. Works great for this, I zone my house using aggregation.

Really hard to exclude the cats though. I use Pet Immune PIR motions where I can. Still hard.

Welcome! :sunglasses: There are several different issues involved here. The general concept is called “microlocation” or “micropresence,” that is detecting people in a smaller zone than is normally detected by GPS.

First issues

You run into a couple of issues very quickly. The first is that with the exception of PIR motion sensors, most devices that detect presence use protocols that go through walls. That makes it very difficult to define a “room.” But if you’re only using PIR motion sensors, you’re fine, because they don’t detect through walls.

The next issue is if you want to know who is in the room, that is if it makes a difference if it’s Michael or Susan. Using current technologies, those require that each person carry an identifier device with them, which is usually fine for office buildings but not so much at home. It doesn’t sound like you need this for your specific use case.

And the third issue is one that you mentioned, if you want to know the direction the person is going from one zone to another. That’s a lot harder than just knowing if there is motion in a particular zone.


As far as cats go, if you are using PIR motion sensors about the only thing you can do with certainty is to move the sensor higher up on the wall and mask the lens so that it detects in a narrower beam. There are community members, particularly @Mike_Maxwell , Who have done exactly that, attaching a tube over the lens of the motion sensor so that they get a more directional detection area. That can work fine, it just takes a little ingenuity to set it up.

There are also motion sensors you can buy that are called “pet immune” that are supposed to ignore detection events based on small animals. They work OK and it really just depends on your specific set up. Worth a try, in any case, although they don’t have the same certainty as changing the detection zone.

trip beams indoors

There are indeed trip beams that can be used indoors, and if you move them up high enough on the wall then you don’t have to worry about the cats. This is a typical method for people-counting in stores and offices where you want to know if everyone who came in has also left at the end of the day. They don’t detect individuals (susan versus Michael), but they’re a relatively inexpensive way of giving you a directional count.

Unfortunately There aren’t any that integrate directly with SmartThings, but you can do a build your own project if it’s really important to you. For the project as you’ve described it So far, however, I think it’s probably more effort than it would be worth.

The method is discussed in the following thread:

However, instead of directional detection most people using SmartThings just use inactivity in a zone as information. So you could set up a rule that said if no one has been active downstairs for 15 minutes, then turn off the living room lights.

You have to do some experimenting to get this kind of rule so it works for your own family’s typical movement patterns, but it’s a pretty easy thing to do, and it’s a much simpler technology than actual directional detection. So you would have one set of rules for activity upstairs, another set of rules for activity downstairs, another set of rules for inactivity upstairs, and the fourth set of rules for inactivity downstairs. The combination of all that typically gives you the same end result as directional detection.

The following thread has a lot of different ideas on how to handle motion sensors in various parts of the house and is worth a read. It can give you a lot of different ideas.

Zone Manager

Mike Maxwell has an excellent smart app which can combine multiple motion sensors into one zone. It doesn’t give you directional detection and it’s not a people counter. But it can let you say “only react to motion if motion was detected on all three of these sensors.” This is a great way for defining a zone even for L-shaped rooms or other irregular spaces.

Mike also has a pretty amazing “universal device type” which can let you count a contact sensor as a motion sensor or vice a versa. Among other things, if you’re trying to set up a zone it means you could include, say, the bedroom door being opened as one of the “motion events.” It just gives you some additional cool options.

If you haven’t looked into using custom code with SmartThings already, it’s pretty straightforward. Basically you just copy someone else’s code and paste it into your account. The following FAQ describes the process

Then if after reading that it sounds like something you’d like to try, here’s Mike’s zone manager code:


@JDRoberts awesome, thank you for your help! I will go over each of those topic thoroughly.

Turning lights off due to inactivity would work since you wouldn’t want lights on while sleeping anyway. Although I would probably need a motion sensor in each room.

I have more of an issue with heating / cooling. I would want to continue heat / cool upstairs while sleeping.

Not afraid to write some code if need be.

1 Like

So far this looks like the best solution: (Found this linked by @JDRoberts, in one of the posts he linked above).

The challenge with this seems to be turning this wired solution into a wireless one. I have a couple ideas. Not sure how realistic.

  • To avoid wires completely the led and detector need to be wired together. The idea is to have a mirror on the opposite side to reflect the light back into the detector. But the two need to be isolated so the mirror is the only way for the light to reach the detector. This becomes even more of a challenge with having two separate “light beams” and detectors.

  • To transmit the data wirelessly, I could use a FIBARO ubs. Can’t find them in stock anywhere in US frequencies. Also not sure about battery and LED life.

Is your house dual zoned? I have 2 nests and use Nest-Manager to set rules based off of presence and it can use remote motion sensors to trigger set points.

In my house sleeping area is upstairs, so we usually use the Nest up there at night, and the downstairs only during the day. It does take 30-60 minutes for a AC/Furnace to move the temp more than a few degrees.

You will need motion sensors to trigger lights off, you might as well just start going full automation. It was a driving point for my wife to get smart switches all over the house and attach to motion sensors. All switches replaced but still need 8+ more motions to fully do it.

I have modified a few motions to be targeted sensors at the top of stairs. Don’t think there is a smart app that counts the number of breaks in the beam. It would be hard to tell whether someone is coming or going, unless you have 2 separated at the top/bottom. Even then I don’t think it will be accurate enough. i know there are a few beacon ideas around this, but require a mobile phone to be with you (

Yes, 2 Nests and each control upstairs and downstairs separately.

Do iBeacons work reliably in a two-story home? If you are upstairs does it pickup a downstairs beacon? Seems like there might be a lot of false positive. We do keep our phones with us 90% of the time.

Beacons have configurable ranges. You can have multiples to triangulate locations. Don’t think there are many consumer grade solutions, but have seen some kickstarters about it (can’t find the one I was really interested in)

Your request is maybe a year or two ahead of its time.

Edit: Found it!

Does not use beacons. Costs $10 a month :frowning: and $500 a floor.

We discussed Xandem in the past in the forums. My personal guess is that it will kill the zigbee in your home, but I don’t know if anybody’s actually tested it.

The dual beam works (that’s why I’ve linked to it previously) but it definitely does not rely on a smart app or any other cloud-based technology. There’s a local pi or something similar doing the counting. But I don’t know of anyone who has integrated that with SmartThings yet. And that has a pretty high cost per room.

Microlocation is, as you can probably imagine, a big topic in wheelchair groups where home automation is more than just a fun toy. But it often comes down to cost.

I beacons work well if you’re going to carry your phone with you all the time or carry a beacon with you all the time and have a phone/tablet as a receiving station to define a location, which is what I do.

Depending on the receiving station (I like the one from Beecon sandwich) you can set a variable zone as small as three or 4 inches. Up to about 10 m.

However, it does receive through walls. So you have to take that into account when setting the size of the station.

I have a zone defined that is basically limited to the length of the wheelchair ramp at my front door. So it catches me there and nowhere else as I’m coming home.

And the dashboard tablet in my bedroom recognizes when my wheelchair is parked for the night.

Depending on the household, pressure mats can be useful as location detectors, but if you have dogs they will set them off. (In fact, they will probably sleep on the mat much of the time. Feel free to ask me how I know this. :wink::dog:)

So there are a lot of different things you can do, but it depends very much on your specific household as far as which ones will work. And the costs vary hugely.

As Far as HVAC, since it takes at least 15 minutes for temperature to adjust anyway on most systems, most people find that they can logically identify a location to trigger zone heating/cooling off of. Ecobee has made that their business proposition: heating for people who have more than one room. Their thermostat comes with zone sensors which have motion detectors as well as temperature reporting. But they only report every 15 minutes. But they have a follow me feature, where when motion is detected, the temperature in that room is averaged into the track to temperatures and that in combination affects the current set point. It’s interesting and clever and doesn’t require an immediate response to anyone motion sensor.

When Follow Me is enabled, your ecobee3 will look for motion triggered in any of the sensors that you selected in your network. If a sensor in the selected list detects motion, the temperature reading from that sensor will be used by your ecobee3 to decide when to operate your heating or cooling system. In that way, your ecobee3 ensures that you are comfortable in the rooms that you are occupying. If more than one sensor detects motion, the average of these sensors will be used. Your ecobee3 makes changes gradually when many sensors are detecting motion to make sure there are no sudden and large changes for your heating and cooling system.