Announcement

Collapse
No announcement yet.

How I'm doing Occupancy Detection with HS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How I'm doing Occupancy Detection with HS

    Planning to use this thread to document how I'm doing Occupancy Detection in my house.

    I've commented on existing posts a number of times, but I find that it constantly changes, so I'm hoping to maintain a log of my development over time. The first couple of posts on this thread will basically be some form of living document.

    Please feel free to comment, ask questions, or make suggestions.



    Thoughts (work in Progress)

    Core Premises
    1. My system should be self contained, and self reliant.
      • No direct dependency on Internet or Cloud
      • Cloud may be used to 'extend' capabilities (such as using Google Assistant to perform actions)
      • Integrated components should be able to operate on their own as much as possible
    2. My system should improve quality of life within the home (not create headaches)
    3. My system should be mostly invisible (must function without me)



    Occupancy Status...

    Room level occupancy status is not the same thing as House level occupancy status.

    For the house, Wasp-In-a-Box logic works well because the exterior doors are generally closed. i.e., If motion has been detected since exterior doors were closed, then house is occupied until an exterior door is opened.

    Interior rooms are much harder because the doors are usually open, and people move around quickly. I'm currently using a hybrid approach which combines timers and wasp-in-a-box logic. I've recently started leveraging the motion sensor outside of a room as a barrier for the wasp-in-a-box logic, this has been working well.



    Home Status...

    I found that I (a) needed a house level status, and (b) that I needed to consume state information from both the Security Panel, and the House Occupancy Status.



    Automatic Lighting...

    The best approach that I've found thus far for occupancy controlled lighting is to disconnect the lights from the motion sensors. i.e, One set of rules for occupancy detection, another set of rules which control the lights based on whether the room is occupied or not.

    Most of my rooms have a 1 minute timeout for occupancy (changes from Occupied to Unknown) when the door is left open, but the lights are configured to shut off if the occupancy status has been unknown for more than 4 minutes. The Living Room, Kitchen, and Hallway lights turn off 14 minutes after those rooms are marked 'Unknown'. I can enable/disable this functionality in each room via a virtual device called 'Automatic Lighting Control'. I also leverage the Home Status in some of my lighting rules.. i.e., If the house is in sleeping mode, disable automatic lighting in the kids bedrooms, or, if the house is in sleeping mode, when occupancy detected only bring the lights up to 15% vs 100%.






    Floor Plan

    Click image for larger version  Name:	image_80139.png Views:	8 Size:	65.6 KB ID:	1312830
    Click image for larger version  Name:	image_80141.png Views:	8 Size:	129.4 KB ID:	1312832




    Posts Related to my House

    hs3-event-clinic/1312276-example-if-exterior-door-left-open-5-min-speak-send-text

  • #2
    Bedroom 1&2 Occupancy Detection Rules as of 20190129

    Click image for larger version  Name:	HS_WIAB_Bedroom1.JPG Views:	0 Size:	172.6 KB ID:	1311774

    This iteration incorporates concepts from simple Motion Detection with a Timeout, and Wasp-In-A-Box.






    Bedroom 1&2 Occupancy Detection Rules as of 20190318

    Click image for larger version  Name:	HS_WIAB_Bedroom1_20190318.JPG Views:	0 Size:	192.9 KB ID:	1311775

    Here I added a check to only mark the room occupied of it was currently unknown, This is also about the time my kid was complaining that when he turned on his light using the switch, it would immediately shut off. He wasn't walking far enough into the room to trip the motion sensor, which caused the #3 rule to immediately shut off the light because the room wasn't occupied.





    Bedroom 1&2 Occupancy Detection Rules as of 20190621

    Click image for larger versionName:	HS_WIAB_Bedroom1_1-2_20190621.JPGViews:	56Size:	134.7 KBID:	1312161
    Click image for larger versionName:	HS_WIAB_Bedroom1_2-2_20190621.JPGViews:	53Size:	148.9 KBID:	1312162

    This iteration incorporates concepts from simple Motion Detection with a Timeout, Wasp-In-A-Box, and adds logic (Event 2.1) to leverage the motion sensor in the hallway to determine if someone may have left the room.

    1. I changed the broken WIAB logic to leverage the occupancy virtual device (VD) as the trigger, the WIAB flag doesn't engage immediately, you have sit still in the room long enough for the occupancy status to be marked unknown at 1m, then when you move again it triggers the WIAB flag, in a box that is secure. This seems to work really well. This was changed to accommodate the motion sensor based barriers discussed below, my motion sensors latch for 3 seconds.

    2. In Wasp-In-A-Box, you typically leverage the opening of a door to determine if the box has become insecure. In my house, we rarely close the bedroom doors, so I've started trying to leverage the motion sensors outside of a room as a barrier. If someone is in a room, and the barrier at the edge of the room (be it a door, or a motion sensor outside of the door) has not changed state, then I can say with a high degree of certainty that the room is probably still occupied. In my case, I clear the WIAB flag, which then falls back to timer based occupancy logic, and after a minute the room is marked Unknown.





    Bedroom 1&2 Occupancy Detection Rules as of 20190621

    Click image for larger version

