};
export const resetConnectorStatus = (connectorStatus: ConnectorStatus): void => {
+ connectorStatus.chargingProfiles =
+ connectorStatus.transactionId && isNotEmptyArray(connectorStatus.chargingProfiles)
+ ? connectorStatus.chargingProfiles?.filter(
+ (chargingProfile) => chargingProfile.transactionId !== connectorStatus.transactionId,
+ )
+ : [];
connectorStatus.idTagLocalAuthorized = false;
connectorStatus.idTagAuthorized = false;
connectorStatus.transactionRemoteStarted = false;
/**
* Gets the connector cloned charging profiles applying a power limitation
- * and sorted by connector id ascending then stack level descending
+ * and sorted by connector id descending then stack level descending
*
* @param chargingStation -
* @param connectorId -
connectorId: number,
) => {
return cloneObject<ChargingProfile[]>(
- (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? [])
+ (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? [])
.sort((a, b) => b.stackLevel - a.stackLevel)
.concat(
- (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []).sort(
+ (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? []).sort(
(a, b) => b.stackLevel - a.stackLevel,
),
),
}
/**
- * Charging profiles shall already be sorted by connector id ascending then stack level descending
+ * Charging profiles shall already be sorted by connector id descending then stack level descending
*
* @param chargingStation -
* @param connectorId -
);
return false;
}
- if (isNullOrUndefined(chargingProfile.chargingSchedule.startSchedule)) {
+ if (
+ chargingProfile.chargingProfileKind === ChargingProfileKindType.RECURRING &&
+ isNullOrUndefined(chargingProfile.chargingSchedule.startSchedule)
+ ) {
logger.error(
`${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId} has no startSchedule defined`,
);