Remove timestamps from heartbit,
update configuration for discharge
This commit is contained in:
parent
7510ee0ce2
commit
bea24fde97
|
|
@ -6,9 +6,12 @@ public class Configuration
|
|||
public Double GridSetPoint { get; set; }
|
||||
public CalibrationChargeType CalibrationChargeState { get; set; }
|
||||
public DateTime CalibrationChargeDate { get; set; }
|
||||
public CalibrationChargeType CalibrationDischargeState { get; set; }
|
||||
public DateTime CalibrationDischargeDate { get; set; }
|
||||
public String GetConfigurationString()
|
||||
{
|
||||
return $"MinimumSoC: {MinimumSoC}, GridSetPoint: {GridSetPoint}, CalibrationChargeState: {CalibrationChargeState}, CalibrationChargeDate: {CalibrationChargeDate}";
|
||||
return $"MinimumSoC: {MinimumSoC}, GridSetPoint: {GridSetPoint}, CalibrationChargeState: {CalibrationChargeState}, CalibrationChargeDate: {CalibrationChargeDate}, " +
|
||||
$"CalibrationDischargeState: {CalibrationDischargeState}, CalibrationDischargeDate: {CalibrationDischargeDate}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ public static class UserMethods
|
|||
public static Task SendPasswordResetEmail(this User user, String token)
|
||||
{
|
||||
const String subject = "Reset the password of your Inesco Energy Account";
|
||||
const String resetLink = "https://monitor.innov.energy/api/ResetPassword"; // TODO: move to settings file
|
||||
const String resetLink = "https://monitor.inesco.energy/api/ResetPassword"; // TODO: move to settings file
|
||||
var encodedToken = HttpUtility.UrlEncode(token);
|
||||
|
||||
var body = $"Dear {user.Name}\n" +
|
||||
|
|
@ -249,7 +249,7 @@ public static class UserMethods
|
|||
{
|
||||
const String subject = "Your new Inesco Energy Account";
|
||||
|
||||
var resetLink = $"https://monitor.innov.energy/?username={user.Email}"; // TODO: move to settings file
|
||||
var resetLink = $"https://monitor.inesco.energy/?username={user.Email}"; // TODO: move to settings file
|
||||
|
||||
var body = $"Dear {user.Name}\n" +
|
||||
$"To set your password and log in to your " +
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public static class Program
|
|||
WebsocketManager.MonitorSodistoreInstallationTable().SupressAwaitWarning();
|
||||
|
||||
|
||||
Task.Run(() => DeleteOldDataFromS3.DeleteOldData());
|
||||
// Task.Run(() => DeleteOldDataFromS3.DeleteOldData());
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddProblemDetails(setup =>
|
||||
|
|
|
|||
|
|
@ -93,17 +93,17 @@ public static class RabbitMqManager
|
|||
if (installation.Product == (int)ProductType.Salimax)
|
||||
{
|
||||
monitorLink =
|
||||
$"https://monitor.innov.energy/installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
$"https://monitor.inesco.energy/installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
}
|
||||
else if (installation.Product == (int)ProductType.SodiStoreMax)
|
||||
{
|
||||
monitorLink =
|
||||
$"https://monitor.innov.energy/sodistore_installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
$"https://monitor.inesco.energy/sodistore_installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
}
|
||||
else
|
||||
{
|
||||
monitorLink =
|
||||
$"https://monitor.innov.energy/salidomo_installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
$"https://monitor.inesco.energy/salidomo_installations/list/installation/{installation.S3BucketId}/batteryview";
|
||||
}
|
||||
|
||||
foreach (var alarm in receivedStatusMessage.Alarms)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ public class StatusMessage
|
|||
public required MessageType Type { get; set; }
|
||||
public List<AlarmOrWarning>? Warnings { get; set; }
|
||||
public List<AlarmOrWarning>? Alarms { get; set; }
|
||||
public Int32 Timestamp { get; set; }
|
||||
}
|
||||
|
||||
public enum MessageType
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ public class StatusMessage
|
|||
public required MessageType Type { get; set; }
|
||||
public List<AlarmOrWarning>? Warnings { get; set; }
|
||||
public List<AlarmOrWarning>? Alarms { get; set; }
|
||||
public Int32 Timestamp { get; set; }
|
||||
}
|
||||
|
||||
public enum MessageType
|
||||
|
|
|
|||
|
|
@ -338,16 +338,6 @@ internal static class Program
|
|||
if (s3Bucket != null)
|
||||
RabbitMqManager.InformMiddleware(currentSalimaxState);
|
||||
}
|
||||
// else if (_subscribedToQueue && _heartBitInterval >= 30)
|
||||
// {
|
||||
// //Send a heartbit to the backend
|
||||
// Console.WriteLine("----------------------------------------Sending Heartbit----------------------------------------");
|
||||
// _heartBitInterval = 0;
|
||||
// currentSalimaxState.Type = MessageType.Heartbit;
|
||||
//
|
||||
// if (s3Bucket != null)
|
||||
// RabbitMqManager.InformMiddleware(currentSalimaxState);
|
||||
// }
|
||||
|
||||
//If there is an available message from the RabbitMQ Broker, apply the configuration file
|
||||
Configuration? config = SetConfigurationFile();
|
||||
|
|
@ -867,21 +857,17 @@ internal static class Program
|
|||
foreach (var line in csv.Split('\n'))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
string[] parts = line.Split(';');
|
||||
//if (parts.Length < 2) continue;
|
||||
|
||||
string keyPath = parts[0];
|
||||
string value = parts[1];
|
||||
string unit = parts.Length > 2 ? parts[2].Trim() : "";
|
||||
|
||||
var parts = line.Split(';');
|
||||
var keyPath = parts[0];
|
||||
var value = parts[1];
|
||||
var unit = parts.Length > 2 ? parts[2].Trim() : "";
|
||||
//Console.WriteLine(line);
|
||||
// Console.WriteLine($"Key: {keyPath}, Value: {value}, Unit: {unit}");
|
||||
|
||||
// Console.WriteLine($"Key: {keyPath}, Value: {value}, Unit: {unit}");
|
||||
InsertIntoJson(jsonData, keyPath.Split('/'), value);
|
||||
|
||||
}
|
||||
|
||||
string jsonOutput = JsonConvert.SerializeObject(jsonData, Formatting.None);
|
||||
var jsonOutput = JsonConvert.SerializeObject(jsonData, Formatting.None);
|
||||
jsonOutput.LogInfo();
|
||||
|
||||
await RestApiSavingFile(csv);
|
||||
|
|
@ -927,24 +913,23 @@ internal static class Program
|
|||
Console.WriteLine("ERROR: PUT");
|
||||
var error = await response.GetStringAsync();
|
||||
Console.WriteLine(error);
|
||||
Heartbit(new DateTime(0));
|
||||
Heartbit();
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine("----------------------------------------Sending Heartbit----------------------------------------");
|
||||
|
||||
Heartbit(timeStamp);
|
||||
Heartbit();
|
||||
}
|
||||
_counterOfFile++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void Heartbit(DateTime timeStamp)
|
||||
private static void Heartbit()
|
||||
{
|
||||
var s3Bucket = Config.Load().S3?.Bucket;
|
||||
var tryParse = TryParse(s3Bucket?.Split("-")[0], out var installationId);
|
||||
var parse = TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfCsvFile);
|
||||
|
||||
if (tryParse)
|
||||
{
|
||||
|
|
@ -954,7 +939,6 @@ internal static class Program
|
|||
Product = 0, // Salimax is always 0
|
||||
Status = _salimaxAlarmState,
|
||||
Type = MessageType.Heartbit,
|
||||
Timestamp = nameOfCsvFile
|
||||
};
|
||||
if (s3Bucket != null)
|
||||
RabbitMqManager.InformMiddleware(returnedStatus);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ public class StatusMessage
|
|||
public required MessageType Type { get; set; }
|
||||
public List<AlarmOrWarning>? Warnings { get; set; }
|
||||
public List<AlarmOrWarning>? Alarms { get; set; }
|
||||
public Int32 Timestamp { get; set; }
|
||||
}
|
||||
|
||||
public enum MessageType
|
||||
|
|
|
|||
|
|
@ -859,24 +859,23 @@ internal static class Program
|
|||
Console.WriteLine("ERROR: PUT");
|
||||
var error = await response.GetStringAsync();
|
||||
Console.WriteLine(error);
|
||||
Heartbit(new DateTime(0));
|
||||
Heartbit();
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine("----------------------------------------Sending Heartbit----------------------------------------");
|
||||
|
||||
Heartbit(timeStamp);
|
||||
Heartbit();
|
||||
}
|
||||
_fileCounter++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void Heartbit(DateTime timeStamp)
|
||||
private static void Heartbit()
|
||||
{
|
||||
var s3Bucket = Config.Load().S3?.Bucket;
|
||||
var tryParse = int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
|
||||
var parse = int.TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfJsonFile);
|
||||
|
||||
if (tryParse)
|
||||
{
|
||||
|
|
@ -886,7 +885,6 @@ internal static class Program
|
|||
Product = 3, // Salimax is always 0
|
||||
Status = _salimaxAlarmState,
|
||||
Type = MessageType.Heartbit,
|
||||
Timestamp = nameOfJsonFile
|
||||
};
|
||||
if (s3Bucket != null)
|
||||
RabbitMqManager.InformMiddleware(returnedStatus);
|
||||
|
|
|
|||
Loading…
Reference in New Issue