"logform": "^2.5.1",
"mnemonist": "^0.39.5",
"mongodb": "^5.7.0",
- "poolifier": "^2.6.20",
+ "poolifier": "^2.6.21",
"source-map-support": "^0.5.21",
"tar": "^6.1.15",
"tslib": "^2.6.1",
specifier: ^5.7.0
version: 5.7.0
poolifier:
- specifier: ^2.6.20
- version: 2.6.20
+ specifier: ^2.6.21
+ version: 2.6.21
source-map-support:
specifier: ^0.5.21
version: 0.5.21
dependencies:
semver-compare: 1.0.0
- /poolifier@2.6.20:
- resolution: {integrity: sha512-1s4Ylz09IU6o6NkYMGKmzM885VNpBzAdqPtoTZmpHkWT1Plyeh1L8VtmmS2nFWYapjSQ46H/Ypr6AeLc4mjkmg==}
+ /poolifier@2.6.21:
+ resolution: {integrity: sha512-TOTocb/Ek8UfZBvoJNWlEWSQJUv6In0GCGwMyI8W+WHfaS2ukkxwfYJE+AcVA9ezPfZTDso+AsqLVrs1acTWDA==}
engines: {node: '>=16.14.0', pnpm: '>=8.6.0'}
requiresBuild: true
dev: false
};
export const resetConnectorStatus = (connectorStatus: ConnectorStatus): void => {
- connectorStatus.chargingProfiles = isNotEmptyArray(connectorStatus.chargingProfiles)
- ? connectorStatus.chargingProfiles?.filter(
- (chargingProfile) => chargingProfile.transactionId !== connectorStatus?.transactionId,
- )
- : [];
+ connectorStatus.chargingProfiles =
+ connectorStatus.transactionId && isNotEmptyArray(connectorStatus.chargingProfiles)
+ ? connectorStatus.chargingProfiles?.filter(
+ (chargingProfile) => chargingProfile.transactionId !== connectorStatus.transactionId,
+ )
+ : [];
connectorStatus.idTagLocalAuthorized = false;
connectorStatus.idTagAuthorized = false;
connectorStatus.transactionRemoteStarted = false;
}
if (
csChargingProfiles.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE &&
- (connectorId === 0 ||
- chargingStation.getConnectorStatus(connectorId)?.transactionStarted === false)
+ connectorId === 0
+ ) {
+ logger.error(
+ `${chargingStation.logPrefix()} Trying to set transaction charging profile(s)
+ on connector ${connectorId}`,
+ );
+ return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED;
+ }
+ const connectorStatus = chargingStation.getConnectorStatus(connectorId);
+ if (
+ csChargingProfiles.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE &&
+ connectorId > 0 &&
+ connectorStatus?.transactionStarted === false
) {
logger.error(
`${chargingStation.logPrefix()} Trying to set transaction charging profile(s)
);
return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED;
}
+ if (
+ csChargingProfiles.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE &&
+ connectorId > 0 &&
+ connectorStatus?.transactionStarted === true &&
+ csChargingProfiles.transactionId !== connectorStatus?.transactionId
+ ) {
+ logger.error(
+ `${chargingStation.logPrefix()} Trying to set transaction charging profile(s)
+ on connector ${connectorId} with a different transaction id ${
+ csChargingProfiles.transactionId
+ } than the started transaction id ${connectorStatus?.transactionId}`,
+ );
+ return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED;
+ }
OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, csChargingProfiles);
logger.debug(
`${chargingStation.logPrefix()} Charging profile(s) set on connector id ${connectorId}: %j`,