The occurrence of electricity usage that exceeds the power capacity of the home requires a smart home system that can monitor electricity consumption efficiently. This smart home system is built based on the Internet of Things (IoT) which can help electricity users at home to evaluate usage more easily and in an integrated manner. The development of this IoT-based smart home system uses the ESP32 Micro Controller Unit (MCU) and the PZEM-004T v.3.0 sensor. The reading results from the system can be seen on the front end of the web-based application and the LCD module on the controller system. To obtain the efficiency of electricity usage, an electricity usage leakage detection system is needed or in this case, it is called an intrusion detection system or Intrusion Detection System (IDS). The development of IDS by identifying anomalies based on electricity usage. The IDS model utilizes Machine Learning with a labelling process pattern as a preprocess using the Isolation Forest unsupervised learning algorithm and the classification process using the Random Forest supervised learning algorithm with Anomaly and Normal status. Evaluation of the IDS model on the dataset that has gone through labelling gives quite good results with an accuracy value of 99.63 %. IDS Model is ready to be tested in the implementation of classifying recorded data in real-time against several electrical energy load scenarios in the future.