Updated OCPI with charge point
MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIMapping.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIMapping.ts
import { CdrDimensionType, OCPIChargingPeriod } from '../../../../types/ocpi/OCPIChargingPeriod';
-import ChargingStation, { Connector, ConnectorType } from '../../../../types/ChargingStation';
+import ChargingStation, { ChargePoint, Connector, ConnectorType } from '../../../../types/ChargingStation';
import { OCPICapability, OCPIEvse, OCPIEvseStatus } from '../../../../types/ocpi/OCPIEvse';
import { OCPIConnector, OCPIConnectorFormat, OCPIConnectorType, OCPIPowerType } from '../../../../types/ocpi/OCPIConnector';
import { OCPILocation, OCPILocationType } from '../../../../types/ocpi/OCPILocation';
@@ -24,6 +24,7 @@ import Tenant from '../../../../types/Tenant';
import Transaction from '../../../../types/Transaction';
import TransactionStorage from '../../../../storage/mongodb/TransactionStorage';
import UserStorage from '../../../../storage/mongodb/UserStorage';
+import Utils from '../../../../utils/Utils';
import moment from 'moment';
/**
@@ -426,13 +427,20 @@ export default class OCPIMapping {
format = OCPIConnectorFormat.CABLE;
break;
}
+ let chargePoint: ChargePoint;
+ if (connector.chargePointID) {
+ chargePoint = Utils.getChargePointFromID(chargingStation, connector.chargePointID);
+ }
+ const voltage = Utils.getChargingStationVoltage(chargingStation, connector.connectorId);
+ const amperage = Utils.getChargingStationAmperage(chargingStation, chargePoint, connector.connectorId);
+ const numberOfConnectedPhase = Utils.getNumberOfConnectedPhases(chargingStation, chargePoint, connector.connectorId);
return {
'id': `${evseID}*${connector.connectorId}`,
'standard': type,
'format': format,
- 'voltage': connector.voltage,
- 'amperage': connector.amperage,
- 'power_type': OCPIMapping.convertNumberofConnectedPhase2PowerType(connector.numberOfConnectedPhase),
+ 'voltage': voltage,
+ 'amperage': amperage,
+ 'power_type': OCPIMapping.convertNumberofConnectedPhase2PowerType(numberOfConnectedPhase),
'last_updated': chargingStation.lastHeartBeat
};
}

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
-import fs from 'fs';
-import path from 'path';
-import url from 'url';
-
-import bcrypt from 'bcryptjs';
-import { Request } from 'express';
-import _ from 'lodash';
-import moment from 'moment';
-import { ObjectID } from 'mongodb';
-import passwordGenerator from 'password-generator';
-import tzlookup from 'tz-lookup';
-import { v4 as uuid } from 'uuid';
-import validator from 'validator';
+import { ChargePointStatus, OCPPProtocol, OCPPVersion } from '../types/ocpp/OCPPServer';
+import ChargingStation, { ChargePoint, Connector, CurrentType, StaticLimitAmps } from '../types/ChargingStation';
+import User, { UserRole, UserStatus } from '../types/User';
-import Authorizations from '../authorization/Authorizations';
+import { ActionsResponse } from '../types/GlobalType';
import AppError from '../exception/AppError';
-import BackendError from '../exception/BackendError';
-import TenantStorage from '../storage/mongodb/TenantStorage';
-import UserStorage from '../storage/mongodb/UserStorage';
import Asset from '../types/Asset';
+import Authorizations from '../authorization/Authorizations';
+import BackendError from '../exception/BackendError';
import { Car } from '../types/Car';
import { ChargingProfile } from '../types/ChargingProfile';
-import ChargingStation, { ChargePoint, Connector, CurrentType, StaticLimitAmps } from '../types/ChargingStation';
import Company from '../types/Company';
+import Configuration from './Configuration';
import ConnectorStats from '../types/ConnectorStats';
-import { ActionsResponse } from '../types/GlobalType';
+import Constants from './Constants';
+import Cypher from './Cypher';
import { HTTPError } from '../types/HTTPError';
+import { InactivityStatus } from '../types/Transaction';
+import Logging from './Logging';
import OCPIEndpoint from '../types/ocpi/OCPIEndpoint';
-import { ChargePointStatus, OCPPProtocol, OCPPVersion } from '../types/ocpp/OCPPServer';
+import { ObjectID } from 'mongodb';
+import { Request } from 'express';
import { ServerAction } from '../types/Server';
import { SettingDBContent } from '../types/Setting';
import Site from '../types/Site';
@@ -34,13 +27,19 @@ import SiteArea from '../types/SiteArea';
import Tag from '../types/Tag';
import Tenant from '../types/Tenant';
import TenantComponents from '../types/TenantComponents';
-import { InactivityStatus } from '../types/Transaction';
-import User, { UserRole, UserStatus } from '../types/User';
+import TenantStorage from '../storage/mongodb/TenantStorage';
+import UserStorage from '../storage/mongodb/UserStorage';
import UserToken from '../types/UserToken';
-import Configuration from './Configuration';
-import Constants from './Constants';
-import Cypher from './Cypher';
-import Logging from './Logging';
+import _ from 'lodash';
+import bcrypt from 'bcryptjs';
+import fs from 'fs';
+import moment from 'moment';
+import passwordGenerator from 'password-generator';
+import path from 'path';
+import tzlookup from 'tz-lookup';
+import url from 'url';
+import { v4 as uuid } from 'uuid';
+import validator from 'validator';
const _centralSystemFrontEndConfig = Configuration.getCentralSystemFrontEndConfig();
const _tenants = [];
@@ -661,7 +660,7 @@ export default class Utils {
// Tslint:disable-next-line: cyclomatic-complexity
public static getChargingStationAmperage(chargingStation: ChargingStation,
- chargePoint: ChargePoint, connectorId = 0): number {
+ chargePoint?: ChargePoint, connectorId = 0): number {
let totalAmps = 0;
if (chargingStation) {
// Check at charge point level

Updated OCPI with charge point