Occupancy Sensing - not just Motion!

Just came here to comment on this. In my master bedroom and bath, I have the latest ST zigbee motion sensors, (love the low latch times.) I use several Rule Machine Rules to determine estimated presence at each location. Honestly, it’s super crude right now, because getting complicated with RM is a nightmare, but it works well enough for a single guy.

I’ve tested it with ‘company’ and it gets annoying real quick. I could potentially add in a third motion sensor between zones, and add some logic that determines a zone has been breached, and to react accordingly. It’s very doable to use motion sensors for occupancy, but it totally depends on the room you’re working with.

In my case, it’s 100% doable, but I think I still have to write my own smartapp. In the mean time, I am using RM, and I also use several magnet-mounted minimotes to trigger lights, AS WELL as automatic lights. There are times where I know I want to leave the lights dim, off, or bright. In my theater area, for example, my Harmony hub turns on/off automatic lights when I power on the projector. Works fairly well.

I do want to perfect the occupancy logic for my master bedroom though. I really think it can be done, but only reliably with a few more motion sensors, and some custom code.

We need infrared heat sensors that have options based on size of heat source. This way, cats/dogs do not false trigger…unless we have a filter for an action only based on detected heat source size. For example, an automated doggy door or something.

I would love a way to have lights dim on and off depending on room occupancy, unless overridden by voice/app/wall switch override. Also this would connect awesome to automated A/C or Heat vents, directing air where needed only.

Anyone know of any products that will do this?

3 Likes

Yes, these exist. They are typically called “pet immune” Motion sensors. There’s at least one on the official compatibility list, if I recall correctly it’s from eco-link.

(I was right: Ecolink. But there are also other brands make these. They just have an adjustable sensitivity. )

1 Like

Thx. Can this device be controlled to, if it sees stationary heat, ON, and if no heat present, OFF? Motion doesnt really matter if someone is sitting still for longer than the timeout period.

Coming in late on this, but just wanted to mention that this is a frequently discussed topic in the forums, there are at least four threads on it. Bedrooms are always tricky because of the amount of time that people spend lying still watching TV or reading which can then register as inactivity on a motion sensor. Or the inverse, where someone moving in their sleep registers as activity.

Different people solve it differently depending on their exact circumstances. You can use custom code if you like, but it often isn’t needed. People have had solutions for this issue since before rule machine ever existed. But most of the solutions involve carefully analyzing which devices you need where… :sunglasses:

Here’s one recent thread to get you started – – it includes links to several of the other threads as well, so it should give you a lot of ideas.

No, that’s not quite how the “motion sensor” technology works. They measure tiny changes in heat as it passes across the sensor. They do report “inactivity” which can be used to trigger off, but of course that gets fooled by the person sitting still.

An alternative, which is discussed in the bedroom project thread I already linked to is to use either a pressure Mat (which, for example, can be placed under the sofa cushion) Which then does detect whether someone is sitting in the chair or not. Some people put these under a mattress, or even under a dog crate.

Another alternative for some use cases which Jody already mentioned upthread is an acceleration sensor on a chair like an office chair, which will catch very small changes in motion.

So again, it comes down to analyzing exactly what the use case is and then determining what combination of devices can best solve it.

At my own house, I often use intentional touchless switches, usually a motion sensor in a box to limit its range. So I catch people walking in with one sensor, but when I want to Turn off the lights I use a different sensor with an intentional hand wave as I get up from the chair or the bed. For example, I have one sensor on the side of the nightstand facing towards the bed. Easy to trigger just by hand position as I get in or out of bed, but doesn’t get accidentally triggered by the dog. :sunglasses:

Again, many different ways to solve the same problems. Just depends on your exact set up as far as what will work best.

And of course now days at our house we use voice as our primary means of light control using the Amazon echo. Works great. But I do still use the touchless switches particularly for late-night use cases where voice might wake up someone else.

Also, the following thread discusses some of the more sophisticated (and more expensive) people counting options, like trip beams at room entrances. (Terry mentioned these at the very beginning of this thread, but I wanted to give the link to the detailed discussion as well) . These are more complex to set up as well as more expensive, so most people aren’t interested in them, but some are. Choice is good. :heart_eyes:

1 Like

I ended up getting the logic pretty well set up in my bedroom. I’m using various virtual switches controlled by motion sensors and other logic. They all come together with my various minimotes to do exactly what I want. Alexa can control the important logical switches.

