Skip to content

Commit

Permalink
Merge pull request #4161 from sap-labs-france/UpdateChargingStationWi…
Browse files Browse the repository at this point in the history
…thTemplate-lessVerbose

UpdateChargingStationWithTemplate - less verbose
  • Loading branch information
Claude ROSSI authored Mar 28, 2023
2 parents 1100bfe + f39ca59 commit b5dbfa3
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions src/server/ocpp/utils/OCPPUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,10 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationConnectorWithTemplate',
message: `Template for Connector ID '${connector.connectorId}' cannot be applied on manual configured charging station`,
detailedMessages: { chargingStation, connector }
detailedMessages: {
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation),
connector
}
});
return false;
}
Expand Down Expand Up @@ -880,7 +883,6 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationConnectorWithTemplate',
message: `Template ID '${chargingStationTemplate.id}' has been applied on Connector ID '${connector.connectorId}' with success`,
detailedMessages: { chargingStationTemplate, chargingStation }
});
return true;
}
Expand All @@ -891,7 +893,10 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationConnectorWithTemplate',
message: `No Connector found in Template ID '${chargingStationTemplate.id}'`,
detailedMessages: { chargingStationTemplate, chargingStation }
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate),
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation)
}
});
return false;
}
Expand All @@ -902,7 +907,10 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationConnectorWithTemplate',
message: 'No Template has been found for this Charging Station',
detailedMessages: { chargingStation, connector }
detailedMessages: {
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation),
connector
}
});
return false;
}
Expand Down Expand Up @@ -1521,7 +1529,9 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplate',
message: 'Template cannot be applied on manual configured charging station',
detailedMessages: { chargingStation }
detailedMessages: {
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation)
}
});
return templateUpdateResult;
}
Expand Down Expand Up @@ -1563,17 +1573,6 @@ export default class OCPPUtils {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate),
}
});
} else {
await Logging.logDebug({
...LoggingHelper.getChargingStationProperties(chargingStation),
tenantID: tenant.id,
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplate',
message: `Template ID '${chargingStationTemplate.id}' has already been applied`,
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate)
}
});
}
// Master/Slave: always override the charge point
if (chargingStationTemplate.template.technical.masterSlave) {
Expand Down Expand Up @@ -1648,7 +1647,9 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplate',
message: `Template contains power limitation key '${parameter}' in OCPP parameters, skipping. Remove it from template!`,
detailedMessages: { chargingStationTemplate }
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate)
}
});
continue;
}
Expand All @@ -1659,7 +1660,9 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplate',
message: `Template contains heartbeat interval key '${parameter}' in OCPP parameters, skipping. Remove it from template`,
detailedMessages: { chargingStationTemplate }
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate)
}
});
continue;
}
Expand All @@ -1678,7 +1681,10 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplateOcppParams',
message: `Cannot find a matching section named '${ocppProperty}' in Template ID '${chargingStationTemplate.id}'`,
detailedMessages: { chargingStationTemplate, chargingStation }
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate),
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation)
}
});
}
}
Expand Down Expand Up @@ -1725,7 +1731,10 @@ export default class OCPPUtils {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
module: MODULE_NAME, method: 'enrichChargingStationWithTemplateCapabilities',
message: `Cannot find a matching section named 'capabilities' in Template ID '${chargingStationTemplate.id}'`,
detailedMessages: { chargingStationTemplate, chargingStation }
detailedMessages: {
templateData: LoggingHelper.shrinkTemplateProperties(chargingStationTemplate),
chargingStationData: LoggingHelper.shrinkChargingStationProperties(chargingStation)
}
});
}
}
Expand Down

0 comments on commit b5dbfa3

Please sign in to comment.