Update the the Charging Station's heart beat whenever it connects to the backend
MODIFY
src/server/ocpp/json/JsonWSConnection.ts
src/server/ocpp/json/JsonWSConnection.ts
@@ -73,9 +73,7 @@ export default class JsonWSConnection extends WSConnection {
Address: this.getClientIP()
}
};
- // Ok
this.initialized = true;
- // Log
await Logging.logInfo({
tenantID: this.getTenantID(),
source: this.getChargingStationID(),

MODIFY
src/server/ocpp/json/WSConnection.ts
src/server/ocpp/json/WSConnection.ts
@@ -123,17 +123,16 @@ export default abstract class WSConnection {
// Check Tenant?
await DatabaseUtils.checkTenant(this.tenantID);
this.validTenant = true;
- // Cloud Foundry?
- if (Configuration.isCloudFoundry()) {
- // Yes: Save the CF App and Instance ID to call the Charging Station from the Rest server
+ // Update the Charging Station
const chargingStation = await ChargingStationStorage.getChargingStation(this.tenantID, this.getChargingStationID(), {}, ['id']);
if (chargingStation) {
- // Update CF Instance
- await ChargingStationStorage.saveChargingStationCFApplicationIDAndInstanceIndex(
- this.tenantID, chargingStation.id, Configuration.getCFApplicationIDAndInstanceIndex());
// Update Last Seen
await ChargingStationStorage.saveChargingStationLastSeen(this.getTenantID(),
chargingStation.id, { lastSeen: new Date() });
+ // Update CF Instance
+ if (Configuration.isCloudFoundry()) {
+ await ChargingStationStorage.saveChargingStationCFApplicationIDAndInstanceIndex(
+ this.tenantID, chargingStation.id, Configuration.getCFApplicationIDAndInstanceIndex());
}
}
} catch (error) {

Update the the Charging Station's heart beat whenever it connects to the backend