- chargingStation
- .getConnectorStatus(connectorId)
- ?.chargingProfiles?.forEach((chargingProfile: OCPP16ChargingProfile, index: number) => {
- if (
- chargingProfile.chargingProfileId === cp.chargingProfileId ||
- (chargingProfile.stackLevel === cp.stackLevel &&
- chargingProfile.chargingProfilePurpose === cp.chargingProfilePurpose)
- ) {
- chargingStation.getConnectorStatus(connectorId)!.chargingProfiles![index] = cp;
- cpReplaced = true;
- }
- });
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ for (const [index, chargingProfile] of chargingStation
+ .getConnectorStatus(connectorId)!
+ .chargingProfiles!.entries()) {
+ if (
+ chargingProfile.chargingProfileId === cp.chargingProfileId ||
+ (chargingProfile.stackLevel === cp.stackLevel &&
+ chargingProfile.chargingProfilePurpose === cp.chargingProfilePurpose)
+ ) {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ chargingStation.getConnectorStatus(connectorId)!.chargingProfiles![index] = cp
+ cpReplaced = true
+ }
+ }