In this modern age of technology, the Internet of things has covered all aspects of life including smart situations, smart homes, and smart spaces. Smart homes have a large number of IoT objects that are working continuously without any interruption. Better security and authentication of these smart devices can provide peaceful environments to live in such spaces. It is important to monitor the activities of smart IoT devices to make them work fault free. Such devices are small, consume relatively less power and resources, and are easily attackable by attackers. It is crucial to protect the integrity and characteristics of the smart home environment from external attacks. Machine Learning played a vital role in recognizing such malicious activities and attempts. Several Machine Learning approaches are available to detect the normal and abnormal behavior of IoT device traffic. This study proposed a machine learning-based anomaly detection approach for smart homes using different classifiers. Testing and evaluation are performed using the University of New South Wales (UNSW) BoT IoT dataset. Machine learning models based on four classifiers are built using an IoT devices dataset. For the Test dataset, the Weighted Precision, Recall and F1 score of Random forest, decision tree, and AdaBoost is 1 as compared to ANN which has 0.98, 0.96, and 0.96 respectively Results show that high performance, precision, and robustness can be achieved using the proposed methodology. In this way, smart homes' security and identity of devices can be monitored and anomalies can be detected with high accuracy. Attack categories include binary class, multiclass class, and subclasses. Results show Random Forest algorithm outperforms enough to use this methodology in smart environments.