) === false
) {
logger.warn(
- `${chargingStation.logPrefix()} Cannot simulate firmware update: feature profile not supported`
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestUpdateFirmware: Cannot simulate firmware update: feature profile not supported`
);
return OCPPConstants.OCPP_RESPONSE_EMPTY;
}
chargingStation.stationInfo.firmwareStatus !== OCPP16FirmwareStatus.Installed
) {
logger.warn(
- `${chargingStation.logPrefix()} Cannot simulate firmware update: firmware update is already in progress`
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestUpdateFirmware: Cannot simulate firmware update: firmware update is already in progress`
);
return OCPPConstants.OCPP_RESPONSE_EMPTY;
}
private async updateFirmware(
chargingStation: ChargingStation,
- minDelay = 15,
- maxDelay = 30
+ maxDelay = 30,
+ minDelay = 15
): Promise<void> {
chargingStation.stopAutomaticTransactionGenerator();
for (const connectorId of chargingStation.connectors.keys()) {
status: OCPP16FirmwareStatus.Downloading,
});
chargingStation.stationInfo.firmwareStatus = OCPP16FirmwareStatus.Downloading;
- await Utils.sleep(Utils.getRandomInteger(minDelay, maxDelay) * 1000);
+ await Utils.sleep(Utils.getRandomInteger(maxDelay, minDelay) * 1000);
await chargingStation.ocppRequestService.requestHandler<
OCPP16FirmwareStatusNotificationRequest,
OCPP16FirmwareStatusNotificationResponse
status: OCPP16FirmwareStatus.Downloaded,
});
chargingStation.stationInfo.firmwareStatus = OCPP16FirmwareStatus.Downloaded;
- await Utils.sleep(Utils.getRandomInteger(minDelay, maxDelay) * 1000);
+ await Utils.sleep(Utils.getRandomInteger(maxDelay, minDelay) * 1000);
await chargingStation.ocppRequestService.requestHandler<
OCPP16FirmwareStatusNotificationRequest,
OCPP16FirmwareStatusNotificationResponse
});
chargingStation.stationInfo.firmwareStatus = OCPP16FirmwareStatus.Installing;
if (chargingStation.getFirmwareUpgrade().reset === true) {
- await Utils.sleep(Utils.getRandomInteger(minDelay, maxDelay) * 1000);
+ await Utils.sleep(Utils.getRandomInteger(maxDelay, minDelay) * 1000);
await chargingStation.reset(OCPP16StopTransactionReason.REBOOT);
}
}
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS
) === false
) {
+ logger.warn(
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetDiagnostics: Cannot get diagnostics: feature profile not supported`
+ );
return OCPPConstants.OCPP_RESPONSE_EMPTY;
}
const uri = new URL(commandPayload.location);