Buildings consume a large portion of energy; the major consumption is due to improper use of electrical equipment. Thus, energy efficiency in buildings has become a priority at every level within the building. Previous approaches to energy-saving methods were based on the human occupancy and placing a human occupancy detecting sensor in urban buildings poses a significant challenge. To overcome the challenges in the placing human occupancy sensor in Urban buildings, the proposed work has the development of a Building Automation System (BAS) to automate the power monitoring and control of electrical loads using Internet of Things (IoT) and a thermal sensor. The proposed framework predicts human presence using a thermal sensor with a machine learning method and regular activity data of the building. In the proposed approach, IoT is implemented to screen power consumption and optimise the power consumption based on the human occupancy, work schedule in the building. The system is evaluated to estimate the human occupancy with machine learning methods at various sensor sites, the number of inhabitants, environments, and human distance. © 2021 Informa UK Limited, trading as Taylor & Francis Group.