Reduce logs on non existent OCPP param
MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -1709,16 +1709,6 @@ export default class OCPPUtils {
const currentOcppParam: OcppParameter = currentOcppParameters.find(
(ocppParam) => ocppParam.key === ocppParameter.key);
try {
- // Not Found
- if (!currentOcppParam) {
- Logging.logWarning({
- tenantID: tenantID,
- source: chargingStation.id,
- action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
- module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `OCPP Parameter '${ocppParameter.key}' not found in Charging Station's configuration`
- });
- }
// Check Value
if (currentOcppParam && currentOcppParam.value === ocppParameter.value) {
// Ok: Already the good value
@@ -1743,7 +1733,7 @@ export default class OCPPUtils {
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `OCPP Parameter '${ocppParameter.key}' has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
+ message: `${!currentOcppParam && 'Non existent '}OCPP Parameter '${ocppParameter.key}' has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
});
} else if (result.status === OCPPConfigurationStatus.REBOOT_REQUIRED) {
updatedOcppParams.inSuccess++;
@@ -1753,7 +1743,7 @@ export default class OCPPUtils {
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `OCPP Parameter '${ocppParameter.key}' that requires reboot has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
+ message: `${!currentOcppParam && 'Non existent '}OCPP Parameter '${ocppParameter.key}' that requires reboot has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
});
} else {
updatedOcppParams.inError++;
@@ -1762,7 +1752,7 @@ export default class OCPPUtils {
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `Error '${result.status}' in changing OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}': `
+ message: `Error '${result.status}' in changing ${!currentOcppParam && 'non existent '}OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}': `
});
}
} catch (error) {
@@ -1772,7 +1762,7 @@ export default class OCPPUtils {
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `Error in changing OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}'`,
+ message: `Error in changing ${!currentOcppParam && 'non existent '}OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}'`,
detailedMessages: { error: error.message, stack: error.stack }
});
}

Reduce logs on non existent OCPP param