Despite the massive production of shallots in Enrekang Regency, South Sulawesi Province, Indonesia, the cultivation method is still very conventional. Shallot cultivation is very challenging because it requires precision irrigation and pest prevention. In this research, we proposed a smart irrigation system to help farmers manage irrigation with more efficient water usage without hampering their pest prevention. The results of the system were three options: 1) no water needed, 2) water is required and is efficient for irrigation, and 3) water is required but it is not efficient for irrigation. We used Wireless Sensor Networks and IoT to collect yield parameters, designed a firebase database, and developed a mobile application and a web service embedded with a machine learning application. All applications interacted using the representational state transfer application programming interface. The proposed system architecture successfully gathered cropland data and distributed them to all applications within the system. Furthermore, we analyzed four supervised learning algorithms (decision trees, random forest, gradient boosting, and K-Nearest neighbor), and the random forest was deployed in the web service because it outperformed other algorithms with a precision of 94% and an AUC score of 0.90.