Occupancy detection is essential in smart buildings from energy management and comfort management perspectives. Information on the occupancy also plays an important role in the successful execution of the rescue plan by the first responders in emergency situations. Emergency situations demand proactive, real-time, low latency, and accurate occupancy detection mechanisms. Several occupancy detection mechanisms based on the CO 2 levels, camera images, RF signals, etc. are discussed in the literature. However, practical realization and deployment of these mechanisms, specifically concerning emergency scenarios, needs exploration. In this paper, a proactive open-source client-server architecture of a Wi-Fi localization-based occupancy detection system is presented. This system can be deployed in smart buildings for emergency management. The architectural overview, design details, implementation, and testing procedures for this system are discussed in detail. The details of a simulator used for testing, based on random walk mathematical model are also presented. The results proving the functionality and performance of the system are shown in detail.