Occupancy Sensing - not just Motion!

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

I kept having a problem with motion not being detected in my study while I was gaming so this was my solution. Works better than I would have ever guessed!

Set Up for on/off PC control via SmartThings:

  1. Installed Event Ghost on my PC. (I use this initially to turn “off” my PC from SmartThings)
    Send Events to EventGhost
  2. Created a Virtual Switch (VS) to turn “off” PC using Send Events to EventGhost App.
  3. Using the same VS, I used CoRE and Wake on Lan (WOL) to turn “'on” PC (just point to mac address)
  4. Installed Host Pinger to sync my on/off status of my Computer with VS.
    [Release] Host Pinger (IP based Online State / Presence)

Setup for using Event Ghost to monitor PC Activity:
5. Learned how to use Event Ghost to send “PC Events” to SmartThings.


6. Created a Virtual Smart Switch that I would use tell me if my computer was active or not.
7. Used Cloud Interface Smart App from Ask Alexa Setup to get the “End Points” of the VS. (So Cool!)
http://thingsthataresmart.wiki/index.php?title=Alexa_Helper#Cloud_Interface_Smart_App_Setup
8. Finally used a Macro and Python Script in Event Ghost to send SmartThings the PC Activity Status
import urllib; urllib.urlopen(‘http://some smartthings address’)

Might seem like a lot of work but it really wasn’t that bad. This was my PC activity VS works with my Motion Sensor and when both have been inactive for 30 minutes then my “Turn-Off” PC, Lights, Fans, Chair, Subwoofer, etc… Pistons executes.

I am going to install a Harmony activity monitor script on my Pi3 to tell work with my Den Motion Sensor for the same reasons.

1 Like

I have found that combining a beam trigger with a motion detector is a good way to determine if someone is entering or leaving a room.
Using the beam trigger on the door/access to the room and then the motion detector for inside the room. If the motion is detected after the beam trigger (say within 5 seconds) then they are entering the room. If motion is not detected after the beam trigger then they are leaving the room. I use CoRE rules to implement the logic. This is a useful way to control turning on and turning off lights, in a bedroom say.

2 Likes

Hi Stuart, what beam trigger are you using with SmartThings?

So I used a low cost infrared single-beam trigger, I found on Amazon.com, like this… http://a.co/d/eP3yk5y

This was used with a zwave dry-contact relay, also available on Amazon, like this… http://a.co/d/59e7uW2

I don’t think the zwave relay I used is readily available any more but this would be a good alternative… Remotec Zwave Dry Contact Fixture Module http://a.co/d/1dX6njk

The set up was very straight-forward. Although one thing I needed to do was to put some electrical tape over one of the beam sensors as a door-width was too small, meaning the infra-red signal was too strong and hard to break. You can experiment by how much and where to place to tape to create an optimal trigger.

Thanks Stuart - I presume you need power to both sides of the sensor too? Did you run the wire around the door frame?

That’s correct. I ended up using two power supplies I already owned on either side of the door. The sensors required a low voltage DC input. Perhaps a better option might be to run the wire under a carpet or floor boards if that is an option.