Something along the lines of…

  • Auto lights on, motion detected, turn lights on to certain color.
  • Walk out of bathroom enter bedroom. Logic waits for 5 minutes to make sure no new motion is detected in bathroom. At that point, a virtual switch sets bathroom presence to empty.
  • Stop moving in bathroom, (shower, bath, toilet, closet, etc,) but never trigger bedroom motion? In that case, the bathroom presence switch still says you’re in there. Timer is set to 30 minutes. Logically, if you’re still in there, you’ll re-trigger the lights by motion or various doors.
  • The same logic applies in any of my rooms that you can walk through one to the other.
  • All the rooms have minimotes to trigger auto lights on/off. To override any automation logic. What would be even better is if I had in-wall switches that you could merely double-tap in either direction.
  • I use a combination of audio alerts, light color changes, blinking, dimming, and various other indicators that you have successfully triggered a certain mode via remote.
  • All of this is done in Rule Machine, but could easily be accomplished with custom code.

I think a good place to start is by having the logical presence switch for each room. That can then be triggered by many inputs. Door, motion, temperature, vibration on desk, etc.

Perhaps someday we’ll get an actual presence sensor to add to the mix, but I’m not sure how reliable those are in general. Even at work, it seems that the lights still turn off on us. Basically just overpriced motion sensors if you ask me.

2 Likes

Exactly. We need presence sensors that have better resolution. or maybe similar technology that Microsoft is using for the xbox, where it can see people in a room, even if they arent moving.

For overrides: I think Lutrons system is designed to swap out your wall switches with intelligent ones, that way the app can control the lights, or the wall switches that most often get used will override the app/automation

There’s another method you can potentially use and that’s an RPi running OpenCV and a webcam/PiCam, heck it even do facial recognition.

1 Like

Yeah but what good is all that? If you can tell people are there with body heat, then that should be good enough. I think it would be pretty cool to use heat differential to determine the person count of a room. Should be doable.

1 Like

Not only could you tell if there was a person in a room, you could track which person is in which room (think voice notifications for a specific person only being announced in that specific room they were in) and not only that, you could track occupancy even if you weren’t moving at all (sitting/laying on the sofa watching TV for example).

Heat differential is almost impossible to track in a residential situation as a means of counting people, although you can use passing changes in heat which is how most “Motion” sensors work.

Heat differential works great in a totally controlled environment, like a museum vault. The problem with a typical Home is that there’s so much variation even in an empty room. There’s often as much as a 15° difference just from the area right next to an outside window to the area closest to the furnace vent. And the hotspots in a room will change over the course of the day. When the furnace is on, the air out of a forced air vent is typically between 135 and 145°F. And there are other heat sources like incandescent lights, stoves, fireplaces, room heaters and some other equipment. Even a dog. You put all of that together, and you just can’t count people based on the heat of a room.

The most practical method is a trip beam, well, two actually at the entrance to the room. Some people have done that, and one of the micro location threads has a link to an actual project plan for it. With those you can literally count the number of people who enter the room and then the number of people who leave. They’re very reliable, they work very well, they just cost quite a bit and the install is a little complicated. But you don’t have to have people carrying anything with them, and you don’t have to keep recalibrating for summer days versus winter nights. So this technology exists, it just costs more than most people want to spend.

Beyond that, again as discussed in the other threads, micro location is something that everybody wants, but practically we don’t have yet. The best guess for five years from now is that will have technology that can recognize heartbeats. But that’s not available yet. :sunglasses:

There are some community members that have used the “wasp in a box” model with some success. You might find that interesting.

I feel like if you put enough motion sensors, you can achieve nearly perfect presence detection. I really can’t complain about my setup. Some sort of active Bluetooth beacon or WiFi signal strength might help round it out, but so far so good.

1 Like

XBOX Kinect does this excellently. One sensor technology cannot accurately work all the time, and neither can more of the same sensor. In order to do it, it requires multiple types of sensors, some of which might be cameras. Tracking motion. Tracking body shape. Movement, etc.

" The device features an “RGB camera, depth sensor and multi-array microphone running proprietary software”, which provide full-body 3D motion capture, facial recognition and voice recognition capabilities."

Sounds to me like Microsoft is WAY ahead of the game. Why are we not seeing home automation products from Microsoft?

I’d really like to see some sensors on the market that have the ability to do this. I feel like with a combination of sensors, it should be able to achieve this. Can a Kinect detect a person if they get into bed and start reading a book? or if they get under some covers and lay down for a nap? or to watch a movie? it should be smart enough to know that the person that was in the room, is still in the room, and they are stationary, or temporarily not visible.

1 Like

@theKpher I don’t think personally there is a hard and fast way to know definitely if a room is occupied. However I have had good success in tackling this using a multitude if sensors and methods.
As you realised the motion controlled lighting doesn’t work too well when watching TV or reading as people tend to sit very still doing these things and the lights keep going out.

I have done a pretty decent job of tracking occupancy in my rooms and it does work exceedingly well.