Name:	HS_WIAB_BR1_20190626_001.PNG
Views:	189
Size:	102.9 KB
ID:	1312841
    Click image for larger version

Name:	HS_WIAB_BR1_20190626_002.PNG
Views:	189
Size:	108.3 KB
ID:	1312840

    In Event 2.0, I reverted the trigger back to the Motion Sensor from the Occupancy Status virtual device as the room had to timeout and be marked unknown before the event would run. This resulted in lights being turned back on when the room was marked Occupied, also the 1m timeout before the WIAB flag was tripped was too long.

    The way this works now is;

    You walk into a room, remain motionless for a moment, then move again. -- The motion sensor picks you up, marks the room as Occupied, then when you trip the motion sensor again, the WIAB flag is set, which results in the room remaining occupied until you walk out of the room tripping the motion sensors in the bedroom and hallway, which resets the WIAB flag. Occupancy status is reset after 1m

    You walk into a room, close the door, and sit down to read a book -- The motion sensor picks you up, marks the room as Occupied. WIAB Flag is set when the door is closed which results in the room remaining occupied until you open the door again. This clears the WIAB flag and resets the occupancy status.

    You walk into a room, grab something, walk out -- The motion sensor marks the room as occupied but remains active as a result of continuous motion and the occupancy status is reset after 1m because the WIAB flag is never set.

    You turn on the bedroom light remotely, event 1.0 sees the state change on the light and marks the room as occupied, unless motion is detected in the room, occupancy status will timeout after 1m.

    Comment


    • #3
      House level Occupancy Status


      Click image for larger version  Name:	HS_WIAB_House_1.0_20190623.JPG Views:	56 Size:	52.4 KB ID:	1312164
      Click image for larger version  Name:	HS_WIAB_House_1.1_20190623.JPG Views:	54 Size:	170.1 KB ID:	1312165
      Click image for larger version  Name:	HS_WIAB_House_1.2_20190623.JPG Views:	53 Size:	71.4 KB ID:	1312166
      Click image for larger version  Name:	HS_WIAB_House_2.0_20190623.JPG Views:	54 Size:	40.5 KB ID:	1312167
      Click image for larger version  Name:	HS_WIAB_HOUSE_2.1_20190623.JPG Views:	55 Size:	94.7 KB ID:	1312168
      Click image for larger version  Name:	HS_WIAB_House_3.0_20190623.JPG Views:	53 Size:	52.5 KB ID:	1312169


      House level Occupancy Status is handled independently from the rooms, using Wasp-In-A-Box logic. I've found that I need to mark the OS as Unknown whenever an exterior door is open or closed. Having a simple counter tracking the status of all exterior doors is handy and I reference it in quite a few rules.

      Comment


      • #4
        Home Status

        I use the house's Occupancy Status (OS) and the arm state of the Elk Security Panel to drive most of the state changes on the Home Status virtual device. I also have a set of events that updates a Cell Phone counter whenever any of our mobile devices responds to ping on the local network. I use BLLAN to perform the check.

        i.e., Except for arming and disarming the alarm system, we don't directly manipulate any of the House state changes, it's all done automatically.



        HS has 5 states;

        [1] Home Awake
        [2] Home Sleeping
        [3] Away Suspected
        [4] Away Confirmed
        [5] Vacation



        Click image for larger version  Name:	image_80063.jpg Views:	14 Size:	55.8 KB ID:	1312172
        Click image for larger version  Name:	HS_HomeStatus_20190623_2.0.JPG Views:	0 Size:	59.4 KB ID:	1312287
        Click image for larger version  Name:	image_80064.jpg Views:	13 Size:	108.9 KB ID:	1312173
        Click image for larger version  Name:	image_80067.jpg Views:	13 Size:	51.9 KB ID:	1312176
        Click image for larger version  Name:	image_80065.jpg Views:	13 Size:	75.5 KB ID:	1312174

        Comment


        • #5
          Occupancy Based Lighting

          Click image for larger version

