As a noob to Home Automation and python I've been struggling how to make sure that my system knows that the house is occupied. I don't really care who's in the house but with my new python alarm system it's important that I know if there's someone here. I was checking for presence every min or so (doors, motion, sounds, etc…) and it was tying my system up just constantly checking. Then I stumbled on this article: http://dreamgreenhouse.com/projects/201 ... /index.php
They call it the wasp in the box. If you already understand this concept then feel free to stop reading now
The idea is simple. If I have a box which I open and put in a wasp and then close the box then I have a wasp in the box. Indeed, I not only know there's a wasp in the box now but I can reasonably assume that there will also be a wasp in the box a min, hour or day from now if the box hasn't been opened. If the box is opened and then closed then there may, or may not be a wasp in the box so I have to listen for it. If I hear a wasp in the box then I know the wasp is there and I don't need to check if there's a wasp in the box again until someone opens the box.
Now in my house there are only two doors that "open the box". All of the others either lead into a closed yard or another part of the building. So unless one of those is opened I can assume that my wasp is still trapped.
So the upshot is that I only trigger a presence check if one of those doors is opened. Otherwise, I assume that the house is occupied.
How do I listen for the wasp buzzing? Lots of ways. I check to see if there's a known mobile in the house (check the IP addresses), is my Apple TV playing a movie, are any of the computers running (check IP again), has a motion sensor been tripped, has any light switch been operated manually, etc… In fact I check lots of things around the house and have achieved about a 98% success rate in determining when the house is occupied and when it isn't. Coupled with my Life360 account I'm pretty confident I can tell you where "my wasp is".
What's the point? We'll it has significantly reduced the number of checks I had to do and improved performance. I used python to check for the wasp so running through all of the checks doesn't impact indigo at all. I've also been able to add a number of triggers to control lighting, heating and other functions when the house is empty. I can also tell if a presence in the house is someone I know or someone I'd rather leave.
It's a good article and it changed the way I looked at the home automation problem. Hope it helps you as well.
Mike