Room Occupation - Best Method

Posted on
Thu May 04, 2017 2:22 pm
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Room Occupation - Best Method

Hello there,

As a new Indigo user I'm finding that there are probably a hundred ways to accomplish the same objective so I'd like to gather some insight on the best way to accomplish my particular objective.

What I'm trying to accomplish is to use data provided by my motion sensors (connected via AD2USB Plugin) to provide a representation of whether a room is occupied or not. I'll then use this information to deal with further automation such as turning off lights in unoccupied rooms as well as to simply have a visualization of areas of my home that are occupied.

The problem is that my motion sensors clear immediately after faulting and go into a 3 minute battery preservation mode before they have the opportunity to fault again meaning that if you aren't looking at Indigo at the exact moment of the fault it's nearly impossible to tell if the room is occupied or not.

To get started, I've managed to accomplish my objective but in order to do so I've had to create 2 Triggers (3 if you count my bonus trigger), 1 timer and 1 variable...and that is just for one room. Not so bad I suppose but after replicating this across every room in my house it's going to be a bit of a maintenance nightmare...not to mention that looking at the variables list isn't the most intuitive way of checking if a room is occupied...

So here is what I have done so far:

1. Created a room specific variable: occupiedGuestRoom (bool)
2. Created a room specific timer: occupiedGuestRoomTimer (3 mins)
3. Created a trigger that fires when the Guest Room Motion sensor faults that sets the respective variable to true and restarts the timer.
4. Created a trigger that fires when the occupiedGuestRoomTimer finishes that sets the respective variable to false.
5. As a bonus, I created an additional trigger that turns off the Guest Room Light when the occupiedGuestRoom variable becomes false.

My plan is to replicate this functionality across all rooms of the house but as you can see, I'm going to have a giant mess of triggers and timers and variables so I'm thinking that there has to be a better way of accomplishing this.

I've been researching a ton of different options to reduce the footprint a bit such as ActionGroups, GroupTrigger Plugin, Virtual Devices, etc, but I'm still not entirely clear on which route to pursue.

Hoping that someone with a little more Indigo experience might be able to point me in the right direction so that I at least can focus my exploration efforts on a path that won't lead to a dead end.

Thanks in advance for any direction anyone can offer!

Posted on
Thu May 04, 2017 4:30 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Room Occupation - Best Method

I'm going to throw some other complexity in to some of this for you: In my experience, motion is not a good way to monitor presence in bedrooms!

When people are asleep, they don't trigger motion for 20-30 minutes at a time. You also might have someone asleep in a room, then have someone else enter. And typically, you'll want things to react differently to that than when someone enters an actually empty room.

I don't have any motion sensors at all in my bedroom. Instead, I rely on iBeacons to notice when my wife or my phone is in range of the bedroom, and set variables based on those for flagging the room as occupied or empty.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu May 04, 2017 4:53 pm
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Re: Room Occupation - Best Method

Thanks for the insight @DifferentComputers.

I don't necessarily disagree with you, in-fact I have a bunch of iBeacons on order to help enhance presence detection. However, I should note that I didn't mention turning any lights on for this very reason. I'm only interested in turning lights off that have been left on by my kids. So if they are sleeping and not creating any motion, I'm not very concerned about a light being turned off.

I do appreciate the consideration though as having lights come on in the middle of the night certainly isn't ideal for anyone! :)

Posted on
Fri May 05, 2017 5:57 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Room Occupation - Best Method

I do use motion sensors (mostly old insteons slowly being replaced by Z-waves as they die) rather than beacons for ROOM occupancy simply because the beacons aren't always with the person; most of ours are on key rings, which are tossed on the bedstand or dropped in a purse hung on a chair in the kitchen... Good for unlocking doors and knowing who's home, but too error prone for a foolproof way to know if somebody's staying up late watching a movie in the living room. Motion sensors to turn lights OFF work pretty well if the timeout is set long enough (nothing is more annoying than having the lights go out because you were totally engrossed in puzzling out a stubborn clue in a crossword and didn't sit up and stretch often enough), and they double as a burglar alarm if you get motion and all the beacons are gone. But except for the pantry and attic we don;'t let the motion sensors turn lights ON; there are times when you want subdued light even if the room is occupied, so that's left up the the occupant; all the sensors do is shut stuff off if nothing moves for half an hour.

Posted on
Fri May 05, 2017 9:22 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Room Occupation - Best Method

