The integration of the Internet of Things (IoT) and MultiFunction Energy Meter into the power grid underscores the critical need for robust cybersecurity measures to manage data effectively. Ensuring the accuracy and integrity of data transmitted and stored by smart meters is imperative for maintaining the reliability of the entire energy grid. Unauthorized alterations to energy consumption data pose risks of financial losses for utility companies and potential disruptions to service for consumers. Using machine learning (ML) techniques, this study presents an IoT-enabled cyberattack detection system (IoT-E-CADS) for the advanced metering infrastructure (AMI). According to industry standards, the suggested Bi-level IoT-E-CADS can identify two different kinds of threats in a smart grid setting. The Isolation Forest algorithm for ML is used at the initial level to identify anomalies and cyberattacks in real-time systems. Subsequently, the Decision Tree ML algorithm is utilized at the second level to identify cyberattacks and instances of false data injection in real-time systems. The designed hardware has been implemented and rigorously tested at Quantanics TechServ Pvt. Ltd., situated in Madurai, Tamil Nadu, India. This business runs an AMI facility with 10 smart meters, an information filter, and an exclusive server system. This allows for thorough tracking and archiving of the electrical parameters and energy profile of the business. At this location, the suggested IoT-E-CADS has been deployed successfully and has successfully detected two manually generated cyberattacks. Analysis of the obtained results demonstrates that the IoT-E-CADS is capable of detecting cyberthreats with an accuracy level of 95%, thereby providing comprehensive cybersecurity solutions for secure monitoring units in commercial environments.