I will give you an example of my living room.

I have two motion sensors in the room because of coverage issues due to the size/shape. So first off we we turn on the lights when motion is detected if the lux levels are equal or below 12 or time is between sunset and sunrise with +/-8 min offset.
The lights won’t turn off until all motion sensors have been inactive for 3 mins.

So far so good but as you’ve probably realised the lights go out often. So I have methods to track things we would do in each room e.g. if my TV is on using a modified script of my ASUSWrt script. I have this mapped to a virtual switch so now the light don’t turn off if my TV is on.

So this removes a fair amount of false positives as the TV is in use when the Room Is Occupied. I also have another rule that turns 's off the TV/lights if there has been no motion for 30 mins… The only time this has ever triggered is when I have fallen asleep watching TV.

But as stated that doesn’t get rid of the false positives for example if I have guests around and we are talking with the TV off. So I use the noise dB meter of my netatmo Base Station that turns on/off a virtual switch when the noise level goes above the ambient noise level of the room. This covers that issue off well.

So then if I am reading I read on the sofa in the room. I have a home made pressure sensor that triggers when someone has sat on the sofa. This covers that issue of the lights turning off when reading.

Now that together covers 99% of the instances where lights go out. But it’s not still 100% accurate. E.g. sometimes I will sit on the floor with my laptop. I could track when that is switched on. But it’s a moveable device that can travel between rooms and yet there is no really reliable way to track which room it is in.

So in these rare cases when on my own with no noise and no TV and no motion in the room (this rarely happens) when the first time the light goes out I just move so the light switches back on and say “Alexa turn on living room manual” This disables further automation in that room until the virtual switch is turned off again (i do have a reset that will turn back off this manual switch after 1 hour if there is no motion, TV, or noise in that hour. Just in case I forgot to turn it off. A mode change also turns off this switch.

I have a manual virtual switch for each room as a simple way to override the automation when it doesn’t match the desired behaviour. In automation it’s pretty impossible to cater for the 100 percentile in your automation, but if you get it to 99 percentile you are doing well. With that in mind you need a way to quickly override and stop automation when needed.

I also have a Manual Mode which disables all automation in the house be it lights/heating/locks etc… Not 100% needed but I have used it during some ST platform issues to prevent undesired behaviour

2 Likes

What kind of switch do you use for manual mode?

Is it a toggle?

Do you have anything that signals what mode you are in?

Like when you click the button for manual mode, lights blink once?

Thanks

It is indeed a Standard Virtual switch which is a toggle with On/Off States.

I don’t need anything to flash which mode the room is in, i if its important i can see the status of the Manual switch by looking at the wall mounted tablet. or ask alexa using the new Ask Alexa Smartapp

At home, I have a traditional in-wall occupancy sensor controlling the lights in the garage, and it has never failed me. In my office, I have a small waiting room with a ST motion sensor, which works well but does show no-motion if the person is sitting still.

If I were to install sensors in my house to provide occupancy info (eg for lighting), I would use a traditional occupancy sensor with a wet-contact sensor (eg Enerwave ZWN-RSM1S relay) behind it. There might be other zwave or zigbee devices capable of being wet-contact sensors, but I’m not sure. (In case you’re wondering, “wet-contact” sensor can detect a powered circuit closing, while a “dry-contact” sensor can detect a non-powered circuit closing.)

Keep in mind that you’ll need a single gang space with neutral wire in it. Best option is to expand a single gang box housing a light switch to a double gang. If you have an older home, you will probably not have a neutral in the box, and will need to run wires from the nearest outlet. In newer homes, with a neutral in the light switch box, if you don’t want to switch it to a double gang, you could replace the light switch with the occupancy switch, but that will not give you much flexibility in setting up the whole system. Another option is to replace a receptacle, not sure if the occupancy sensor would work well at floor level though.

No need to connect a load to the relay – can just use it to detect the occupancy sensor on/off state. Can easily modify a switch DH to look like a motion sensor, so that the occupancy sensor/relay combo looks like a motion detector.

(I’m using the Enerwave ZWN-RSM1S relay as a “contact sensor” for security purposes. It is wired behind a ceiling light in a closet. The light is controlled through a mechanical jamb switch. When the closet door is opened, the jamb switch completes the circuit and the closet light comes on. The relay then indicates that the door is opened. I changed the stock binary switch DH, which works with the relay, to look like a contact sensor, so it shows closed/open state.)

We need Microchip implants for this to work or carry electronic device always lol.

Many researchers believe that eventually ( within 10 years) there will be micro location sensors that can recognize individuals by their heartbeats. But we’re not there yet, obviously. :sunglasses:

The next best thing will probably be a waterproof wearable.

1 Like