Today, Smart home technology is commonly used for remote observation and control of devices and systems, for example, heating and lighting for convenience, support, and energy saving. Smart home devices incorporate the Internet of Things (IoT) to help automate activities based on the homeowners' preferences by working together to share the home members' usage data. Many papers are published on home occupancy detection. Occupancy and presence can be used in the contextual smart home to accurately determine the presence of someone in buildings or houses and also able to predict various events and pre-emptive action combines inexpensive, non-intrusive sensors including CO2, temperature, sound, light, and movement with the aid of supervised learning methods like quadratic random forest and support vector machine (SVM). This method primarily focuses on reliably predicting the total occupants in an area with the help of a combination of heterogeneous sensor nodes and ML algorithms with the greatest 98.4% and the highest 0.953 F1 score. This paper primarily focuses on reliably determining the people in a room utilizing numerous sensor nodes that are heterogeneous in nature and machine learning algorithms, using various parameters such as CO2, temperature, light, sound, and motion with the help of supervised learning methods like Logistic regression, Naive Bayes, SVM Linear Kernel, KNN, Decision tree, Random Forest, SVM RBF Kernel, with the Maximum Accuracy of 99.62% and F1 score 0.996 The effectiveness of a scaled dimensional data set was further assessed using linear discriminant analysis i.e. LDA and principal component analysis i.e. PCA.