diff --git a/csharp/App/Backend/Websockets/RabbitMQManager.cs b/csharp/App/Backend/Websockets/RabbitMQManager.cs index 5d4328224..39f67a6e4 100644 --- a/csharp/App/Backend/Websockets/RabbitMQManager.cs +++ b/csharp/App/Backend/Websockets/RabbitMQManager.cs @@ -2,6 +2,7 @@ using System.Text; using System.Text.Json; using InnovEnergy.App.Backend.Database; using InnovEnergy.App.Backend.DataTypes; +using InnovEnergy.App.Backend.DataTypes.Methods; using InnovEnergy.Lib.Utils; using RabbitMQ.Client; using RabbitMQ.Client.Events; @@ -186,6 +187,20 @@ public static class RabbitMqManager Db.UpdateInstallationStatus(installationId, receivedStatusMessage.Status); + const int AlarmStatus = 2; + var isSodistore = installation.Product is 2 or 3 or 4 or 5; + if (isSodistore + && prevStatus != AlarmStatus + && receivedStatusMessage.Status == AlarmStatus) + { + var prev = prevStatus; + _ = Task.Run(async () => + { + try { await installation.SendAlarmNotificationToSupport(prev); } + catch (Exception ex) { Console.WriteLine($"[AlarmNotify] failed for {installationId}: {ex.Message}"); } + }); + } + //Console.WriteLine("----------------------------------------------"); //If the status has changed, update all the connected front-ends regarding this installation if(prevStatus != receivedStatusMessage.Status && WebsocketManager.InstallationConnections[installationId].Connections.Count > 0)