This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Occupancy (presence) detection scoring.

Now I have some sensors in the house, I really want to get the occuparion detection (is anybody home) working. Presence detection (who is home) is even better, but I guess it's hard enough to detect that someone is home.

After trying some things an thinking about it, I had an idea. I want to give events a score. How higher the score is, how more likely it is that there is someone at home. Anyone using this approach? If so, do you have examples of how you use it?

I am only testing now, by setting a variable and incresing or decrecing it with 1 on events.

Example:
- phone connected on home wifi: +1
- phone disconnected from home wifi: -1
- movement detected by multi sensor: +1
- no movement detected in living room in last 15 minutes by multi sensor: -1 

And more advanced with countdown timers:
(no one is home, and someone comes home, via the front door)
- front door openend, while there was no movement in living room in last 15 mintes: +1
(someone is home, walks from livingroom to hallway and walks out of front door)
- front door openend, while there was movement in living room in last 15 mintes: start timer 'door open'
  >  timer 'door open' stops and no movement in living room in last 15 mintes: -1





Comments

  • I had a similar idea, but waiting for some more sensors to implement.

    Timer every X time, if no movement in house: -1
    Movement in sensor: +1 to 5 (depending on location).

    If score < 0: set home=false.
    If score > Y: set home=true.

    And some fancy flows that check leaving through door and entering to door, but I need a more stable zwave for that. Not all alarms come through still.
  • And don;t forget your score-limit. You don't want the score to become too big, so your house will take days to go on away-mode automatically.
  • I use the app "smart presence", and 1 motion sensor with a app "countdown" of 24 hours no motion detected.

    If last person leaves the house then mode goes to "away"
    If no motion detected for 24 hours then mode "away" changes to mode "holiday"

    Simple and works perfect( everybody has to have and use their smartphone)

  • glijie said:


    Simple and works perfect

    Ur not using Iphones me guess?
  • glijieglijie Member
    edited December 2016
    glijie said:


    Simple and works perfect

    Ur not using Iphones me guess?
    No indeed,
    otherwise i would use geolocation from IFTTT. I have been told that Iphones works great wit geolocation from IFTTT(cann't confirm it)
    Geolocation from IFTTT with android sucks

    edit : And why can't you use an Iphone ? the fixed IP adress is given in the router?
  • Iphones with the smart presence app has a delay of 15 minutes to rule out the false positives. That also means the presence detection has a delay of 15 minutes which means the lights will go on between now and 15 minutes.
    Not perfect for me. It's gonna be hard to find the perfect solution for this.
  • Iphones with the smart presence app has a delay of 15 minutes to rule out the false positives. That also means the presence detection has a delay of 15 minutes which means the lights will go on between now and 15 minutes.
    Not perfect for me. It's gonna be hard to find the perfect solution for this.
    Okay 15 min is way to long, did you try geolocation from IFTTT ? 
  • For me having a connection to the network is not enough to set occupancy.
    - Phones are not always connected (rightly so because battery) .
    - Not going to fix the ip for every phone, like friends/family that stay a couple of days, indoor-gardener or date I left sleeping while going off to work... 
    - What is my phone is off, or I don't have it on me, going out or in.

    I believe the OP wants to achieve to know if his house is occupied or not. So wether or not he is home, the person in his house does not have to keep switching the lights on, because a flow tells Homey to switch it off. And when this person leaves, and forgets to turn off the lights, they do turn off.
  • Geolocation with ifttt is workings also so so.. not realiable enough! Sometimes it's working for an iPhone 6 75% and 6s 90%... other times it is worse! I expect begin next year my kickstarter product DOT... in the mean while I hope Athom is releasing Bluetooth presence detection....
  • Using the smart precense app isn't enough. Sometimes someone leaves home, and forgets the phone, sometimes wifi is disconnected to save battery, sometimes it takes a while before the phone connects to the wifi, sometimes there is 'a guest' in the house, without a phone.

    Using only a doorsensor or only a multisensor isn't enough too. So that's why I want to combine sensors (input) to make a good guess if there is someone in the house.

    I can use even more, then stated in the topic start. Example: When TV manualy is turned on or off, when light is turned on or off with physical switch, when pc boots, etc..

    I have some flows that do a +1 or -1 to a variable, but it plusses to much. What @marcello says, I have to find a way to have a max value in a variable. Don't know yet how to do that.

    Also I didn't find a way to use the multisensor in a good way to plus or min the variable. Now it plusses much too much..

    Here is a nice article about occupancy and presence: http://dreamgreenhouse.com/projects/2013/presence/index.php
  • glijieglijie Member
    edited December 2016
    Nice article @keverjeroen ;;

    There is a lot to do for you:-) and maybe for me now too:/

    I wonder why use  +1 and -1? why not

    make flow with:
    IF there is movement in a room THEN someone is at home and present in that room ( you can do with that room what you want, lights on etc.)

    Make another flow with:
    IF there is movement in room THEN start counter for that room ( counter starts over each time there is movements seen.)

    Make a flow with:
    IF counter ends for a room THEN someone is not present in that room anymore and you can do what you like f.e. turn off lights or ever you want.

    Make at last a flow like:
    IF all counters in the house ended THEN there is a good possibility everybody is gone AND change preset or what you want?

    Make flows with
    presets ( Home, Away, Guests, A sleep, Vacation) I think you have to let homey know what the preset is.

    Make Flows with:
    Scenes ( what tot do when a preset is activated)

    I don't have enought motion sensors yet but this is how i'm going to do it for now and maybe expand it later.



  • keverjeroenkeverjeroen Member
    edited December 2016
    I like the counter, because I can use 1 variable to check (or guess) if someone is in the house or not. If counter = 0 no one is home for sure, If counter = 6 someone is home for sure, if counter >0 and <6 I guess someone is home.

    Sometimes there is no movement for a long time, while there are people at home. For example, watching a 2 hr movie on the couch. In this example movement stops, and the counter goes from 6 to 5. During the movie, 1 phone battery dies, and the counter goes down to 4. Now I can let homey ask "are you still at home?". If there is an answer, the counter goes up to 6. If not, it goes down to 2. Now Homey asks it one more time. Again no answer, the counter goes down to 0.

    Thanks to Slack I found a way to set a min and max value on the counter, using these 2 flows:
    If variable is set, and variable is < 0, set variable = 0
    If variable is set, and variable is > 6,  set variable = 6

    I also made these 5 flows to check if someone enters or leaves the house via the front door. This is not 100% accurate, because my (only) movement sensor is in the living room.

    - If movement livingroom detected : start timer_movement (5 min.)

    - If front door opens : AND timer_movement is NOT running : start timer_door_open_incomming  (5 min.)
    - If timer_movement starts : AND timer_door_open_incomming is running : "someone entered the house" and stop timer_door_open_incomming

    - If front door opens : timer_movement is running :  start timer_door_open_outgoing (5 min.)
    - If timer_door_open_outgoing stops : timer_movement is NOT running : "someone left the house"

    -Edited one flow, to stop the timer_door_open_incomming-
  • I am recieving the best results with Tasker 
    https://forum.athom.com/discussion/996/tutorial-using-tasker-and-the-homey-api
    You can use your phones gps and/or (more energy saving) your CELL ID. It works a lot better than IFTTT but its a bit more complicated to set up.

    For a future setup I am looking forward to the Netatmo Welcome integration to Homey. I am using the Netatmo welcome to monitor my guests, e.g. they are welcomed by Homey with their names thanks to IFTTT. But you can't access the very nice working geofencing feature of netatmo to trigger if somebody has left.
  • IFTTT and Smart Presence app working great here. But like I sayd, using mobile phones is just 1 sort of  'input' for occupancy (presence) detection. 

    Maybe some day I can use sensors like this: https://www.xethru.com/respiration-sensor.html/
  • Now I can let homey ask "are you still at home?". If there is an answer, the counter goes up to 6. If not, it goes down to 2. Now Homey asks it one more time. Again no answer, the counter goes down to 0.

    Is this working for u?
  • marcellomarcello Member
    edited December 2016
    @keverjeroen If it wasn't you who asked on slack today, here ya goes for da limit flows.
    Oops, you just said you did :p
  • keverjeroenkeverjeroen Member
    edited December 2016
    Well, I'm a bit supprised myself, but it looks like it's working! D When nobody is home, the scoring is really low (0 / 1) and when one or more people are at home, the scoring is high (5 / 6). But it needs some fine tuning. In some situations counting up goes better than counting down. For example I had to edit a flow for incoming people. 
  • Well, I'm a bit supprised myself, but it looks like it's working! D When nobody is home, the scoring is really low (0 / 1) and when one or more people are at home, the scoring is high (5 / 6). But it needs some fine tuning. In some situations counting up goes better than counting down. For example I had to edit a flow for incoming people. 
    Thank you for the inspiration! It reminds me how neural network nodes work. Currently, I update my presence based on multiple events with multiple conditions, but your approach seems easier to maintain and expend. I'm defiantly going to try this out myself.



  • @keverjeroen so u don't suffer from 1161?
  • You're welcome.. ;) And another plus, logging is easy too. On the insights page, I select the Better Logic variable for the counter, and I get a nice graph.

    Below an example. It isn't really smooth yet, but you can see when we were home, away and asleep. One advantage on this day, both persons have had a mobile phone with them (wifi) and both woke up, went away, came home and went to sleep togetter. When 1 is at home and 1 away, I guess it's a bit harder to check if there is still some one at home.


  • @keverjeroen so u don't suffer from 1161?
    I don't have any actions depending on the presence at the moment. Just testing and fine tuning to see if it is usable. But I see that 1161 is fixed in the next Homey version!
  • Ah well, nevermind.
  • That was an example, @Rocodamelshe .. ;) If the detection score is reliable, I wanna use the 'ask question, thingie'... ;)
  • Ok. Well it is actualy working in 1.0.5 so solved!

  • keverjeroenkeverjeroen Member
    edited February 2017
    I am using the occupation counting for a while now and it is really working great! Homey can now really guess good if someone is at home or if no one is home. I log everything to an spreadsheet (via IFTTT). I use that data to fine tune the counters.

    I've learned that some inputs are much more important then others. The more reliable the input, the higher the effect is on the occupation scoring. For example, If the TV is turned on by hand, this gives a very high score because only a human inside the house can turn it on. But if a phone isn't detected anymore bij SmartPresence, it could be that some one left the house, but it's also possible the battery is dead, or the wifi is down.

    For everyone that is complaining about Smartpresence app, about the homey app, about ifttt, about motion sensors: Stop complaining and combine all those inputs to get an reliable precense system. ;)

  • I am using the occupation counting for a while now and it is really working great! Homey can now really guess good if someone is at home or if no one is home. I log everything to an spreadsheet (via IFTTT). I use that data to fine tune the counters.

    I've learned that some inputs are much more important then others. The more reliable the input, the higher the effect is on the occupation scoring. For example, If the TV is turned on by hand, this gives a very high score because only a human inside the house can turn it on. But if a phone isn't detected anymore bij SmartPresence, it could be that some one left the house, but it's also possible the battery is dead, or the wifi is down.

    For everyone that is complaining about Smartpresence app, about the homey app, about ifttt, about motion sensors: Stop complaining and combine all those inputs to get an reliable precense system. ;)

    That's fine for you. But i wish me a functioning homey mobile app function for presence. This should be a main feature which is always working!

  • For the past 2 or 3 months or so the Homey mobile app presence function  has been working very well for me (on an iPhone 6s and an iPhone 7). I had issues before that, apparently an IOS update fixed it at some point. People with iPhones may want to give it another go  :)

    However, as the topic starter indicated, for 'occupancy' detection, even if the presence detection based on your phone(s) is 100%, the phone based presence input is not enough to cover all situations for most households. To account for kids, cleaning ladies, guests etc. the counter based approach is very useful.

    I am using several powerplugs to monitor if for instance the TV is in use, or the stereo system. I am also using input from a Nodon wall switch and from a motion sensor. Now it's a matter of collecting data and tuning the 'someone is at home' and 'nobody is at home' states (I love the Homey 'insights' :) ).

    Note that depending on the scenario accuracy is more or less important. I have been switching the auxiliary heating in my bathroom based on the homey presence for months now and it is working great. The occasions where neither myself or my girlfriend are at home at night but someone else is, are very rare. During daytime this is a different matter and more input is needed.

    Thanks,

    Regards, Anne
  • this is a really good thread. just wondering how you guys deduct scores from counter? to determine that no one is likely home 
  • konradwalshkonradwalsh Member
    edited February 2018
    glijie said:
    Nice article @keverjeroen ;;

    There is a lot to do for you:-) and maybe for me now too:/

    I wonder why use  +1 and -1? why not

    make flow with:
    IF there is movement in a room THEN someone is at home and present in that room ( you can do with that room what you want, lights on etc.)

    Make another flow with:
    IF there is movement in room THEN start counter for that room ( counter starts over each time there is movements seen.)

    Make a flow with:
    IF counter ends for a room THEN someone is not present in that room anymore and you can do what you like f.e. turn off lights or ever you want.

    Make at last a flow like:
    IF all counters in the house ended THEN there is a good possibility everybody is gone AND change preset or what you want?

    Make flows with
    presets ( Home, Away, Guests, A sleep, Vacation) I think you have to let homey know what the preset is.

    Make Flows with:
    Scenes ( what tot do when a preset is activated)

    I don't have enought motion sensors yet but this is how i'm going to do it for now and maybe expand it later.



    This is a better way, I feel. I tried the OP way and keeping track of the numbers from a flow creation point of view is a nightmare. I feel its better to keep it simple.

    Either Someone is Home or No One is Home

    Then using the flows to set this is easier.

    Any device is seen on the network or any motion means someone is home

    otherwise, countdown timer and then check again.

    If no, then no one is home

Sign In or Register to comment.