|
@@ -42,7 +42,7 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
|
|
|
{
|
|
|
List<EVSECurrentStatus> _EVSEs = GetEVSEs();
|
|
|
var checktime = DateTime.UtcNow.AddDays(-3);
|
|
|
- _EVSEs = _EVSEs.Where(x => x.HeartbeatUpdatedOn > checktime).ToList();
|
|
|
+ _EVSEs = _EVSEs.Where(x => x.HeartbeatUpdatedOn > checktime).ToList();
|
|
|
|
|
|
foreach (var evse in _EVSEs)
|
|
|
{
|
|
@@ -140,7 +140,7 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
|
|
|
else
|
|
|
{
|
|
|
//off - on
|
|
|
- UpdateEVSECurrentStatus(evse.CustomerId.ToString(), evse.ChargeBoxId, true, DefaultSetting.DefaultNullTime);
|
|
|
+ UpdateEVSECurrentStatus(evse.CustomerId.ToString(), evse.ChargeBoxId, true, DefaultSetting.DefaultNullTime);
|
|
|
|
|
|
insertData.Add(new EVSEOnlineRecord()
|
|
|
{
|
|
@@ -160,7 +160,7 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
|
|
|
|
|
|
if (evse.Online)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
//on -off
|
|
|
UpdateEVSECurrentStatus(evse.CustomerId.ToString(), evse.ChargeBoxId, false, evse.HeartbeatUpdatedOn);
|
|
|
|
|
@@ -216,20 +216,20 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
|
|
|
ClearCache();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
await UpdateOnlineRecords(updateData, insertData);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- logger.Debug("ERROR "+ this.ToString() + ex.ToString());
|
|
|
+ logger.Debug("ERROR " + this.ToString() + ex.ToString());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
logger.Debug(this.ToString() + " :Finished........");
|
|
|
|
|
@@ -405,15 +405,16 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
|
|
|
private bool IsOnlineNow(EVSECurrentStatus currentEVSE)
|
|
|
{
|
|
|
bool isOnline = false;
|
|
|
- int heartbeatInterval = int.Parse(currentEVSE.HeartbeatInterval);
|
|
|
+ int heartbeatInterval = 60;
|
|
|
+ int.TryParse(currentEVSE.HeartbeatInterval, out heartbeatInterval);
|
|
|
var checkTime = DateTime.UtcNow.AddSeconds(-(heartbeatInterval * 2));
|
|
|
|
|
|
if (currentEVSE.HeartbeatUpdatedOn > checkTime)
|
|
|
{
|
|
|
isOnline = true;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return isOnline;
|
|
|
|
|
|
}
|