@zetra/citrineos-smartcharging 1.8.3-fork.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ export { SmartChargingOcpp201Api } from './module/2.0.1/MessageApi.js';
2
+ export { SmartChargingOcpp16Api } from './module/1.6/MessageApi.js';
3
+ export type { ISmartChargingModuleApi } from './module/interface.js';
4
+ export { SmartChargingModule } from './module/module.js';
5
+ export type { ISmartCharging } from './module/smartCharging/index.js';
6
+ export { InternalSmartCharging } from './module/smartCharging/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ export { SmartChargingOcpp201Api } from './module/2.0.1/MessageApi.js';
5
+ export { SmartChargingOcpp16Api } from './module/1.6/MessageApi.js';
6
+ export { SmartChargingModule } from './module/module.js';
7
+ export { InternalSmartCharging } from './module/smartCharging/index.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ILogObj } from 'tslog';
2
+ import { Logger } from 'tslog';
3
+ import type { ISmartChargingModuleApi } from '../interface.js';
4
+ import { SmartChargingModule } from '../module.js';
5
+ import type { CallAction, IMessageConfirmation } from '@citrineos/base';
6
+ import { AbstractModuleApi, OCPP1_6 } from '@citrineos/base';
7
+ import type { FastifyInstance } from 'fastify';
8
+ /**
9
+ * Server API for the OCPP 1.6 SmartCharging module.
10
+ */
11
+ export declare class SmartChargingOcpp16Api extends AbstractModuleApi<SmartChargingModule> implements ISmartChargingModuleApi {
12
+ /**
13
+ * Constructs a new instance of the class.
14
+ *
15
+ * @param {SmartChargingModule} smartChargingModule - The SmartCharging module.
16
+ * @param {FastifyInstance} server - The Fastify server instance.
17
+ * @param {Logger<ILogObj>} [logger] - The logger instance.
18
+ */
19
+ constructor(smartChargingModule: SmartChargingModule, server: FastifyInstance, logger?: Logger<ILogObj>);
20
+ setChargingProfile(identifier: string[], request: OCPP1_6.SetChargingProfileRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
21
+ clearChargingProfile(identifier: string[], request: OCPP1_6.ClearChargingProfileRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
22
+ getCompositeSchedule(identifier: string[], request: OCPP1_6.GetCompositeScheduleRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
23
+ /**
24
+ * Overrides superclass method to generate the URL path based on the input {@link CallAction}
25
+ * and the module's endpoint prefix configuration.
26
+ *
27
+ * @param {CallAction} input - The input {@link CallAction}.
28
+ * @return {string} - The generated URL path.
29
+ */
30
+ protected _toMessagePath(input: CallAction): string;
31
+ }
@@ -0,0 +1,69 @@
1
+ // SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
5
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ };
10
+ var __metadata = (this && this.__metadata) || function (k, v) {
11
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12
+ };
13
+ import { Logger } from 'tslog';
14
+ import { SmartChargingModule } from '../module.js';
15
+ import { AbstractModuleApi, AsMessageEndpoint, DEFAULT_TENANT_ID, OCPP1_6, OCPP1_6_CallAction, OCPPVersion, } from '@citrineos/base';
16
+ /**
17
+ * Server API for the OCPP 1.6 SmartCharging module.
18
+ */
19
+ export class SmartChargingOcpp16Api extends AbstractModuleApi {
20
+ /**
21
+ * Constructs a new instance of the class.
22
+ *
23
+ * @param {SmartChargingModule} smartChargingModule - The SmartCharging module.
24
+ * @param {FastifyInstance} server - The Fastify server instance.
25
+ * @param {Logger<ILogObj>} [logger] - The logger instance.
26
+ */
27
+ constructor(smartChargingModule, server, logger) {
28
+ super(smartChargingModule, server, OCPPVersion.OCPP1_6, logger);
29
+ }
30
+ setChargingProfile(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
31
+ return Promise.all(identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP1_6, OCPP1_6_CallAction.SetChargingProfile, request, callbackUrl)));
32
+ }
33
+ clearChargingProfile(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
34
+ return Promise.all(identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP1_6, OCPP1_6_CallAction.ClearChargingProfile, request, callbackUrl)));
35
+ }
36
+ getCompositeSchedule(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
37
+ return Promise.all(identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP1_6, OCPP1_6_CallAction.GetCompositeSchedule, request, callbackUrl)));
38
+ }
39
+ /**
40
+ * Overrides superclass method to generate the URL path based on the input {@link CallAction}
41
+ * and the module's endpoint prefix configuration.
42
+ *
43
+ * @param {CallAction} input - The input {@link CallAction}.
44
+ * @return {string} - The generated URL path.
45
+ */
46
+ _toMessagePath(input) {
47
+ const endpointPrefix = this._module.config.modules.smartcharging?.endpointPrefix;
48
+ return super._toMessagePath(input, endpointPrefix);
49
+ }
50
+ }
51
+ __decorate([
52
+ AsMessageEndpoint(OCPP1_6_CallAction.SetChargingProfile, OCPP1_6.SetChargingProfileRequestSchema),
53
+ __metadata("design:type", Function),
54
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
55
+ __metadata("design:returntype", Promise)
56
+ ], SmartChargingOcpp16Api.prototype, "setChargingProfile", null);
57
+ __decorate([
58
+ AsMessageEndpoint(OCPP1_6_CallAction.ClearChargingProfile, OCPP1_6.ClearChargingProfileRequestSchema),
59
+ __metadata("design:type", Function),
60
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
61
+ __metadata("design:returntype", Promise)
62
+ ], SmartChargingOcpp16Api.prototype, "clearChargingProfile", null);
63
+ __decorate([
64
+ AsMessageEndpoint(OCPP1_6_CallAction.GetCompositeSchedule, OCPP1_6.GetCompositeScheduleRequestSchema),
65
+ __metadata("design:type", Function),
66
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
67
+ __metadata("design:returntype", Promise)
68
+ ], SmartChargingOcpp16Api.prototype, "getCompositeSchedule", null);
69
+ //# sourceMappingURL=MessageApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageApi.js","sourceRoot":"","sources":["../../../src/module/1.6/MessageApi.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;;;;;;;;;;AAGtC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAGzB;;GAEG;AACH,MAAM,OAAO,sBACX,SAAQ,iBAAsC;IAG9C;;;;;;OAMG;IACH,YACE,mBA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,CAAC,aAAa,EAAE,cAAc,CAAC;QACjF,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACrD,CAAC;CACF;AA/EC;IADC,iBAAiB,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,CAAC,+BAA+B,CAAC;;;;gEAmBjG;AAMD;IAJC,iBAAiB,CAChB,kBAAkB,CAAC,oBAAoB,EACvC,OAAO,CAAC,iCAAiC,CAC1C;;;;kEAmBA;AAMD;IAJC,iBAAiB,CAChB,kBAAkB,CAAC,oBAAoB,EACvC,OAAO,CAAC,iCAAiC,CAC1C;;;;kEAmBA"}
@@ -0,0 +1,45 @@
1
+ import type { CallAction, IMessageConfirmation } from '@citrineos/base';
2
+ import { AbstractModuleApi, Namespace, OCPP1_6_Namespace, OCPP2_0_1, OCPP2_0_1_Namespace } from '@citrineos/base';
3
+ import type { FastifyInstance } from 'fastify';
4
+ import type { ILogObj } from 'tslog';
5
+ import { Logger } from 'tslog';
6
+ import type { ISmartChargingModuleApi } from '../interface.js';
7
+ import { SmartChargingModule } from '../module.js';
8
+ /**
9
+ * Server API for the SmartCharging module.
10
+ */
11
+ export declare class SmartChargingOcpp201Api extends AbstractModuleApi<SmartChargingModule> implements ISmartChargingModuleApi {
12
+ /**
13
+ * Constructs a new instance of the class.
14
+ *
15
+ * @param {SmartChargingModule} smartChargingModule - The SmartCharging module.
16
+ * @param {FastifyInstance} server - The Fastify server instance.
17
+ * @param {Logger<ILogObj>} [logger] - The logger instance.
18
+ */
19
+ constructor(smartChargingModule: SmartChargingModule, server: FastifyInstance, logger?: Logger<ILogObj>);
20
+ clearChargingProfile(identifier: string[], request: OCPP2_0_1.ClearChargingProfileRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
21
+ getChargingProfiles(identifier: string[], request: OCPP2_0_1.GetChargingProfilesRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
22
+ setChargingProfile(identifier: string[], request: OCPP2_0_1.SetChargingProfileRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
23
+ clearedChargingLimit(identifier: string[], request: OCPP2_0_1.ClearedChargingLimitRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
24
+ getCompositeSchedule(identifier: string[], request: OCPP2_0_1.GetCompositeScheduleRequest, callbackUrl?: string, tenantId?: number): Promise<IMessageConfirmation[]>;
25
+ /**
26
+ * Overrides superclass method to generate the URL path based on the input {@link CallAction}
27
+ * and the module's endpoint prefix configuration.
28
+ *
29
+ * @param {CallAction} input - The input {@link CallAction}.
30
+ * @return {string} - The generated URL path.
31
+ */
32
+ protected _toMessagePath(input: CallAction): string;
33
+ /**
34
+ * Overrides superclass method to generate the URL path based on the input {@link Namespace}
35
+ * and the module's endpoint prefix configuration.
36
+ *
37
+ * @param {CallAction} input - The input {@link Namespace}.
38
+ * @return {string} - The generated URL path.
39
+ */
40
+ protected _toDataPath(input: OCPP2_0_1_Namespace | OCPP1_6_Namespace | Namespace): string;
41
+ /**
42
+ * Returns a set of allowed RateUnit values (if defined on the station).
43
+ */
44
+ private _getChargingRateUnitMemberList;
45
+ }
@@ -0,0 +1,443 @@
1
+ // SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
5
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ };
10
+ var __metadata = (this && this.__metadata) || function (k, v) {
11
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12
+ };
13
+ import { AbstractModuleApi, AsMessageEndpoint, ChargingLimitSourceEnum, DEFAULT_TENANT_ID, Namespace, OCPP1_6_Namespace, OCPP2_0_1, OCPP2_0_1_CallAction, OCPP2_0_1_Namespace, OCPPVersion, } from '@citrineos/base';
14
+ import { OCPP2_0_1_Mapper, VariableAttribute } from '@citrineos/data';
15
+ import { stringToSet, validateChargingProfileType } from '@citrineos/util';
16
+ import { Logger } from 'tslog';
17
+ import { SmartChargingModule } from '../module.js';
18
+ /**
19
+ * Server API for the SmartCharging module.
20
+ */
21
+ export class SmartChargingOcpp201Api extends AbstractModuleApi {
22
+ /**
23
+ * Constructs a new instance of the class.
24
+ *
25
+ * @param {SmartChargingModule} smartChargingModule - The SmartCharging module.
26
+ * @param {FastifyInstance} server - The Fastify server instance.
27
+ * @param {Logger<ILogObj>} [logger] - The logger instance.
28
+ */
29
+ constructor(smartChargingModule, server, logger) {
30
+ super(smartChargingModule, server, OCPPVersion.OCPP2_0_1, logger);
31
+ }
32
+ async clearChargingProfile(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
33
+ const responses = [];
34
+ for (const id of identifier) {
35
+ const chargingProfileCriteria = request.chargingProfileCriteria;
36
+ // OCPP 2.0.1 Part 2 K10.FR.02
37
+ if (!request.chargingProfileId) {
38
+ if (!chargingProfileCriteria) {
39
+ responses.push({
40
+ success: false,
41
+ payload: 'Either chargingProfileId or chargingProfileCriteria must be provided',
42
+ });
43
+ continue;
44
+ }
45
+ else {
46
+ if (!chargingProfileCriteria.chargingProfilePurpose &&
47
+ !chargingProfileCriteria.stackLevel &&
48
+ !chargingProfileCriteria.evseId) {
49
+ responses.push({
50
+ success: false,
51
+ payload: 'At least one of chargingProfilePurpose, stackLevel, or evseId must be provided when chargingProfileId is not provided.',
52
+ });
53
+ continue;
54
+ }
55
+ }
56
+ }
57
+ else {
58
+ if (chargingProfileCriteria) {
59
+ responses.push({
60
+ success: false,
61
+ payload: 'chargingProfileCriteria is not needed when chargingProfileId is provided.',
62
+ });
63
+ continue;
64
+ }
65
+ }
66
+ // OCPP 2.0.1 Part 2 K10.FR.06
67
+ if (chargingProfileCriteria?.chargingProfilePurpose ===
68
+ OCPP2_0_1.ChargingProfilePurposeEnumType.ChargingStationExternalConstraints) {
69
+ responses.push({
70
+ success: false,
71
+ payload: 'The CSMS SHALL NOT set chargingProfilePurpose to ChargingStationExternalConstraints.',
72
+ });
73
+ continue;
74
+ }
75
+ const response = await this._module.sendCall(id, tenantId, OCPPVersion.OCPP2_0_1, OCPP2_0_1_CallAction.ClearChargingProfile, request, callbackUrl);
76
+ responses.push(response);
77
+ }
78
+ return responses;
79
+ }
80
+ async getChargingProfiles(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
81
+ const chargingProfile = request.chargingProfile;
82
+ // OCPP 2.0.1 Part 2 K09.FR.03
83
+ if (chargingProfile.chargingProfileId) {
84
+ if (chargingProfile.chargingProfilePurpose ||
85
+ chargingProfile.stackLevel ||
86
+ chargingProfile.chargingLimitSource) {
87
+ return identifier.map(() => ({
88
+ success: false,
89
+ payload: 'chargingProfilePurpose, stackLevel, and chargingLimitSource are not needed when chargingProfileId is provided.',
90
+ }));
91
+ }
92
+ }
93
+ else {
94
+ if (!chargingProfile.chargingProfilePurpose &&
95
+ !chargingProfile.stackLevel &&
96
+ !chargingProfile.chargingLimitSource) {
97
+ return identifier.map(() => ({
98
+ success: false,
99
+ payload: 'At least one of chargingProfilePurpose, stackLevel, or chargingLimitSource must be provided when chargingProfileId is not provided.',
100
+ }));
101
+ }
102
+ }
103
+ // Validate ChargingProfileCriterionType.chargingProfileId
104
+ if (chargingProfile.chargingProfileId && chargingProfile.chargingProfileId.length > 1) {
105
+ const chargingProfilesEntries = await this._module.deviceModelRepository.findVariableCharacteristicsByVariableNameAndVariableInstance(tenantId, 'Entries', 'ChargingProfiles');
106
+ if (chargingProfilesEntries &&
107
+ chargingProfilesEntries.maxLimit &&
108
+ chargingProfile.chargingProfileId.length > chargingProfilesEntries.maxLimit) {
109
+ return identifier.map(() => ({
110
+ success: false,
111
+ payload: `The max length of chargingProfileId is ${chargingProfilesEntries.maxLimit}.`,
112
+ }));
113
+ }
114
+ }
115
+ // Send calls for each station
116
+ const results = await Promise.all(identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP2_0_1, OCPP2_0_1_CallAction.GetChargingProfiles, request, callbackUrl)));
117
+ return results;
118
+ }
119
+ async setChargingProfile(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
120
+ // Process each station individually
121
+ return Promise.all(identifier.map(async (id) => {
122
+ this._logger.info(`Received SetChargingProfile for station ${id}: ${JSON.stringify(request)}`);
123
+ const chargingProfile = request.chargingProfile;
124
+ // Validate ChargingProfileType's constraints
125
+ try {
126
+ await validateChargingProfileType(chargingProfile, tenantId, id, this._module.deviceModelRepository, this._module.chargingProfileRepository, this._module.transactionEventRepository, this._logger, request.evseId);
127
+ }
128
+ catch (error) {
129
+ return {
130
+ success: false,
131
+ payload: error instanceof Error ? error.message : JSON.stringify(error),
132
+ };
133
+ }
134
+ // Additional use case checks
135
+ const now = new Date();
136
+ const validFrom = chargingProfile.validFrom ? new Date(chargingProfile.validFrom) : null;
137
+ const validTo = chargingProfile.validTo ? new Date(chargingProfile.validTo) : null;
138
+ // OCPP 2.0.1 Part 2 K01.FR.36
139
+ if (validFrom && validFrom.getTime() > now.getTime()) {
140
+ return {
141
+ success: false,
142
+ payload: `chargingProfile validFrom ${chargingProfile.validFrom} should not be in the future.`,
143
+ };
144
+ }
145
+ // OCPP 2.0.1 Part 2 K01.FR.37
146
+ if (validTo && validTo.getTime() <= now.getTime()) {
147
+ return {
148
+ success: false,
149
+ payload: `chargingProfile validTo ${chargingProfile.validTo} should be in the future.`,
150
+ };
151
+ }
152
+ // If TxProfile
153
+ if (chargingProfile.chargingProfilePurpose ===
154
+ OCPP2_0_1.ChargingProfilePurposeEnumType.TxProfile) {
155
+ // OCPP 2.0.1 Part 2 K01.FR.03
156
+ if (!chargingProfile.transactionId) {
157
+ return {
158
+ success: false,
159
+ payload: 'Missing transactionId for chargingProfilePurpose TxProfile.',
160
+ };
161
+ }
162
+ // OCPP 2.0.1 Part 2 K01.FR.09
163
+ const transaction = await this._module.transactionEventRepository.readTransactionByStationIdAndTransactionId(tenantId, id, chargingProfile.transactionId);
164
+ if (!transaction) {
165
+ return {
166
+ success: false,
167
+ payload: `Transaction ${chargingProfile.transactionId} not found on station ${id}.`,
168
+ };
169
+ }
170
+ // OCPP 2.0.1 Part 2 K01.FR.16
171
+ if (request.evseId <= 0) {
172
+ return {
173
+ success: false,
174
+ payload: 'TxProfile SHALL only be used with evseId > 0.',
175
+ };
176
+ }
177
+ const evse = await this._module.deviceModelRepository.findEvseByIdAndConnectorId(tenantId, request.evseId, null);
178
+ if (!evse) {
179
+ return {
180
+ success: false,
181
+ payload: `Evse ${request.evseId} not found.`,
182
+ };
183
+ }
184
+ this._logger.info(`Found evse: ${JSON.stringify(evse)}`);
185
+ // OCPP 2.0.1 Part 2 K01.FR.34
186
+ // Must have received a NotifyEVChargingNeedsReq if more than one schedule is provided
187
+ const receivedChargingNeeds = await this._module.chargingProfileRepository.findChargingNeedsByEvseDBIdAndTransactionDBId(tenantId, evse.databaseId, transaction.id);
188
+ if (!receivedChargingNeeds && chargingProfile.chargingSchedule.length > 1) {
189
+ return {
190
+ success: false,
191
+ payload: `No prior NotifyEVChargingNeedsReq found for this transaction ${transaction.id}. Only one ChargingScheduleType allowed without it.`,
192
+ };
193
+ }
194
+ // OCPP 2.0.1 Part 2 K01.FR.39
195
+ const numExisted = await this._module.chargingProfileRepository.existByQuery(tenantId, {
196
+ where: {
197
+ stackLevel: chargingProfile.stackLevel,
198
+ transactionDatabaseId: transaction.id,
199
+ chargingProfilePurpose: chargingProfile.chargingProfilePurpose,
200
+ isActive: true,
201
+ tenantId,
202
+ },
203
+ });
204
+ if (numExisted > 0) {
205
+ return {
206
+ success: false,
207
+ payload: `${numExisted} ChargingProfile with stackLevel ${chargingProfile.stackLevel} and transactionId ${chargingProfile.transactionId} already exists.`,
208
+ };
209
+ }
210
+ }
211
+ else if (chargingProfile.chargingProfilePurpose ===
212
+ OCPP2_0_1.ChargingProfilePurposeEnumType.ChargingStationExternalConstraints) {
213
+ // OCPP 2.0.1 Part 2 K01.FR.22
214
+ return {
215
+ success: false,
216
+ payload: 'The CSMS SHALL NOT set chargingProfilePurpose to ChargingStationExternalConstraints.',
217
+ };
218
+ }
219
+ else {
220
+ // E.g., ChargingStationMaxProfile or custom
221
+ if (chargingProfile.chargingProfilePurpose ===
222
+ OCPP2_0_1.ChargingProfilePurposeEnumType.ChargingStationMaxProfile) {
223
+ // OCPP 2.0.1 Part 2 K01.FR.38
224
+ if (chargingProfile.chargingProfileKind === OCPP2_0_1.ChargingProfileKindEnumType.Relative) {
225
+ return {
226
+ success: false,
227
+ payload: 'When chargingProfilePurpose is ChargingStationMaxProfile, chargingProfileKind SHALL NOT be Relative.',
228
+ };
229
+ }
230
+ }
231
+ // Check for existing profiles with the same stack level and purpose
232
+ const existedChargingProfiles = await this._module.chargingProfileRepository.readAllByQuery(tenantId, {
233
+ where: {
234
+ stationId: id,
235
+ stackLevel: chargingProfile.stackLevel,
236
+ chargingProfilePurpose: chargingProfile.chargingProfilePurpose,
237
+ evseId: request.evseId,
238
+ isActive: true,
239
+ tenantId,
240
+ },
241
+ });
242
+ this._logger.info(`Found existing charging profiles: ${JSON.stringify(existedChargingProfiles)}`);
243
+ if (existedChargingProfiles.length > 0) {
244
+ if (!validTo) {
245
+ return {
246
+ success: false,
247
+ payload: 'No two charging profiles with the same stack level and purpose can be valid at the same time.',
248
+ };
249
+ }
250
+ else {
251
+ for (const existedProfile of existedChargingProfiles) {
252
+ const existedValidTo = existedProfile.validTo
253
+ ? new Date(existedProfile.validTo)
254
+ : null;
255
+ if (!existedValidTo || existedValidTo.getTime() >= validTo.getTime()) {
256
+ return {
257
+ success: false,
258
+ payload: 'No two charging profiles with the same stack level and purpose can be valid at the same time.',
259
+ };
260
+ }
261
+ }
262
+ }
263
+ }
264
+ }
265
+ // Additional checks on scheduling
266
+ const acPhaseSwitchingSupported = await this._module.deviceModelRepository.readAllByQuerystring(tenantId, {
267
+ tenantId,
268
+ stationId: id,
269
+ component_evse_id: request.evseId,
270
+ component_name: 'SmartChargingCtrlr',
271
+ variable_name: 'ACPhaseSwitchingSupported',
272
+ type: OCPP2_0_1.AttributeEnumType.Actual,
273
+ });
274
+ this._logger.info(`Found ACPhaseSwitchingSupported for station ${id}: ${JSON.stringify(acPhaseSwitchingSupported)}`);
275
+ const rateUnitMemberList = await this._getChargingRateUnitMemberList(tenantId);
276
+ for (const chargingSchedule of chargingProfile.chargingSchedule) {
277
+ // OCPP 2.0.1 Part 2 K01.FR.31
278
+ if (chargingSchedule.chargingSchedulePeriod[0].startPeriod !== 0) {
279
+ return {
280
+ success: false,
281
+ payload: `ChargingSchedule ${chargingSchedule.id}: ` +
282
+ `The startPeriod of the first chargingSchedulePeriod SHALL be 0.`,
283
+ };
284
+ }
285
+ if (chargingProfile.chargingProfileKind ===
286
+ OCPP2_0_1.ChargingProfileKindEnumType.Absolute ||
287
+ chargingProfile.chargingProfileKind === OCPP2_0_1.ChargingProfileKindEnumType.Recurring) {
288
+ // OCPP 2.0.1 Part 2 K01.FR.40
289
+ if (!chargingSchedule.startSchedule) {
290
+ return {
291
+ success: false,
292
+ payload: `ChargingSchedule ${chargingSchedule.id}: ` +
293
+ `startSchedule SHALL be set when chargingProfileKind is Absolute or Recurring.`,
294
+ };
295
+ }
296
+ }
297
+ else if (chargingProfile.chargingProfileKind === OCPP2_0_1.ChargingProfileKindEnumType.Relative) {
298
+ // OCPP 2.0.1 Part 2 K01.FR.41
299
+ if (chargingSchedule.startSchedule) {
300
+ return {
301
+ success: false,
302
+ payload: `ChargingSchedule ${chargingSchedule.id}: ` +
303
+ `startSchedule SHALL be absent when chargingProfileKind is Relative.`,
304
+ };
305
+ }
306
+ }
307
+ // OCPP 2.0.1 Part 2 K01.FR.26
308
+ if (rateUnitMemberList && !rateUnitMemberList.has(chargingSchedule.chargingRateUnit)) {
309
+ return {
310
+ success: false,
311
+ payload: `ChargingSchedule ${chargingSchedule.id}: ` +
312
+ `chargingRateUnit SHALL be one of ${JSON.stringify(Array.from(rateUnitMemberList))}.`,
313
+ };
314
+ }
315
+ // Sort periods by ascending startPeriod
316
+ chargingSchedule.chargingSchedulePeriod.sort((p1, p2) => {
317
+ if (p1.startPeriod > p2.startPeriod)
318
+ return 1;
319
+ if (p1.startPeriod < p2.startPeriod)
320
+ return -1;
321
+ return 0;
322
+ });
323
+ // More checks on each period
324
+ for (const chargingSchedulePeriod of chargingSchedule.chargingSchedulePeriod) {
325
+ if (chargingSchedulePeriod.phaseToUse) {
326
+ // OCPP 2.0.1 Part 2 K01.FR.19
327
+ if (chargingSchedulePeriod.numberPhases !== 1) {
328
+ return {
329
+ success: false,
330
+ payload: `chargingSchedulePeriod with phaseToUse requires numberPhases=1`,
331
+ };
332
+ }
333
+ // If AC switching not supported
334
+ if (!acPhaseSwitchingSupported.length) {
335
+ return {
336
+ success: false,
337
+ payload: `phaseToUse not allowed if AC phase switching is not supported by station ${id}.`,
338
+ };
339
+ }
340
+ }
341
+ }
342
+ }
343
+ // Save the charging profile, set the source to "CSO"
344
+ await this._module.chargingProfileRepository.createOrUpdateChargingProfile(tenantId, OCPP2_0_1_Mapper.ChargingProfileMapper.fromChargingProfileType(chargingProfile), id, request.evseId, ChargingLimitSourceEnum.CSO);
345
+ // Finally, send the call to the station
346
+ return this._module.sendCall(id, tenantId, OCPPVersion.OCPP2_0_1, OCPP2_0_1_CallAction.SetChargingProfile, request, callbackUrl);
347
+ }));
348
+ }
349
+ clearedChargingLimit(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
350
+ return Promise.all(identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP2_0_1, OCPP2_0_1_CallAction.ClearedChargingLimit, request, callbackUrl)));
351
+ }
352
+ async getCompositeSchedule(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
353
+ return Promise.all(identifier.map(async (id) => {
354
+ // OCPP 2.0.1 Part 2 K08.FR.05
355
+ if (request.evseId !== 0) {
356
+ const evse = await this._module.deviceModelRepository.findEvseByIdAndConnectorId(tenantId, request.evseId, null);
357
+ if (!evse) {
358
+ return {
359
+ success: false,
360
+ payload: `EVSE ${request.evseId} not found for station ${id}.`,
361
+ };
362
+ }
363
+ this._logger.info(`Found evse for station ${id}: ${JSON.stringify(evse)}`);
364
+ }
365
+ // OCPP 2.0.1 Part 2 K08.FR.07
366
+ if (request.chargingRateUnit) {
367
+ const rateUnitMemberList = await this._getChargingRateUnitMemberList(tenantId);
368
+ if (rateUnitMemberList && !rateUnitMemberList.has(request.chargingRateUnit)) {
369
+ return {
370
+ success: false,
371
+ payload: `chargingRateUnit SHALL be one of ` + `[${Array.from(rateUnitMemberList)}].`,
372
+ };
373
+ }
374
+ }
375
+ return this._module.sendCall(id, tenantId, OCPPVersion.OCPP2_0_1, OCPP2_0_1_CallAction.GetCompositeSchedule, request, callbackUrl);
376
+ }));
377
+ }
378
+ /**
379
+ * Overrides superclass method to generate the URL path based on the input {@link CallAction}
380
+ * and the module's endpoint prefix configuration.
381
+ *
382
+ * @param {CallAction} input - The input {@link CallAction}.
383
+ * @return {string} - The generated URL path.
384
+ */
385
+ _toMessagePath(input) {
386
+ const endpointPrefix = this._module.config.modules.smartcharging?.endpointPrefix;
387
+ return super._toMessagePath(input, endpointPrefix);
388
+ }
389
+ /**
390
+ * Overrides superclass method to generate the URL path based on the input {@link Namespace}
391
+ * and the module's endpoint prefix configuration.
392
+ *
393
+ * @param {CallAction} input - The input {@link Namespace}.
394
+ * @return {string} - The generated URL path.
395
+ */
396
+ _toDataPath(input) {
397
+ const endpointPrefix = this._module.config.modules.smartcharging?.endpointPrefix;
398
+ return super._toDataPath(input, endpointPrefix);
399
+ }
400
+ /**
401
+ * Returns a set of allowed RateUnit values (if defined on the station).
402
+ */
403
+ async _getChargingRateUnitMemberList(tenantId) {
404
+ const chargingScheduleChargingRateUnit = await this._module.deviceModelRepository.findVariableCharacteristicsByVariableNameAndVariableInstance(tenantId, 'RateUnit', null);
405
+ this._logger.info(`Found RateUnit: ${JSON.stringify(chargingScheduleChargingRateUnit)}`);
406
+ if (chargingScheduleChargingRateUnit &&
407
+ chargingScheduleChargingRateUnit.dataType === OCPP2_0_1.DataEnumType.MemberList &&
408
+ chargingScheduleChargingRateUnit.valuesList) {
409
+ return stringToSet(chargingScheduleChargingRateUnit.valuesList);
410
+ }
411
+ }
412
+ }
413
+ __decorate([
414
+ AsMessageEndpoint(OCPP2_0_1_CallAction.ClearChargingProfile, OCPP2_0_1.ClearChargingProfileRequestSchema),
415
+ __metadata("design:type", Function),
416
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
417
+ __metadata("design:returntype", Promise)
418
+ ], SmartChargingOcpp201Api.prototype, "clearChargingProfile", null);
419
+ __decorate([
420
+ AsMessageEndpoint(OCPP2_0_1_CallAction.GetChargingProfiles, OCPP2_0_1.GetChargingProfilesRequestSchema),
421
+ __metadata("design:type", Function),
422
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
423
+ __metadata("design:returntype", Promise)
424
+ ], SmartChargingOcpp201Api.prototype, "getChargingProfiles", null);
425
+ __decorate([
426
+ AsMessageEndpoint(OCPP2_0_1_CallAction.SetChargingProfile, OCPP2_0_1.SetChargingProfileRequestSchema),
427
+ __metadata("design:type", Function),
428
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
429
+ __metadata("design:returntype", Promise)
430
+ ], SmartChargingOcpp201Api.prototype, "setChargingProfile", null);
431
+ __decorate([
432
+ AsMessageEndpoint(OCPP2_0_1_CallAction.ClearedChargingLimit, OCPP2_0_1.ClearedChargingLimitRequestSchema),
433
+ __metadata("design:type", Function),
434
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
435
+ __metadata("design:returntype", Promise)
436
+ ], SmartChargingOcpp201Api.prototype, "clearedChargingLimit", null);
437
+ __decorate([
438
+ AsMessageEndpoint(OCPP2_0_1_CallAction.GetCompositeSchedule, OCPP2_0_1.GetCompositeScheduleRequestSchema),
439
+ __metadata("design:type", Function),
440
+ __metadata("design:paramtypes", [Array, Object, String, Number]),
441
+ __metadata("design:returntype", Promise)
442
+ ], SmartChargingOcpp201Api.prototype, "getCompositeSchedule", null);
443
+ //# sourceMappingURL=MessageApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageApi.js","sourceRoot":"","sources":["../../../src/module/2.0.1/MessageApi.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;;;;;;;;;;AAGtC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,uBACX,SAAQ,iBAAsC;IAG9C;;;;;;OAMG;IACH,YACE,mBAAwC,EACxC,MAAuB,EACvB,MAAwB;QAExB,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAMK,AAAN,KAAK,CAAC,oBAAoB,CACxB,UAAoB,EACpB,OAA8C,EAC9C,WAAoB,EACpB,WAAmB,iBAAiB;QAEpC,MAAM,SAAS,GAA2B,EAAE,CAAC;QAE7C,KAAK,MAAM,EAAE,IAAI,UAAU,EA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