Update non-existing OCPP parameter + Fixed typos
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -207,23 +207,26 @@ export default class OCPPService {
setTimeout(async () => {
let result: OCPPChangeConfigurationCommandResult;
// Synchronize heartbeat interval OCPP parameter for charging stations that do not take into account its value in the boot notification response
- let HeartBeatIntervalSettingFailure = false;
+ // Set OCPP 'HeartBeatInterval'
+ let heartBeatIntervalSettingFailure = false;
result = await OCPPUtils.requestChangeChargingStationOcppParameter(headers.tenantID, chargingStation, {
key: 'HeartBeatInterval',
value: heartbeatIntervalSecs.toString()
}, false);
if (result.status !== OCPPConfigurationStatus.ACCEPTED) {
- HeartBeatIntervalSettingFailure = true;
+ heartBeatIntervalSettingFailure = true;
}
+ // Set OCPP 'HeartbeatInterval'
result = await OCPPUtils.requestChangeChargingStationOcppParameter(headers.tenantID, chargingStation, {
key: 'HeartbeatInterval',
value: heartbeatIntervalSecs.toString()
}, false);
- let HeartbeatIntervalSettingFailure = false;
+ let heartbeatIntervalSettingFailure = false;
if (result.status !== OCPPConfigurationStatus.ACCEPTED) {
- HeartbeatIntervalSettingFailure = true;
+ heartbeatIntervalSettingFailure = true;
}
- if (HeartBeatIntervalSettingFailure && HeartbeatIntervalSettingFailure) {
+ // Check
+ if (heartBeatIntervalSettingFailure && heartbeatIntervalSettingFailure) {
Logging.logError({
tenantID: headers.tenantID,
action: ServerAction.BOOT_NOTIFICATION,

MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -1709,20 +1709,18 @@ export default class OCPPUtils {
const currentOcppParam: OcppParameter = currentOcppParameters.find(
(ocppParam) => ocppParam.key === ocppParameter.key);
try {
+ // Not Found
if (!currentOcppParam) {
- // Not Found in Charging Station!
- Logging.logError({
+ 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`
});
- updatedOcppParams.inError++;
- continue;
}
// Check Value
- if (ocppParameter.value === currentOcppParam.value) {
+ if (currentOcppParam && currentOcppParam.value === ocppParameter.value) {
// Ok: Already the good value
Logging.logInfo({
tenantID: tenantID,
@@ -1739,17 +1737,15 @@ export default class OCPPUtils {
value: ocppParameter.value
}, false);
if (result.status === OCPPConfigurationStatus.ACCEPTED) {
- // Ok
updatedOcppParams.inSuccess++;
Logging.logInfo({
tenantID: tenantID,
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `OCPP Parameter '${currentOcppParam.key}' has been successfully set from '${currentOcppParam.value}' to '${ocppParameter.value}'`
+ message: `OCPP Parameter '${ocppParameter.key}' has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
});
} else if (result.status === OCPPConfigurationStatus.REBOOT_REQUIRED) {
- // Ok
updatedOcppParams.inSuccess++;
rebootRequired = true;
Logging.logInfo({
@@ -1757,7 +1753,7 @@ export default class OCPPUtils {
source: chargingStation.id,
action: ServerAction.CHARGING_STATION_CHANGE_CONFIGURATION,
module: MODULE_NAME, method: 'updateChargingStationTemplateOcppParameters',
- message: `OCPP Parameter '${currentOcppParam.key}' that requires reboot has been successfully set from '${currentOcppParam.value}' to '${ocppParameter.value}'`
+ message: `OCPP Parameter '${ocppParameter.key}' that requires reboot has been successfully set from '${currentOcppParam?.value}' to '${ocppParameter.value}'`
});
} else {
updatedOcppParams.inError++;
@@ -1766,7 +1762,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 OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}': `
});
}
} catch (error) {
@@ -1776,7 +1772,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 OCPP Parameter '${ocppParameter.key}' from '${currentOcppParam?.value}' to '${ocppParameter.value}'`,
detailedMessages: { error: error.message, stack: error.stack }
});
}

Update non-existing OCPP parameter + Fixed typos