New answers tagged modeling
State diagram with timing is great way to model your situation. This is both understandable and easy to implement. The "movement detected" could be understood as transition from movement being detected to no movement being detected. You could make it better if you had "movement started", "movement ended" and "movement continues" transitions.
You can use a variable with 3 possible states: someone at home nobody at home indeterminate These states are mutually exclusive, so it will make sense to use them for modeling. Whenever the door gets opened, set the state to "indeterminate". Whenever the door gets closed, start a timer, and when the timer ends, you change the state to "someone at home" ...
The concept you are looking for is known as "Hysteresis" (Wikipedia). But don't waste too much time reading the article, as your situation is rather simple. You have a number of inputs, which have states, and you also have a "logical state" (person in or out of home) which you need to compute out of them. The "logical state" cannot simply be a direct ...
Top 50 recent answers are included