Now that reliable(ish) whole-room voice control is a reality, the holy grail for smart homes now (IMHO) is reliable presence detection that doesn't require the person to carry something with them. No idea how it'll get solved, though many "professional" installers will claim they licked that problem years ago. I'm skeptical and I've certainly never heard of anyone describing how a very reliable one works.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 05, 2017 9:48 am
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: Room Occupation - Best Method

I've found the people detection algorithms in Sighthound to be pretty reliable with proper cameras and lighting - BUT - putting cameras in the bedrooms does not go over well with wife.! :shock: I tried telling her it's all for science, and the only thing that would see it would be the computers, still no-go. What a buzz-kill!

Terry

Posted on
Fri May 05, 2017 10:43 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Room Occupation - Best Method

LOL.

How much light is needed for Sighthound to do it well? And how many cameras are required to get it right?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 05, 2017 11:10 am
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: Room Occupation - Best Method

jay (support) wrote:
LOL.

How much light is needed for Sighthound to do it well? And how many cameras are required to get it right?


Indoors, with "Walking around light" it will do fine and can detect me, my wife and 5 year-old daughter as humans with a 720p Foscam. It does equally well with night-vision on the same camera. Occasionally, lightning, or headlights through the windows will cast a brief shadow on something that fools it. We have two medium-sized dogs and two fat cats in the house and it will reject them, except for one time when one of the dogs stood on it's back legs sniffing around the kitchen counter (which turned out to be beneficial LOL).

Outdoors, I have older 640x480 Foscams and it's pretty bad. I'd put people detection at less that 50-60% effective there, often mistaking blowing shrubs, passing cars, lightning, and such as people. Until I get better cameras outside, I'm just using it as a dumb motion detection recorder. They recently just released an update, which reduced the memory/cpu footprint considerably and is supposedly going to allow be the foundation for bigger changes in the future.

A feature request I've asked for is the ability to track people when utilizing a PT(z) camera, we'll see if it makes it into a future release. In the meantime, I've just started playing with openCV on Linux, thinking that I might be able to train a system to recognize me and the family, perhaps even the dogs so I'll know when one goes in/out the dog door!

Terry

Posted on
Fri May 05, 2017 11:59 am
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Re: Room Occupation - Best Method

jay (support) wrote:
Now that reliable(ish) whole-room voice control is a reality, the holy grail for smart homes now (IMHO) is reliable presence detection that doesn't require the person to carry something with them. No idea how it'll get solved, though many "professional" installers will claim they licked that problem years ago. I'm skeptical and I've certainly never heard of anyone describing how a very reliable one works.


The best example of reliable presence detection I've heard of (albeit never seen implemented) is under floor pressure pads. Essentially a complete subfloor of pressure sensitive contacts that are weighing you all over your house. Nothing to carry and could even be somewhat reliable in individual detection based upon weight unless everyone in your family happens to weigh the same amount.

johnpolasek wrote:
I do use motion sensors (mostly old insteons slowly being replaced by Z-waves as they die) rather than beacons for ROOM occupancy simply because the beacons aren't always with the person;....


I'd be interested in hearing your approach to solving this effectively @johnpolasek. @Kmarkley was kind enough to share a plugin he is working on to help reduce the footprint a bit which I've been playing with but I still feel like there should be more that I can do to optimize this process.

I'm guessing that based upon everyone's reactions that my method with the numerous triggers, timers, and variables isn't completely crazy? I guess it's just my "developer" instincts kicking in wanting to make everything as efficient and reusable as possible?

For what it's worth... I tried the Virtual Device plugin and had it monitor the status of the occupied variable. Basically the only purpose of this is so that I have a better visualization of the occupied rooms then looking at my variable list... the problem is that I don't really want or need the on/off functionality to manually override occupancy status. So...I'm currently looking at either extending or replicating the virtual device plugin to offer a status only style device. Looking through the plugin I have a basic idea of how the menus are generated etc but I'm still unclear where the devices operate logically... If there is any good documentation on this that anyone would like to share, I'd be grateful. Otherwise, I think I'm just going to have to explore the source of other plugins and learn my way around.

Posted on
Fri May 05, 2017 1:50 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Room Occupation - Best Method

mssearch wrote:
the problem is that I don't really want or need the on/off functionality to manually override occupancy status. So...I'm currently looking at either extending or replicating the virtual device plugin to offer a status only style device.


