Added voltage in site area
MODIFY
src/assets/charging-station-templates
src/assets/charging-station-templates
-Subproject commit 3a97213a33b5e00388798b5eab5c7a508a272abe
+Subproject commit 700e6cb0c398b80ebd936391ddd724fc2e739d86

MODIFY
src/server/rest/service/SiteAreaService.ts
src/server/rest/service/SiteAreaService.ts
@@ -309,6 +309,7 @@ export default class SiteAreaService {
siteArea.image = filteredRequest.image;
const siteAreaMaxPowerHasChanged = siteArea.maximumPower !== filteredRequest.maximumPower;
siteArea.maximumPower = filteredRequest.maximumPower;
+ siteArea.voltage = filteredRequest.voltage;
if (filteredRequest.smartCharging && filteredRequest.numberOfPhases === 1) {
for (const charger of siteArea.chargingStations) {
for (const connector of charger.connectors) {
@@ -341,6 +342,7 @@ export default class SiteAreaService {
await SiteAreaStorage.saveSiteArea(req.user.tenantID, siteArea, true);
// Regtrigger Smart Charging
if (siteAreaMaxPowerHasChanged && filteredRequest.smartCharging) {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
setTimeout(async () => {
const siteAreaLock = await LockingHelper.createAndAquireExclusiveLockForSiteArea(req.user.tenantID, siteArea);
if (siteAreaLock) {

MODIFY
src/server/rest/service/security/SiteAreaSecurity.ts
src/server/rest/service/security/SiteAreaSecurity.ts
import { HttpSiteAreaConsumptionsRequest, HttpSiteAreaRequest, HttpSiteAreasRequest } from '../../../../types/requests/HttpSiteAreaRequest';
-import SiteArea, { SiteAreaConsumption } from '../../../../types/SiteArea';
import Authorizations from '../../../../authorization/Authorizations';
import ChargingStationSecurity from './ChargingStationSecurity';
import Consumption from '../../../../types/Consumption';
import { DataResult } from '../../../../types/DataResult';
+import SiteArea from '../../../../types/SiteArea';
import SiteSecurity from './SiteSecurity';
import UserToken from '../../../../types/UserToken';
import Utils from '../../../../utils/Utils';
@@ -61,19 +61,6 @@ export default class SiteAreaSecurity {
return SiteAreaSecurity._filterSiteAreaRequest(request);
}
- public static _filterSiteAreaRequest(request: any): Partial<SiteArea> {
- return {
- name: sanitize(request.name),
- address: UtilsSecurity.filterAddressRequest(request.address),
- image: sanitize(request.image),
- maximumPower: sanitize(request.maximumPower),
- numberOfPhases: sanitize(request.numberOfPhases),
- smartCharging: UtilsSecurity.filterBoolean(request.smartCharging),
- accessControl: UtilsSecurity.filterBoolean(request.accessControl),
- siteID: sanitize(request.siteID)
- };
- }
-
static filterSiteAreaResponse(siteArea: SiteArea, loggedUser: UserToken): SiteArea {
let filteredSiteArea: SiteArea;
if (!siteArea) {
@@ -155,4 +142,18 @@ export default class SiteAreaSecurity {
}));
return filteredSiteArea;
}
+
+ private static _filterSiteAreaRequest(request: any): Partial<SiteArea> {
+ return {
+ name: sanitize(request.name),
+ address: UtilsSecurity.filterAddressRequest(request.address),
+ image: sanitize(request.image),
+ maximumPower: sanitize(request.maximumPower),
+ numberOfPhases: sanitize(request.numberOfPhases),
+ voltage: sanitize(request.voltage),
+ smartCharging: UtilsSecurity.filterBoolean(request.smartCharging),
+ accessControl: UtilsSecurity.filterBoolean(request.accessControl),
+ siteID: sanitize(request.siteID)
+ };
+ }
}

MODIFY
src/storage/mongodb/SiteAreaStorage.ts
src/storage/mongodb/SiteAreaStorage.ts
@@ -67,6 +67,7 @@ export default class SiteAreaStorage {
smartCharging: Utils.convertToBoolean(siteAreaToSave.smartCharging),
siteID: Utils.convertToObjectID(siteAreaToSave.siteID),
maximumPower: Utils.convertToFloat(siteAreaToSave.maximumPower),
+ voltage: Utils.convertToInt(siteAreaToSave.voltage),
numberOfPhases: Utils.convertToInt(siteAreaToSave.numberOfPhases),
};
if (siteAreaToSave.address) {

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -33,7 +33,7 @@ export default interface ChargingStation extends CreatedUpdatedProps {
lastReboot: Date;
chargingStationURL: string;
maximumPower: number;
- voltage: number;
+ voltage: Voltage;
excludeFromPowerLimitation?: boolean;
powerLimitUnit: PowerLimitUnits;
coordinates: number[];
@@ -93,7 +93,7 @@ export interface Connector {
vendorErrorCode?: string;
power: number;
type: ConnectorType;
- voltage?: number;
+ voltage?: Voltage;
amperage?: number;
amperageLimit?: number;
activeTransactionID?: number;
@@ -137,7 +137,7 @@ export enum CurrentType {
export interface ChargePoint {
currentType: CurrentType;
- voltage: number;
+ voltage: Voltage;
amperage: number;
numberOfConnectedPhase: number;
cannotChargeInParallel: boolean;
@@ -148,6 +148,11 @@ export interface ChargePoint {
connectorIDs: number[];
}
+export enum Voltage {
+ VOLTAGE_230 = 230,
+ VOLTAGE_110 = 110,
+}
+
export interface ChargingStationTemplate {
id?: string;
hash?: string;
@@ -158,7 +163,7 @@ export interface ChargingStationTemplate {
};
technical: {
maximumPower: number;
- voltage?: number;
+ voltage?: Voltage;
excludeFromPowerLimitation: boolean;
powerLimitUnit: PowerLimitUnits;
chargePoints?: ChargePoint[];
@@ -167,7 +172,7 @@ export interface ChargingStationTemplate {
type: ConnectorType;
power?: number;
amperage?: number;
- voltage?: number;
+ voltage?: Voltage;
chargePointID?: number;
currentType?: CurrentType;
numberOfConnectedPhase?: number;

MODIFY
src/types/SiteArea.ts
src/types/SiteArea.ts
+import ChargingStation, { Voltage } from '../types/ChargingStation';
+
import Address from './Address';
-import ChargingStation from '../types/ChargingStation';
import ConnectorStats from './ConnectorStats';
import CreatedUpdatedProps from './CreatedUpdatedProps';
import Site from '../types/Site';
@@ -9,6 +10,7 @@ export default interface SiteArea extends CreatedUpdatedProps {
name: string;
issuer: boolean;
maximumPower: number;
+ voltage: Voltage;
numberOfPhases: number;
address: Address;
image: string;

Added voltage in site area