OCPP16StandardParametersKey,
OCPP16SupportedFeatureProfiles,
} from '../../../types/ocpp/1.6/Configuration';
+import { URL, fileURLToPath } from 'url';
import type ChargingStation from '../../ChargingStation';
import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils';
+import { ChargingStationUtils } from '../../ChargingStationUtils';
import Constants from '../../../utils/Constants';
import { DefaultResponse } from '../../../types/ocpp/Responses';
import { ErrorType } from '../../../types/ocpp/ErrorType';
import { OCPPConfigurationKey } from '../../../types/ocpp/Configuration';
import OCPPError from '../../../exception/OCPPError';
import OCPPIncomingRequestService from '../OCPPIncomingRequestService';
-import { URL } from 'url';
import Utils from '../../../utils/Utils';
import fs from 'fs';
import logger from '../../../utils/Logger';
clearCurrentCP = true;
}
if (clearCurrentCP) {
- connectorStatus.chargingProfiles[index] = {} as OCPP16ChargingProfile;
+ connectorStatus.chargingProfiles.splice(index, 1);
logger.debug(
`${chargingStation.logPrefix()} Matching charging profile(s) cleared on connector id ${
commandPayload.connectorId
if (
chargingStation.getLocalAuthListEnabled() &&
chargingStation.hasAuthorizedTags() &&
- chargingStation.authorizedTags.find((value) => value === commandPayload.idTag)
+ chargingStation.authorizedTagsCache
+ .getAuthorizedTags(
+ ChargingStationUtils.getAuthorizationFile(chargingStation.stationInfo)
+ )
+ .find((value) => value === commandPayload.idTag)
) {
connectorStatus.localAuthorizeIdTag = commandPayload.idTag;
connectorStatus.idTagLocalAuthorized = true;
let ftpClient: Client;
try {
const logFiles = fs
- .readdirSync(path.resolve(__dirname, '../../../../'))
+ .readdirSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../'))
.filter((file) => file.endsWith('.log'))
.map((file) => path.join('./', file));
const diagnosticsArchive = chargingStation.stationInfo.chargingStationId + '_logs.tar.gz';
});
});
uploadResponse = await ftpClient.uploadFrom(
- path.join(path.resolve(__dirname, '../../../../'), diagnosticsArchive),
+ path.join(
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../'),
+ diagnosticsArchive
+ ),
uri.pathname + diagnosticsArchive
);
if (uploadResponse.code === 226) {