Name:	HS_ALC_MBR_20190627_001.PNG
Views:	205
Size:	143.3 KB
ID:	1312847

          The majority of the lights in the house are completely automated using the room level Occupancy Status events from above.

          I leverage the House Status of Home (Awake), or Home (Sleeping), to address certain use cases. Such as not wanting the bedroom lights in the kids rooms to turn on with motion after the house is in Sleeping mode. Or, to only bring the lights in the Master Bedroom, Hallway, and Kitchen, up t0 15% upon motion detection. i.e, most rooms in the house have two rules, one to turn off lights, one to turn on lights when Home (awake), certain rooms have a third rule to turn on lights when Home (Sleeping).

          The inclusion of a Room specific "Virtual Automatic Lighting Control' device lets me enable or disable automatic lighting independently for each room in the house via an app, or by asking Google to turn it off. These are very handy.

          Comment


          • #6
            Occupancy Detection is tough to do with just motion sensors, especially when the occupants are sleeping. Smart watches are pretty good at detecting when someone is asleep these days, I may try to get that data into HomeSeer at some point and use that to help drive my Home (Sleeping) house state.

            Comment


            • #7
              There's a lot of violating going on in your home

              Comment


              • #8
                Maybe a daft question but 2hat does "becomes Violated" mean on your motion sensor?

                Comment


                • #9
                  Once the new iOS comes out I’ll integrate NFC tags to help with certain things

                  Comment


                  • #10
                    Originally posted by metkhoo View Post
                    Maybe a daft question but 2hat does "becomes Violated" mean on your motion sensor?
                    On the Elk M1 Security Panel, a zone is normal, violated, trouble, or bypassed. For my motion detectors, normal is the state reported when no motion is detected, violated is the state reported when motion is detected.

                    Comment


                    • #11
                      Questions;

                      Is it helpful to see iterations?
                      Should new iterations be edits on the existing posts (that was my plan) or should they be a new post?
                      Perhaps I just need to add a new post when I make major changes?

                      Comment


                      • #12
                        Posted floor plans to provide visual reference when attempting to follow the event logic. I think I'll be posting the events for Office and Living room at some point.

                        Posted updates to Bedroom 1 Occupancy Detection events.

                        Comment


                        • #13
                          Originally posted by viroid View Post
                          Questions;

                          Is it helpful to see iterations?
                          Should new iterations be edits on the existing posts (that was my plan) or should they be a new post?
                          Perhaps I just need to add a new post when I make major changes?
                          I think the iterations are useful since they show the though processes. However, some may just want the end result....

                          Comment


                          • #14
                            What settings are you using which display the green tick in Options?

                            Comment


                            • #15
                              Originally posted by metkhoo View Post
                              What settings are you using which display the green tick in Options?
                              The advanced option selected is Do Not Log.

                              Sent from my LGUS997 using Tapatalk

                              Comment

                              Working...
                              X