The wireless sensor network is an important element of energy efficient "Smart Buildings" to collect different types of data and to optimize the energy demand management (EDM) system. It is very important to save energy of the wireless sensor network to prolong the network life-time. In this thesis, a distributed, quasi-planned Medium Access Control (MAC) scheduling algorithm with priority control has been proposed for smart building's WSN. The protocol reduces the wasted energy of sensors during idle listening, collision, and overhearing processes. The system considers multiple classes of sensors based on their roles. The protocol establishes confirmed communication for steady traffic and gives adaptive control for varying traffic load. Hence, it reduces the total energy requirement for each sensor class. It uses a novel statistically inspired algorithm to dynamically configure the cycle length for reducing latency. Overall, the new algorithm shows better energy performance than many conventional WSN MAC protocols.