Abstract:The rapid expansion of renewable energy deployment has accelerated the adoption of smart inverters in solar farms. However, their reliance on communication networks introduces cybersecurity vulnerabilities that make inverter measurements susceptible to manipulation. This paper presents an intrusion detection and mitigation system (IDMS) for smart inverters, which leverages machine learning algorithms and environmental sensor data to enhance data integrity and operational resilience. The proposed IDMS integrates the machine learning algorithms to combine a detection system with a mitigation system. The detection system integrates environmental sensor inputs with inverter measurements to accurately identify normal operating behavior and anomalous conditions in real time. To address the cumulative error challenges that arise during attacks, a prediction model based on long short-term memory (LSTM) and trained solely on environmental features is introduced in the mitigation system to reconstruct compromised voltage and current data, thereby preventing recursive cumulative error propagation and ensuring stable system operation. Case studies demonstrate that the proposed IDMS can promptly detect cyberattacks, replace compromised measurements with reliable estimates, and restore normal operation once attacks cease. Additional evaluations across varying data availability conditions in an open dataset confirm the robustness and scalability of the proposed IDMS, making it practical for diverse solar farm deployment environments.