email support team when an installation turns red
This commit is contained in:
parent
64c8abd108
commit
334c1cdbe1
|
|
@ -2,6 +2,7 @@ using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using InnovEnergy.App.Backend.Database;
|
using InnovEnergy.App.Backend.Database;
|
||||||
using InnovEnergy.App.Backend.DataTypes;
|
using InnovEnergy.App.Backend.DataTypes;
|
||||||
|
using InnovEnergy.App.Backend.DataTypes.Methods;
|
||||||
using InnovEnergy.Lib.Utils;
|
using InnovEnergy.Lib.Utils;
|
||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
|
|
@ -186,6 +187,20 @@ public static class RabbitMqManager
|
||||||
|
|
||||||
Db.UpdateInstallationStatus(installationId, receivedStatusMessage.Status);
|
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("----------------------------------------------");
|
//Console.WriteLine("----------------------------------------------");
|
||||||
//If the status has changed, update all the connected front-ends regarding this installation
|
//If the status has changed, update all the connected front-ends regarding this installation
|
||||||
if(prevStatus != receivedStatusMessage.Status && WebsocketManager.InstallationConnections[installationId].Connections.Count > 0)
|
if(prevStatus != receivedStatusMessage.Status && WebsocketManager.InstallationConnections[installationId].Connections.Count > 0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue