Added exclude from smart charging prop in charging station
MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -65,10 +65,6 @@ export default class OCPPUtils {
if (Utils.objectHasProperty(chargingStationTemplate.technical, 'maximumPower')) {
chargingStation.maximumPower = chargingStationTemplate.technical.maximumPower;
}
- // Assign props
- if (Utils.objectHasProperty(chargingStationTemplate.technical, 'excludeFromPowerLimitation')) {
- chargingStation.excludeFromPowerLimitation = chargingStationTemplate.technical.excludeFromPowerLimitation;
- }
if (Utils.objectHasProperty(chargingStationTemplate.technical, 'chargePoints')) {
chargingStation.chargePoints = chargingStationTemplate.technical.chargePoints;
}

MODIFY
src/server/rest/service/ChargingStationService.ts
src/server/rest/service/ChargingStationService.ts
@@ -150,18 +150,19 @@ export default class ChargingStationService {
value: chargingStation.id
});
}
- // Update URL
+ // Update props
if (filteredRequest.chargingStationURL) {
chargingStation.chargingStationURL = filteredRequest.chargingStationURL;
}
- // Update Power Max
if (Utils.objectHasProperty(filteredRequest, 'maximumPower')) {
chargingStation.maximumPower = filteredRequest.maximumPower;
}
- // Update Private property
if (Utils.objectHasProperty(filteredRequest, 'private')) {
chargingStation.private = filteredRequest.private;
}
+ if (Utils.objectHasProperty(filteredRequest, 'excludeFromSmartCharging')) {
+ chargingStation.excludeFromSmartCharging = filteredRequest.excludeFromSmartCharging;
+ }
// Update Site Area
if (siteArea) {
chargingStation.siteAreaID = siteArea.id;
@@ -180,7 +181,12 @@ export default class ChargingStationService {
}
}
}
+ // Check Smart Charging
+ if (!siteArea.smartCharging) {
+ delete chargingStation.excludeFromSmartCharging;
+ }
} else {
+ delete chargingStation.excludeFromSmartCharging;
chargingStation.siteAreaID = null;
}
if (filteredRequest.coordinates && filteredRequest.coordinates.length === 2) {

MODIFY
src/server/rest/service/security/ChargingStationSecurity.ts
src/server/rest/service/security/ChargingStationSecurity.ts
@@ -236,6 +236,9 @@ export default class ChargingStationSecurity {
if (Utils.objectHasProperty(request, 'maximumPower')) {
filteredRequest.maximumPower = sanitize(request.maximumPower);
}
+ if (Utils.objectHasProperty(request, 'excludeFromSmartCharging')) {
+ filteredRequest.excludeFromSmartCharging = UtilsSecurity.filterBoolean(request.excludeFromSmartCharging);
+ }
if (Utils.objectHasProperty(request, 'private')) {
filteredRequest.private = UtilsSecurity.filterBoolean(request.private);
}

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -485,7 +485,7 @@ export default class ChargingStationStorage {
lastReboot: Utils.convertToDate(chargingStationToSave.lastReboot),
chargingStationURL: chargingStationToSave.chargingStationURL,
maximumPower: Utils.convertToInt(chargingStationToSave.maximumPower),
- excludeFromPowerLimitation: Utils.convertToBoolean(chargingStationToSave.excludeFromPowerLimitation),
+ excludeFromSmartCharging: Utils.convertToBoolean(chargingStationToSave.excludeFromSmartCharging),
powerLimitUnit: chargingStationToSave.powerLimitUnit,
voltage: Utils.convertToInt(chargingStationToSave.voltage),
chargePoints: chargingStationToSave.chargePoints ? chargingStationToSave.chargePoints : null,

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -34,7 +34,7 @@ export default interface ChargingStation extends CreatedUpdatedProps {
chargingStationURL: string;
maximumPower: number;
voltage: Voltage;
- excludeFromPowerLimitation?: boolean;
+ excludeFromSmartCharging?: boolean;
powerLimitUnit: PowerLimitUnits;
coordinates: number[];
chargePoints: ChargePoint[];
@@ -164,7 +164,6 @@ export interface ChargingStationTemplate {
technical: {
maximumPower: number;
voltage?: Voltage;
- excludeFromPowerLimitation: boolean;
powerLimitUnit: PowerLimitUnits;
chargePoints?: ChargePoint[];
connectors: {
@@ -183,11 +182,6 @@ export interface ChargingStationTemplate {
supportedOcppVersions: string[];
capabilities: ChargingStationCapabilities;
}[];
- ocppAdvancedCommands: {
- supportedFirmwareVersions: string[];
- supportedOcppVersions: string[];
- commands: OcppAdvancedCommands[];
- }[];
ocppStandardParameters: {
supportedOcppVersions: string[];
parameters: object;

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -41,6 +41,7 @@ export interface HttpChargingStationParamsUpdateRequest {
chargingStationURL: string;
maximumPower: number;
private: boolean;
+ excludeFromSmartCharging: boolean;
siteAreaID: string;
coordinates: number[];
connectors: {

Added exclude from smart charging prop in charging station