Can you expand more on why this is necessary? If you don't need to be able to manually set the device's on/off status, then don't, right? ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 05, 2017 2:07 pm
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Re: Room Occupation - Best Method

jay (support) wrote:
Can you expand more on why this is necessary? If you don't need to be able to manually set the device's on/off status, then don't, right? ;)


This particular portion of the process is just so that I have a way to visualize occupancy. My motion sensors only "fault" for about a second and then go into sleep for 3 minutes before allowing another "fault". So again, unless I happen to be staring at my list of sensors at the exact moment of the fault there isn't really a good way for me to visualize the rooms occupancy status without scrolling through the log or (as I currently have it configured) looking at the list of variables.

Perhaps what you are saying though is simply to ignore the on/off functionality...? While this may be fine to an extent, my long term plan is to have tablets throughout the house where I can view zone status etc. I haven't yet looked into how control pages function but I can see my wife or kids messing with things and accidentally overriding rooms and then having the triggers fires and causing headaches.

Again...not the end of the world or perhaps even likely but of course my preference is to have things function as they should....or rather...at least how I think they should :wink:

Hopefully my ambitions aren't too lofty to think that I can come up with a solution that feels at least somewhat purpose built?

Posted on
Fri May 05, 2017 2:47 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Room Occupation - Best Method

mssearch wrote:
Perhaps what you are saying though is simply to ignore the on/off functionality...?


Exactly. You can display device state on custom control pages without attaching any actions to a control page element, so accidental trigger from that perspective won't happen.

And, of course, you could build your own virtual status device that has no actions associated with it if you really want to. But by my estimation your time would be better spend on solving other much more difficult problems (like getting real, reliable presence detection actually working)... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 05, 2017 3:09 pm
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Re: Room Occupation - Best Method

jay (support) wrote:
But by my estimation your time would be better spend on solving other much more difficult problems (like getting real, reliable presence detection actually working)... ;)


Fair enough... My plan's for presence detection doesn't involve anything mission critical so I can live with it even if it's only accurate part of the time. Worst case scenario I extend my timers until I find that magic number that someone is bound to fault the motion detector.

With that that in mind, do you or anyone have any additional thought in regards to my triggers and timers? Any thing that I should be doing to optimize this process? Perhaps having a variable that stores an array of occupied rooms so that I can use only a single variable instead of creating one for each room? Or am I overthinking this?

Posted on
Fri May 05, 2017 4:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Room Occupation - Best Method

mssearch wrote:
Or am I overthinking this?


;)

As a new Indigo user, you've sorta picked a difficult task to cut your teeth on. My recommendation is to take a step back and do some slightly smaller in scope things. This will give you a feel for how Indigo works and a good idea of where and when to give it a kick. The biggest learning curve in Indigo is how we present the objects and concepts.

For instance, if you're coming from some other system, it's very likely that you're still thinking in terms of how that system worked. Spending some time accomplishing small tasks will likely help you to convert your thinking into Indigo concepts/speak.

But even if you're not, taking that approach will help you develop the right vocabulary and conceptual understanding as Indigo presents them. After watching many new users, I promise that taking smaller steps at first will save you a TON of time later. We've had many new users who jump in with both feet on large tasks, and get invested in a solution only to find that if they'd understood Indigo a bit better they would have take a radically different (and easier) approach.

Just a recommendation from experience on both sides - as a user new to Indigo (back in 2008) and as an Indigo developer.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 05, 2017 5:04 pm
mssearch offline
Posts: 18
Joined: Mar 27, 2016

Re: Room Occupation - Best Method

jay (support) wrote:
As a new Indigo user, you've sorta picked a difficult task to cut your teeth on. My recommendation is to take a step back and do some slightly smaller in scope things.


That's understandable and I guess why I ultimately decided to make a forum post about it. I'll go ahead and take your undoubtedly sound advice and move my efforts to some other areas first though to get a feel for things.

Do you have any suggestions on areas that I can devote my attention to that will offer some training wheels? Realistically, aside from shutting off lights when rooms are unoccupied I'd simply like to have some nice tablet controls and a nice log of happenings around the house (e.g. 10:34:09am Front door was opened || 10:34:17am Front Door was shut || 10:35:23am Kitchen Light Was turned on). I think Wink does a really nice job of this:
wink-activity.png
wink-activity.png (174.83 KiB) Viewed 4129 times


I suppose digging into Control Pages is a reasonable next step to starting to put this kind of thing together?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests