Home automation systems can save a huge amount of energy by detecting home occupancy and sleep patterns to automatically control lights, HVAC, and water heating. However, the ability to achieve these benefits is limited by a lack of sensing technology that can reliably detect zone occupancy states. We present a new concept called Walkway Sensing based on the premise that motion sensors are more reliable in walkways than occupancy zones, such as hallways, foyers, and doorways, because people are always moving and always visible in walkways. We present a methodology for deploying motion sensors and a completely automated algorithm called WalkSense to infer zone occupancy states. WalkSense can operate in both offline (batch) and online (real-time) mode. We evaluate our system on 350 days worth of data from 6 houses. Results indicate that WalkSense achieves 96% and 95% average accuracies in offline and online modes, respectively, which translates to over 47% and 30% of reduced energy wastage, and 71% and 30% of reduced comfort issues per day, in comparison to the conventional offline and online approaches.