Added manual configuration to charging station
MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -986,7 +986,7 @@ export default class OCPPUtils {
return foundTemplate;
}
- public static async enrichChargingStationWithTemplate(tenantID: string, chargingStation: ChargingStation): Promise<TemplateUpdateResult> {
+ public static async enrichChargingStationWithTemplate(tenantID: string, chargingStation: ChargingStation, manualCall?: boolean): Promise<TemplateUpdateResult> {
const templateUpdate: TemplateUpdate = {
chargingStationUpdate: false,
technicalUpdate: false,
@@ -1005,10 +1005,10 @@ export default class OCPPUtils {
// Copy from template
if (chargingStationTemplate) {
// Already updated?
- if (chargingStation.templateHash !== chargingStationTemplate.hash) {
+ if (chargingStation.templateHash !== chargingStationTemplate.hash || manualCall) {
templateUpdate.chargingStationUpdate = true;
// Check Technical Hash
- if (chargingStation.templateHashTechnical !== chargingStationTemplate.hashTechnical) {
+ if (chargingStation.templateHashTechnical !== chargingStationTemplate.hashTechnical && (!chargingStation.manualConfiguration || manualCall)) {
templateUpdate.technicalUpdate = true;
if (Utils.objectHasProperty(chargingStationTemplate.technical, 'maximumPower')) {
chargingStation.maximumPower = chargingStationTemplate.technical.maximumPower;

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -115,6 +115,17 @@ export default class ChargingStationService {
if (Utils.objectHasProperty(filteredRequest, 'forceInactive')) {
chargingStation.forceInactive = filteredRequest.forceInactive;
}
+ if (Utils.objectHasProperty(filteredRequest, 'manualConfiguration')) {
+ // Check manual config
+ if (filteredRequest.manualConfiguration) {
+ // Do not save charge point
+ delete chargingStation.chargePoints;
+ delete chargingStation.templateHashTechnical;
+ } else if (chargingStation.manualConfiguration && !filteredRequest.manualConfiguration) {
+ await OCPPUtils.enrichChargingStationWithTemplate(req.user.tenantID, chargingStation, true);
+ }
+ chargingStation.manualConfiguration = filteredRequest.manualConfiguration;
+ }
// Existing Connectors
if (!Utils.isEmptyArray(filteredRequest.connectors)) {
for (const filteredConnector of filteredRequest.connectors) {
@@ -762,8 +773,8 @@ export default class ChargingStationService {
const chargingStation = await ChargingStationStorage.getChargingStation(req.user.tenantID, filteredRequest.ID, {},
[
'id', 'inactive', 'public', 'chargingStationURL', 'issuer', 'maximumPower', 'excludeFromSmartCharging', 'lastReboot',
- 'siteAreaID', 'siteArea.id', 'siteArea.name', 'siteArea.smartCharging', 'siteArea.siteID',
- 'siteArea.site.id', 'siteArea.site.name', 'voltage', 'coordinates', 'forceInactive', 'firmwareUpdateStatus',
+ 'siteAreaID', 'siteArea.id', 'siteArea.name', 'siteArea.smartCharging', 'siteArea.numberOfPhases', 'siteArea.siteID',
+ 'siteArea.site.id', 'siteArea.site.name', 'voltage', 'coordinates', 'forceInactive', 'manualConfiguration', 'firmwareUpdateStatus',
'capabilities', 'endpoint', 'chargePointVendor', 'chargePointModel', 'ocppVersion', 'ocppProtocol', 'lastSeen',
'firmwareVersion', 'currentIPAddress', 'ocppStandardParameters', 'ocppVendorParameters', 'connectors', 'chargePoints',
'createdOn', 'chargeBoxSerialNumber', 'chargePointSerialNumber', 'powerLimitUnit'

MODIFY
src/server/rest/v1/service/security/ChargingStationSecurity.ts
src/server/rest/v1/service/security/ChargingStationSecurity.ts
@@ -131,6 +131,9 @@ export default class ChargingStationSecurity {
if (Utils.objectHasProperty(request, 'forceInactive')) {
filteredRequest.forceInactive = UtilsSecurity.filterBoolean(request.forceInactive);
}
+ if (Utils.objectHasProperty(request, 'manualConfiguration')) {
+ filteredRequest.manualConfiguration = UtilsSecurity.filterBoolean(request.manualConfiguration);
+ }
if (Utils.objectHasProperty(request, 'public')) {
filteredRequest.public = UtilsSecurity.filterBoolean(request.public);
}

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -522,6 +522,7 @@ export default class ChargingStationStorage {
maximumPower: Utils.convertToInt(chargingStationToSave.maximumPower),
excludeFromSmartCharging: Utils.convertToBoolean(chargingStationToSave.excludeFromSmartCharging),
forceInactive: Utils.convertToBoolean(chargingStationToSave.forceInactive),
+ manualConfiguration: Utils.convertToBoolean(chargingStationToSave.manualConfiguration),
powerLimitUnit: chargingStationToSave.powerLimitUnit,
voltage: Utils.convertToInt(chargingStationToSave.voltage),
connectors: chargingStationToSave.connectors ? chargingStationToSave.connectors.map(

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -36,6 +36,7 @@ export default interface ChargingStation extends CreatedUpdatedProps {
deleted: boolean;
inactive: boolean;
forceInactive: boolean;
+ manualConfiguration?: boolean;
lastReboot: Date;
chargingStationURL: string;
maximumPower: number;

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -52,6 +52,7 @@ export interface HttpChargingStationParamsUpdateRequest {
public: boolean;
excludeFromSmartCharging: boolean;
forceInactive: boolean;
+ manualConfiguration: boolean;
siteAreaID: string;
coordinates: number[];
connectors: {

Added manual configuration to charging station